mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] localmodconfig: Explicitly report boolean configs during integrity check
@ 2026-09-25 18:12 Aaron Tomlin
  2026-10-05 15:30 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Tomlin @ 2026-09-25 18:12 UTC (permalink / raw)
  To: nathan, nsc; +Cc: julianbraha, atomlin, linux-kbuild, linux-kernel

When running make localmodconfig, streamline_config.pl reads loaded
modules and maps each module object to its corresponding Kconfig
symbol(s) using repository Makefiles.

In several instances, a loaded module corresponds to an object
controlled by a boolean symbol (e.g. config FOO declared as bool), or is
a composite module that depends on a boolean configuration. Because
boolean options only accept "=y" or disabled, they cannot be configured
as loadable modules ("=m").

Previously, if such a symbol was not already built-in ("=y") in the
baseline configuration, the final integrity check emitted an ambiguous
diagnostic. For example

    foo did not have configs CONFIG_FOO

Further investigation is required by developers to determine whether the
module was out-of-tree, its dependencies were unmet, or it failed due to
a type constraint. Address this by:
    1.  Tracking symbol types in a %types hash during Kconfig parsing.

    2.  Enhancing the final integrity check when running localmodconfig
        (!$localyesconfig) to explicitly annotate boolean symbols.

For example:

    module cec did not have configs CONFIG_CEC_CORE (tristate) CONFIG_RAS_CEC (boolean, not supported with =m)

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 scripts/kconfig/streamline_config.pl | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 8677d1ca06a7..6a52a98eb40e 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -145,6 +145,7 @@ my %prompts;
 my %objects;
 my %config2kfile;
 my %defaults;
+my %types;
 my $var;
 my $iflevel = 0;
 my @ifdeps;
@@ -224,6 +225,7 @@ sub read_kconfig {
 	} elsif ($state ne "NONE" && /^\s*def(_(bool|tristate)|ault)\s+(\S.*)$/) {
 	    my $dep = $3;
             $defaults{$config} = 1;
+	    $types{$config} = $2 if (defined($2));
 	    if ($dep !~ /^\s*(y|m|n)\s*$/) {
 		$dep =~ s/.*\sif\s+//;
 		$depends{$config} .= " " . $dep;
@@ -240,7 +242,13 @@ sub read_kconfig {
 	    }
 
 	# configs without prompts must be selected
-	} elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) {
+	} elsif ($state ne "NONE" && /^\s*(bool|boolean)(\s+\S.*)?$/) {
+	    $types{$config} = "bool";
+	    $prompts{$config} = 1 if (defined($2));
+	} elsif ($state ne "NONE" && /^\s*tristate(\s+\S.*)?$/) {
+	    $types{$config} = "tristate";
+	    $prompts{$config} = 1 if (defined($1));
+	} elsif ($state ne "NONE" && /^\s*prompt\b/) {
 	    # note if the config has a prompt
 	    $prompts{$config} = 1;
 
@@ -707,7 +715,15 @@ foreach my $module (keys(%modules)) {
 	}
 	print STDERR "module $module did not have configs";
 	foreach my $conf (@arr) {
-	    print STDERR " " , $conf;
+	    my $c = $conf;
+	    $c =~ s/^CONFIG_//;
+	    if (!$localyesconfig && defined($types{$c}) && $types{$c} eq "bool") {
+		print STDERR " $conf (boolean, not supported with =m)";
+	    } elsif (defined($types{$c})) {
+		print STDERR " $conf ($types{$c})";
+	    } else {
+		print STDERR " " , $conf;
+	    }
 	}
 	print STDERR "\n";
     }
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] localmodconfig: Explicitly report boolean configs during integrity check
  2026-09-25 18:12 [PATCH] localmodconfig: Explicitly report boolean configs during integrity check Aaron Tomlin
@ 2026-10-05 15:30 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2026-10-05 15:30 UTC (permalink / raw)
  To: Aaron Tomlin, Steven Rostedt; +Cc: nsc, julianbraha, linux-kbuild, linux-kernel

Hi Aaron,

+ Steven

On Fri, Sep 25, 2026 at 02:12:30PM -0400, Aaron Tomlin wrote:
> When running make localmodconfig, streamline_config.pl reads loaded
> modules and maps each module object to its corresponding Kconfig
> symbol(s) using repository Makefiles.
> 
> In several instances, a loaded module corresponds to an object
> controlled by a boolean symbol (e.g. config FOO declared as bool), or is
> a composite module that depends on a boolean configuration. Because
> boolean options only accept "=y" or disabled, they cannot be configured
> as loadable modules ("=m").
> 
> Previously, if such a symbol was not already built-in ("=y") in the
> baseline configuration, the final integrity check emitted an ambiguous
> diagnostic. For example
> 
>     foo did not have configs CONFIG_FOO
> 
> Further investigation is required by developers to determine whether the
> module was out-of-tree, its dependencies were unmet, or it failed due to
> a type constraint. Address this by:
>     1.  Tracking symbol types in a %types hash during Kconfig parsing.
> 
>     2.  Enhancing the final integrity check when running localmodconfig
>         (!$localyesconfig) to explicitly annotate boolean symbols.
> 
> For example:
> 
>     module cec did not have configs CONFIG_CEC_CORE (tristate) CONFIG_RAS_CEC (boolean, not supported with =m)
> 
> Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>

My Perl is quite weak, so I would love Steven's ack or review before
taking this since he is the original author/maintainer. I've left the
full patch for context.

> ---
>  scripts/kconfig/streamline_config.pl | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index 8677d1ca06a7..6a52a98eb40e 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -145,6 +145,7 @@ my %prompts;
>  my %objects;
>  my %config2kfile;
>  my %defaults;
> +my %types;
>  my $var;
>  my $iflevel = 0;
>  my @ifdeps;
> @@ -224,6 +225,7 @@ sub read_kconfig {
>  	} elsif ($state ne "NONE" && /^\s*def(_(bool|tristate)|ault)\s+(\S.*)$/) {
>  	    my $dep = $3;
>              $defaults{$config} = 1;
> +	    $types{$config} = $2 if (defined($2));
>  	    if ($dep !~ /^\s*(y|m|n)\s*$/) {
>  		$dep =~ s/.*\sif\s+//;
>  		$depends{$config} .= " " . $dep;
> @@ -240,7 +242,13 @@ sub read_kconfig {
>  	    }
>  
>  	# configs without prompts must be selected
> -	} elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) {
> +	} elsif ($state ne "NONE" && /^\s*(bool|boolean)(\s+\S.*)?$/) {
> +	    $types{$config} = "bool";
> +	    $prompts{$config} = 1 if (defined($2));
> +	} elsif ($state ne "NONE" && /^\s*tristate(\s+\S.*)?$/) {
> +	    $types{$config} = "tristate";
> +	    $prompts{$config} = 1 if (defined($1));
> +	} elsif ($state ne "NONE" && /^\s*prompt\b/) {
>  	    # note if the config has a prompt
>  	    $prompts{$config} = 1;
>  
> @@ -707,7 +715,15 @@ foreach my $module (keys(%modules)) {
>  	}
>  	print STDERR "module $module did not have configs";
>  	foreach my $conf (@arr) {
> -	    print STDERR " " , $conf;
> +	    my $c = $conf;
> +	    $c =~ s/^CONFIG_//;
> +	    if (!$localyesconfig && defined($types{$c}) && $types{$c} eq "bool") {
> +		print STDERR " $conf (boolean, not supported with =m)";
> +	    } elsif (defined($types{$c})) {
> +		print STDERR " $conf ($types{$c})";
> +	    } else {
> +		print STDERR " " , $conf;
> +	    }
>  	}
>  	print STDERR "\n";
>      }
> -- 
> 2.55.0
> 
> 

-- 
Cheers,
Nathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-05 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 18:12 [PATCH] localmodconfig: Explicitly report boolean configs during integrity check Aaron Tomlin
2026-10-05 15:30 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®