diff mbox series

[11/13] kconfig: do not use allnoconfig_y option

Message ID 20210313194836.372585-11-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series [01/13] kconfig: split randconfig setup code into set_randconfig_seed() | expand

Commit Message

Masahiro Yamada March 13, 2021, 7:48 p.m. UTC
allnoconfig_y is a bad hack that sets a symbol to 'y' by allnoconfig.

allnoconfig does not mean a minimum set of CONFIG options because a
bunch of prompts are hidden by 'if EMBEDDED' or 'if EXPERT', but I do
not like to do a workaround this way.

Use the pre-existing feature, KCONFIG_ALLCONFIG, to provide a one
liner config fragment. CONFIG_EMBEDDED=y is still forced under
allnoconfig.

No change in the .config file produced by 'make tinyconfig'.

The output of 'make allnoconfig' will be changed; we will get
CONFIG_EMBEDDED=n because allnoconfig literally sets all symbols to n.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 init/Kconfig                    | 1 -
 kernel/configs/tiny-base.config | 1 +
 scripts/kconfig/Makefile        | 3 ++-
 3 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 kernel/configs/tiny-base.config

Comments

Guenter Roeck March 31, 2021, 5:12 p.m. UTC | #1
On Sun, Mar 14, 2021 at 04:48:34AM +0900, Masahiro Yamada wrote:
> allnoconfig_y is a bad hack that sets a symbol to 'y' by allnoconfig.
> 
> allnoconfig does not mean a minimum set of CONFIG options because a
> bunch of prompts are hidden by 'if EMBEDDED' or 'if EXPERT', but I do
> not like to do a workaround this way.
> 
> Use the pre-existing feature, KCONFIG_ALLCONFIG, to provide a one
> liner config fragment. CONFIG_EMBEDDED=y is still forced under
> allnoconfig.
> 
> No change in the .config file produced by 'make tinyconfig'.
> 
> The output of 'make allnoconfig' will be changed; we will get
> CONFIG_EMBEDDED=n because allnoconfig literally sets all symbols to n.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

With this patch in place, mips:allnoconfig fails to build with
the following error.

Error log:
WARNING: modpost: vmlinux.o(.text+0x9c70): Section mismatch in reference from the function reserve_exception_space() to the function .meminit.text:memblock_reserve()
The function reserve_exception_space() references
the function __meminit memblock_reserve().
This is often because reserve_exception_space lacks a __meminit
annotation or the annotation of memblock_reserve is wrong.
ERROR: modpost: Section mismatches detected.
Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
make[2]: *** [scripts/Makefile.modpost:62: vmlinux.symvers] Error 1
make[2]: *** Deleting file 'vmlinux.symvers'
make[1]: *** [Makefile:1292: vmlinux] Error 2
make: *** [Makefile:222: __sub-make] Error 2

Guenter

> ---
> 
>  init/Kconfig                    | 1 -
>  kernel/configs/tiny-base.config | 1 +
>  scripts/kconfig/Makefile        | 3 ++-
>  3 files changed, 3 insertions(+), 2 deletions(-)
>  create mode 100644 kernel/configs/tiny-base.config
> 
> diff --git a/init/Kconfig b/init/Kconfig
> index 46b87ad73f6a..beb8314fdf96 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1769,7 +1769,6 @@ config DEBUG_RSEQ
>  
>  config EMBEDDED
>  	bool "Embedded system"
> -	option allnoconfig_y
>  	select EXPERT
>  	help
>  	  This option should be enabled if compiling the kernel for
> diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
> new file mode 100644
> index 000000000000..2f0e6bf6db2c
> --- /dev/null
> +++ b/kernel/configs/tiny-base.config
> @@ -0,0 +1 @@
> +CONFIG_EMBEDDED=y
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 7df3c0e4c52e..46f2465177f0 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -102,7 +102,8 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
>  
>  PHONY += tinyconfig
>  tinyconfig:
> -	$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
> +	$(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
> +	$(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
>  
>  # CHECK: -o cache_dir=<path> working?
>  PHONY += testconfig
> -- 
> 2.27.0
>
Nick Desaulniers March 31, 2021, 6:25 p.m. UTC | #2
On Wed, Mar 31, 2021 at 10:12 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Sun, Mar 14, 2021 at 04:48:34AM +0900, Masahiro Yamada wrote:
> > allnoconfig_y is a bad hack that sets a symbol to 'y' by allnoconfig.
> >
> > allnoconfig does not mean a minimum set of CONFIG options because a
> > bunch of prompts are hidden by 'if EMBEDDED' or 'if EXPERT', but I do
> > not like to do a workaround this way.
> >
> > Use the pre-existing feature, KCONFIG_ALLCONFIG, to provide a one
> > liner config fragment. CONFIG_EMBEDDED=y is still forced under
> > allnoconfig.
> >
> > No change in the .config file produced by 'make tinyconfig'.
> >
> > The output of 'make allnoconfig' will be changed; we will get
> > CONFIG_EMBEDDED=n because allnoconfig literally sets all symbols to n.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> With this patch in place, mips:allnoconfig fails to build with
> the following error.
>
> Error log:
> WARNING: modpost: vmlinux.o(.text+0x9c70): Section mismatch in reference from the function reserve_exception_space() to the function .meminit.text:memblock_reserve()
> The function reserve_exception_space() references
> the function __meminit memblock_reserve().
> This is often because reserve_exception_space lacks a __meminit
> annotation or the annotation of memblock_reserve is wrong.
> ERROR: modpost: Section mismatches detected.
> Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
> make[2]: *** [scripts/Makefile.modpost:62: vmlinux.symvers] Error 1
> make[2]: *** Deleting file 'vmlinux.symvers'
> make[1]: *** [Makefile:1292: vmlinux] Error 2
> make: *** [Makefile:222: __sub-make] Error 2

Thanks for the report. I suspect this is related to allnoconfig
disabling CONFIG_ARCH_KEEP_MEMBLOCK, which changes the definition of
__init_memblock in include/linux/memblock.h.

So allnoconfig would unselect CONFIG_ARCH_KEEP_MEMBLOCK, making
__init_memblock equivalent to __meminit triggering the above warning.

arch/mips/Kconfig
14:     select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL

so DEBUG_KERNEL is probably also disabled by allnoconfig.

commit a8c0f1c634507 ("MIPS: Select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL
to enable sysfs memblock debug")

probably should drop the `if DEBUG_KERNEL` part.

>
> Guenter
>
> > ---
> >
> >  init/Kconfig                    | 1 -
> >  kernel/configs/tiny-base.config | 1 +
> >  scripts/kconfig/Makefile        | 3 ++-
> >  3 files changed, 3 insertions(+), 2 deletions(-)
> >  create mode 100644 kernel/configs/tiny-base.config
> >
> > diff --git a/init/Kconfig b/init/Kconfig
> > index 46b87ad73f6a..beb8314fdf96 100644
> > --- a/init/Kconfig
> > +++ b/init/Kconfig
> > @@ -1769,7 +1769,6 @@ config DEBUG_RSEQ
> >
> >  config EMBEDDED
> >       bool "Embedded system"
> > -     option allnoconfig_y
> >       select EXPERT
> >       help
> >         This option should be enabled if compiling the kernel for
> > diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
> > new file mode 100644
> > index 000000000000..2f0e6bf6db2c
> > --- /dev/null
> > +++ b/kernel/configs/tiny-base.config
> > @@ -0,0 +1 @@
> > +CONFIG_EMBEDDED=y
> > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> > index 7df3c0e4c52e..46f2465177f0 100644
> > --- a/scripts/kconfig/Makefile
> > +++ b/scripts/kconfig/Makefile
> > @@ -102,7 +102,8 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
> >
> >  PHONY += tinyconfig
> >  tinyconfig:
> > -     $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
> > +     $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
> > +     $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
> >
> >  # CHECK: -o cache_dir=<path> working?
> >  PHONY += testconfig
> > --
> > 2.27.0
> >
Guenter Roeck April 5, 2021, 2:56 p.m. UTC | #3
On 3/31/21 11:25 AM, Nick Desaulniers wrote:
> On Wed, Mar 31, 2021 at 10:12 AM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> On Sun, Mar 14, 2021 at 04:48:34AM +0900, Masahiro Yamada wrote:
>>> allnoconfig_y is a bad hack that sets a symbol to 'y' by allnoconfig.
>>>
>>> allnoconfig does not mean a minimum set of CONFIG options because a
>>> bunch of prompts are hidden by 'if EMBEDDED' or 'if EXPERT', but I do
>>> not like to do a workaround this way.
>>>
>>> Use the pre-existing feature, KCONFIG_ALLCONFIG, to provide a one
>>> liner config fragment. CONFIG_EMBEDDED=y is still forced under
>>> allnoconfig.
>>>
>>> No change in the .config file produced by 'make tinyconfig'.
>>>
>>> The output of 'make allnoconfig' will be changed; we will get
>>> CONFIG_EMBEDDED=n because allnoconfig literally sets all symbols to n.
>>>
>>> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>>
>> With this patch in place, mips:allnoconfig fails to build with
>> the following error.
>>
>> Error log:
>> WARNING: modpost: vmlinux.o(.text+0x9c70): Section mismatch in reference from the function reserve_exception_space() to the function .meminit.text:memblock_reserve()
>> The function reserve_exception_space() references
>> the function __meminit memblock_reserve().
>> This is often because reserve_exception_space lacks a __meminit
>> annotation or the annotation of memblock_reserve is wrong.
>> ERROR: modpost: Section mismatches detected.
>> Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
>> make[2]: *** [scripts/Makefile.modpost:62: vmlinux.symvers] Error 1
>> make[2]: *** Deleting file 'vmlinux.symvers'
>> make[1]: *** [Makefile:1292: vmlinux] Error 2
>> make: *** [Makefile:222: __sub-make] Error 2
> 
> Thanks for the report. I suspect this is related to allnoconfig
> disabling CONFIG_ARCH_KEEP_MEMBLOCK, which changes the definition of
> __init_memblock in include/linux/memblock.h.
> 
> So allnoconfig would unselect CONFIG_ARCH_KEEP_MEMBLOCK, making
> __init_memblock equivalent to __meminit triggering the above warning.
> 
> arch/mips/Kconfig
> 14:     select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL
> 
> so DEBUG_KERNEL is probably also disabled by allnoconfig.
> 
> commit a8c0f1c634507 ("MIPS: Select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL
> to enable sysfs memblock debug")
> 
> probably should drop the `if DEBUG_KERNEL` part.
> 

Agreed.

Guenter

>>
>> Guenter
>>
>>> ---
>>>
>>>  init/Kconfig                    | 1 -
>>>  kernel/configs/tiny-base.config | 1 +
>>>  scripts/kconfig/Makefile        | 3 ++-
>>>  3 files changed, 3 insertions(+), 2 deletions(-)
>>>  create mode 100644 kernel/configs/tiny-base.config
>>>
>>> diff --git a/init/Kconfig b/init/Kconfig
>>> index 46b87ad73f6a..beb8314fdf96 100644
>>> --- a/init/Kconfig
>>> +++ b/init/Kconfig
>>> @@ -1769,7 +1769,6 @@ config DEBUG_RSEQ
>>>
>>>  config EMBEDDED
>>>       bool "Embedded system"
>>> -     option allnoconfig_y
>>>       select EXPERT
>>>       help
>>>         This option should be enabled if compiling the kernel for
>>> diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
>>> new file mode 100644
>>> index 000000000000..2f0e6bf6db2c
>>> --- /dev/null
>>> +++ b/kernel/configs/tiny-base.config
>>> @@ -0,0 +1 @@
>>> +CONFIG_EMBEDDED=y
>>> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
>>> index 7df3c0e4c52e..46f2465177f0 100644
>>> --- a/scripts/kconfig/Makefile
>>> +++ b/scripts/kconfig/Makefile
>>> @@ -102,7 +102,8 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
>>>
>>>  PHONY += tinyconfig
>>>  tinyconfig:
>>> -     $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
>>> +     $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
>>> +     $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
>>>
>>>  # CHECK: -o cache_dir=<path> working?
>>>  PHONY += testconfig
>>> --
>>> 2.27.0
>>>
> 
> 
>
Masahiro Yamada April 7, 2021, 12:02 p.m. UTC | #4
On Thu, Apr 1, 2021 at 3:25 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> On Wed, Mar 31, 2021 at 10:12 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On Sun, Mar 14, 2021 at 04:48:34AM +0900, Masahiro Yamada wrote:
> > > allnoconfig_y is a bad hack that sets a symbol to 'y' by allnoconfig.
> > >
> > > allnoconfig does not mean a minimum set of CONFIG options because a
> > > bunch of prompts are hidden by 'if EMBEDDED' or 'if EXPERT', but I do
> > > not like to do a workaround this way.
> > >
> > > Use the pre-existing feature, KCONFIG_ALLCONFIG, to provide a one
> > > liner config fragment. CONFIG_EMBEDDED=y is still forced under
> > > allnoconfig.
> > >
> > > No change in the .config file produced by 'make tinyconfig'.
> > >
> > > The output of 'make allnoconfig' will be changed; we will get
> > > CONFIG_EMBEDDED=n because allnoconfig literally sets all symbols to n.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> >
> > With this patch in place, mips:allnoconfig fails to build with
> > the following error.
> >
> > Error log:
> > WARNING: modpost: vmlinux.o(.text+0x9c70): Section mismatch in reference from the function reserve_exception_space() to the function .meminit.text:memblock_reserve()
> > The function reserve_exception_space() references
> > the function __meminit memblock_reserve().
> > This is often because reserve_exception_space lacks a __meminit
> > annotation or the annotation of memblock_reserve is wrong.
> > ERROR: modpost: Section mismatches detected.
> > Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.
> > make[2]: *** [scripts/Makefile.modpost:62: vmlinux.symvers] Error 1
> > make[2]: *** Deleting file 'vmlinux.symvers'
> > make[1]: *** [Makefile:1292: vmlinux] Error 2
> > make: *** [Makefile:222: __sub-make] Error 2
>
> Thanks for the report. I suspect this is related to allnoconfig
> disabling CONFIG_ARCH_KEEP_MEMBLOCK, which changes the definition of
> __init_memblock in include/linux/memblock.h.
>
> So allnoconfig would unselect CONFIG_ARCH_KEEP_MEMBLOCK, making
> __init_memblock equivalent to __meminit triggering the above warning.
>
> arch/mips/Kconfig
> 14:     select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL
>
> so DEBUG_KERNEL is probably also disabled by allnoconfig.
>
> commit a8c0f1c634507 ("MIPS: Select ARCH_KEEP_MEMBLOCK if DEBUG_KERNEL
> to enable sysfs memblock debug")
>
> probably should drop the `if DEBUG_KERNEL` part.


Thanks.
Could you please send a patch to mips ML?




> >
> > Guenter
> >
> > > ---
> > >
> > >  init/Kconfig                    | 1 -
> > >  kernel/configs/tiny-base.config | 1 +
> > >  scripts/kconfig/Makefile        | 3 ++-
> > >  3 files changed, 3 insertions(+), 2 deletions(-)
> > >  create mode 100644 kernel/configs/tiny-base.config
> > >
> > > diff --git a/init/Kconfig b/init/Kconfig
> > > index 46b87ad73f6a..beb8314fdf96 100644
> > > --- a/init/Kconfig
> > > +++ b/init/Kconfig
> > > @@ -1769,7 +1769,6 @@ config DEBUG_RSEQ
> > >
> > >  config EMBEDDED
> > >       bool "Embedded system"
> > > -     option allnoconfig_y
> > >       select EXPERT
> > >       help
> > >         This option should be enabled if compiling the kernel for
> > > diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
> > > new file mode 100644
> > > index 000000000000..2f0e6bf6db2c
> > > --- /dev/null
> > > +++ b/kernel/configs/tiny-base.config
> > > @@ -0,0 +1 @@
> > > +CONFIG_EMBEDDED=y
> > > diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> > > index 7df3c0e4c52e..46f2465177f0 100644
> > > --- a/scripts/kconfig/Makefile
> > > +++ b/scripts/kconfig/Makefile
> > > @@ -102,7 +102,8 @@ configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
> > >
> > >  PHONY += tinyconfig
> > >  tinyconfig:
> > > -     $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
> > > +     $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
> > > +     $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
> > >
> > >  # CHECK: -o cache_dir=<path> working?
> > >  PHONY += testconfig
> > > --
> > > 2.27.0
> > >
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
diff mbox series

Patch

diff --git a/init/Kconfig b/init/Kconfig
index 46b87ad73f6a..beb8314fdf96 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1769,7 +1769,6 @@  config DEBUG_RSEQ
 
 config EMBEDDED
 	bool "Embedded system"
-	option allnoconfig_y
 	select EXPERT
 	help
 	  This option should be enabled if compiling the kernel for
diff --git a/kernel/configs/tiny-base.config b/kernel/configs/tiny-base.config
new file mode 100644
index 000000000000..2f0e6bf6db2c
--- /dev/null
+++ b/kernel/configs/tiny-base.config
@@ -0,0 +1 @@ 
+CONFIG_EMBEDDED=y
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7df3c0e4c52e..46f2465177f0 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -102,7 +102,8 @@  configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/c
 
 PHONY += tinyconfig
 tinyconfig:
-	$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
+	$(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig
+	$(Q)$(MAKE) -f $(srctree)/Makefile tiny.config
 
 # CHECK: -o cache_dir=<path> working?
 PHONY += testconfig