linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* make localmodconfig doesn't work for thunderbolt
@ 2023-05-10 11:00 Jiri Slaby
  2023-05-11  8:51 ` Mika Westerberg
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jiri Slaby @ 2023-05-10 11:00 UTC (permalink / raw)
  To: Masahiro Yamada, Linux Kbuild mailing list
  Cc: andreas.noever, michael.jamet, Mika Westerberg, YehezkelShB,
	USB list, Linux kernel mailing list

Hi,

if I use localmodconfig for example like this:
mkdir /tmp/tb/
echo thunderbolt >/tmp/tb/lsmod
make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig

I get:
using config: '.config'
thunderbolt config not found!!

$ grep 'USB4\>' /tmp/tb/.config
# CONFIG_USB4 is not set

I believe it's due to:
   obj-${CONFIG_USB4} := thunderbolt.o
in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().

But even if I change the parser:

--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
         $_ = convert_vars($_, %make_vars);

         # collect objects after obj-$(CONFIG_FOO_BAR)
-       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
+       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
             $var = $1;
             $objs = $2;


I see:
module thunderbolt did not have configs CONFIG_USB4

and:
$ grep 'USB4\>' /tmp/tb/.config
# CONFIG_USB4 is not set

So two questions:
1) is ${} supported and should be the above change sent as a patch? Or 
should be drivers/thunderbolt/Makefile fixed to use $(). (And maybe 
other Makefiles too.)

2) how to fix that 'thunderbolt did not have configs'?

thanks,
-- 
js
suse labs

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-05-10 11:00 make localmodconfig doesn't work for thunderbolt Jiri Slaby
@ 2023-05-11  8:51 ` Mika Westerberg
  2023-05-11 16:15 ` Masahiro Yamada
  2023-06-06  4:16 ` Masahiro Yamada
  2 siblings, 0 replies; 7+ messages in thread
From: Mika Westerberg @ 2023-05-11  8:51 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Masahiro Yamada, Linux Kbuild mailing list, andreas.noever,
	michael.jamet, YehezkelShB, USB list, Linux kernel mailing list

Hi,

On Wed, May 10, 2023 at 01:00:54PM +0200, Jiri Slaby wrote:
> Hi,
> 
> if I use localmodconfig for example like this:
> mkdir /tmp/tb/
> echo thunderbolt >/tmp/tb/lsmod
> make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig
> 
> I get:
> using config: '.config'
> thunderbolt config not found!!
> 
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
> 
> I believe it's due to:
>   obj-${CONFIG_USB4} := thunderbolt.o
> in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().
> 
> But even if I change the parser:
> 
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
>         $_ = convert_vars($_, %make_vars);
> 
>         # collect objects after obj-$(CONFIG_FOO_BAR)
> -       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
> +       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
>             $var = $1;
>             $objs = $2;
> 
> 
> I see:
> module thunderbolt did not have configs CONFIG_USB4
> 
> and:
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
> 
> So two questions:
> 1) is ${} supported and should be the above change sent as a patch? Or
> should be drivers/thunderbolt/Makefile fixed to use $(). (And maybe other
> Makefiles too.)

The streamline_config.pl mentions use of ${} in comments itself:

# add to the configs hash all configs that are needed to enable
# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
# where we know we need bar.o so we add FOO to the list.

So I think it should be made to support this.

> 2) how to fix that 'thunderbolt did not have configs'?

There are bunch of other symbols that generate the same (after the above
fix from you), not just Thunderbolt so figuring that out and fix would
be the way forward I think. However, my perl skills are are not up to
this task at the moment. I can take a look but cannot promise that I
figure a solution.

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-05-10 11:00 make localmodconfig doesn't work for thunderbolt Jiri Slaby
  2023-05-11  8:51 ` Mika Westerberg
@ 2023-05-11 16:15 ` Masahiro Yamada
  2023-05-13 23:28   ` Steven Rostedt
  2023-06-06  4:16 ` Masahiro Yamada
  2 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2023-05-11 16:15 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Linux Kbuild mailing list, andreas.noever, michael.jamet,
	Mika Westerberg, YehezkelShB, USB list,
	Linux kernel mailing list, Steven Rostedt

+CC Steven Rostedt, author of streamline_config.pl



On Wed, May 10, 2023 at 8:01 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> Hi,
>
> if I use localmodconfig for example like this:
> mkdir /tmp/tb/
> echo thunderbolt >/tmp/tb/lsmod
> make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig
>
> I get:
> using config: '.config'
> thunderbolt config not found!!
>
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
>
> I believe it's due to:
>    obj-${CONFIG_USB4} := thunderbolt.o
> in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().
>
> But even if I change the parser:
>
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
>          $_ = convert_vars($_, %make_vars);
>
>          # collect objects after obj-$(CONFIG_FOO_BAR)
> -       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
> +       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
>              $var = $1;
>              $objs = $2;
>
>
> I see:
> module thunderbolt did not have configs CONFIG_USB4
>
> and:
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
>
> So two questions:
> 1) is ${} supported and should be the above change sent as a patch? Or
> should be drivers/thunderbolt/Makefile fixed to use $(). (And maybe
> other Makefiles too.)


I believe streamline_config.pl should be fixed.

There is no good reason to support only $(), but not ${}.


In fact, the comment line around line 395 of this script
uses the curly brace style.

  # a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o






> 2) how to fix that 'thunderbolt did not have configs'?

That warning is CONFIG_USB4 was unset in the resulting .config.

Was CONFIG_USB4 enabled before running localmodconfig?

In my understanding, the purpose of localmodconfig
is to slim down the .config file.

It disables unneeded CONFIG options, but
it does not enable needed CONFIG options.




If I start from allnoconfig (i.e. CONFIG_USB4 is unset), I see the warning.

$ echo thunderbolt >/tmp/tb/lsmod
$ make -s O=/tmp/tb allnoconfig
$ make O=/tmp/tb LSMOD=/tmp/tb/lsmod  localmodconfig
  GEN     Makefile
using config: '.config'
module thunderbolt did not have configs CONFIG_USB4



If I start from allmodconfig (i.e. CONFIG_USB4 is m), I do not see the warning.

$ echo thunderbolt >/tmp/tb/lsmod
$ make -s O=/tmp/tb allmodconfig
$ make O=/tmp/tb LSMOD=/tmp/tb/lsmod  localmodconfig
  GEN     Makefile
using config: '.config'





-- 
Best Regards
Masahiro Yamada

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-05-11 16:15 ` Masahiro Yamada
@ 2023-05-13 23:28   ` Steven Rostedt
  2023-05-13 23:30     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2023-05-13 23:28 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Jiri Slaby, Linux Kbuild mailing list, andreas.noever,
	michael.jamet, Mika Westerberg, YehezkelShB, USB list,
	Linux kernel mailing list

On Fri, 12 May 2023 01:15:49 +0900
Masahiro Yamada <masahiroy@kernel.org> wrote:

> +CC Steven Rostedt, author of streamline_config.pl

Thanks!

> 
> 
> 
> On Wed, May 10, 2023 at 8:01 PM Jiri Slaby <jirislaby@kernel.org> wrote:
> >
> > Hi,
> >
> > if I use localmodconfig for example like this:
> > mkdir /tmp/tb/
> > echo thunderbolt >/tmp/tb/lsmod
> > make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig
> >
> > I get:
> > using config: '.config'
> > thunderbolt config not found!!
> >
> > $ grep 'USB4\>' /tmp/tb/.config
> > # CONFIG_USB4 is not set
> >
> > I believe it's due to:
> >    obj-${CONFIG_USB4} := thunderbolt.o
> > in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().
> >
> > But even if I change the parser:
> >
> > --- a/scripts/kconfig/streamline_config.pl
> > +++ b/scripts/kconfig/streamline_config.pl
> > @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
> >          $_ = convert_vars($_, %make_vars);
> >
> >          # collect objects after obj-$(CONFIG_FOO_BAR)
> > -       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
> > +       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
> >              $var = $1;
> >              $objs = $2;
> >
> >
> > I see:
> > module thunderbolt did not have configs CONFIG_USB4
> >
> > and:
> > $ grep 'USB4\>' /tmp/tb/.config
> > # CONFIG_USB4 is not set
> >
> > So two questions:
> > 1) is ${} supported and should be the above change sent as a patch? Or
> > should be drivers/thunderbolt/Makefile fixed to use $(). (And maybe
> > other Makefiles too.)  
> 
> 
> I believe streamline_config.pl should be fixed.

So do I.

> 
> There is no good reason to support only $(), but not ${}.

Agreed.

> 
> 
> In fact, the comment line around line 395 of this script
> uses the curly brace style.
> 
>   # a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
> 
> 
> 
> 
> 
> 
> > 2) how to fix that 'thunderbolt did not have configs'?  
> 
> That warning is CONFIG_USB4 was unset in the resulting .config.
> 
> Was CONFIG_USB4 enabled before running localmodconfig?
> 
> In my understanding, the purpose of localmodconfig
> is to slim down the .config file.

Correct.

> 
> It disables unneeded CONFIG options, but
> it does not enable needed CONFIG options.

Also correct.

> 
> 
> 
> 
> If I start from allnoconfig (i.e. CONFIG_USB4 is unset), I see the warning.
> 
> $ echo thunderbolt >/tmp/tb/lsmod
> $ make -s O=/tmp/tb allnoconfig
> $ make O=/tmp/tb LSMOD=/tmp/tb/lsmod  localmodconfig
>   GEN     Makefile
> using config: '.config'
> module thunderbolt did not have configs CONFIG_USB4
> 
> 
> 
> If I start from allmodconfig (i.e. CONFIG_USB4 is m), I do not see the warning.
> 
> $ echo thunderbolt >/tmp/tb/lsmod
> $ make -s O=/tmp/tb allmodconfig
> $ make O=/tmp/tb LSMOD=/tmp/tb/lsmod  localmodconfig
>   GEN     Makefile
> using config: '.config'
> 

I hate the inconsistency in the Makefile, but localmodconfig should be
able to adapt to it.

Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Thanks Jiri and Masamhiro!

-- Steve

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-05-13 23:28   ` Steven Rostedt
@ 2023-05-13 23:30     ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2023-05-13 23:30 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Jiri Slaby, Linux Kbuild mailing list, andreas.noever,
	michael.jamet, Mika Westerberg, YehezkelShB, USB list,
	Linux kernel mailing list

On Sat, 13 May 2023 19:28:21 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Thanks Jiri and Masamhiro!

That should have been "Masahiro". Sorry for the misspelling. I type
"Masami" so many times, that the "m" after "Masa" is pretty much
automatic :-/

-- Steve

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-05-10 11:00 make localmodconfig doesn't work for thunderbolt Jiri Slaby
  2023-05-11  8:51 ` Mika Westerberg
  2023-05-11 16:15 ` Masahiro Yamada
@ 2023-06-06  4:16 ` Masahiro Yamada
  2023-06-06  6:52   ` Jiri Slaby
  2 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2023-06-06  4:16 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Linux Kbuild mailing list, andreas.noever, michael.jamet,
	Mika Westerberg, YehezkelShB, USB list,
	Linux kernel mailing list

Hi Jiri,


On Wed, May 10, 2023 at 8:01 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> Hi,
>
> if I use localmodconfig for example like this:
> mkdir /tmp/tb/
> echo thunderbolt >/tmp/tb/lsmod
> make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig
>
> I get:
> using config: '.config'
> thunderbolt config not found!!
>
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
>
> I believe it's due to:
>    obj-${CONFIG_USB4} := thunderbolt.o
> in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().
>
> But even if I change the parser:
>
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
>          $_ = convert_vars($_, %make_vars);
>
>          # collect objects after obj-$(CONFIG_FOO_BAR)
> -       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
> +       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
>              $var = $1;
>              $objs = $2;
>


Will you send this fix as a patch?






> I see:
> module thunderbolt did not have configs CONFIG_USB4
>
> and:
> $ grep 'USB4\>' /tmp/tb/.config
> # CONFIG_USB4 is not set
>
> So two questions:
> 1) is ${} supported and should be the above change sent as a patch? Or
> should be drivers/thunderbolt/Makefile fixed to use $(). (And maybe
> other Makefiles too.)
>
> 2) how to fix that 'thunderbolt did not have configs'?
>
> thanks,
> --
> js
> suse labs



-- 
Best Regards
Masahiro Yamada

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

* Re: make localmodconfig doesn't work for thunderbolt
  2023-06-06  4:16 ` Masahiro Yamada
@ 2023-06-06  6:52   ` Jiri Slaby
  0 siblings, 0 replies; 7+ messages in thread
From: Jiri Slaby @ 2023-06-06  6:52 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kbuild mailing list, andreas.noever, michael.jamet,
	Mika Westerberg, YehezkelShB, USB list,
	Linux kernel mailing list

On 06. 06. 23, 6:16, Masahiro Yamada wrote:
> On Wed, May 10, 2023 at 8:01 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>>
>> Hi,
>>
>> if I use localmodconfig for example like this:
>> mkdir /tmp/tb/
>> echo thunderbolt >/tmp/tb/lsmod
>> make O=/tmp/tb LSMOD=/tmp/tb/lsmod localmodconfig
>>
>> I get:
>> using config: '.config'
>> thunderbolt config not found!!
>>
>> $ grep 'USB4\>' /tmp/tb/.config
>> # CONFIG_USB4 is not set
>>
>> I believe it's due to:
>>     obj-${CONFIG_USB4} := thunderbolt.o
>> in drivers/thunderbolt/Makefile. I.e. ${} used instead of more common $().
>>
>> But even if I change the parser:
>>
>> --- a/scripts/kconfig/streamline_config.pl
>> +++ b/scripts/kconfig/streamline_config.pl
>> @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) {
>>           $_ = convert_vars($_, %make_vars);
>>
>>           # collect objects after obj-$(CONFIG_FOO_BAR)
>> -       if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
>> +       if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) {
>>               $var = $1;
>>               $objs = $2;
>>
> 
> 
> Will you send this fix as a patch?

Hi,

ah, yes, sorry, I forgot. Today or tomorrow.

thanks for pinging me,
-- 
js
suse labs


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

end of thread, other threads:[~2023-06-06  6:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 11:00 make localmodconfig doesn't work for thunderbolt Jiri Slaby
2023-05-11  8:51 ` Mika Westerberg
2023-05-11 16:15 ` Masahiro Yamada
2023-05-13 23:28   ` Steven Rostedt
2023-05-13 23:30     ` Steven Rostedt
2023-06-06  4:16 ` Masahiro Yamada
2023-06-06  6:52   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).