Re: [PATCH 6/6] init/Kconfig: remove confusing config EMBEDDED

From: Christophe Leroy
Date: Fri Sep 09 2022 - 05:25:59 EST


+ linuxppc-dev

Le 08/09/2022 à 12:43, Lukas Bulwahn a écrit :
> Commit 6a108a14fa35 ("kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT")
> introduces CONFIG_EXPERT to carry the previous intent of CONFIG_EMBEDDED
> and just gives that intent a much better name. That has been clearly a good
> and long overdue renaming, and it is clearly an improvement to the kernel
> build configuration that has shown to help managing the kernel build
> configuration in the last decade.
>
> However, rather than bravely and radically just deleting CONFIG_EMBEDDED,
> this commit gives CONFIG_EMBEDDED a new intended semantics, but keeps it
> open for future contributors to implement that intended semantics:
>
> A new CONFIG_EMBEDDED option is added that automatically selects
> CONFIG_EXPERT when enabled and can be used in the future to isolate
> options that should only be considered for embedded systems (RISC
> architectures, SLOB, etc).
>
> Since then, this CONFIG_EMBEDDED implicitly had two purposes:
>
> - It can make even more options visible beyond what CONFIG_EXPERT makes
> visible. In other words, it may introduce another level of enabling the
> visibility of configuration options: always visible, visible with
> CONFIG_EXPERT and visible with CONFIG_EMBEDDED.
>
> - Set certain default values of some configurations differently,
> following the assumption that configuring a kernel build for an
> embedded system generally starts with a different set of default values
> compared to kernel builds for all other kind of systems.
>
> Considering the first purpose, at the point in time where CONFIG_EMBEDDED
> was renamed to CONFIG_EXPERT, CONFIG_EXPERT already made 130 more options
> become visible throughout all different menus for the kernel configuration.
> Over the last decade, this has gradually increased, so that currently, with
> CONFIG_EXPERT, roughly 170 more options become visible throughout all
> different menus for the kernel configuration. In comparison, currently with
> CONFIG_EMBEDDED enabled, just seven more options are visible, one in x86,
> one in arm, and five for the ChipIdea Highspeed Dual Role Controller.
>
> As the numbers suggest, these two levels of enabling the visibility of even
> more configuration options---beyond what CONFIG_EXPERT enables---never
> evolved to a good solution in the last decade. In other words, this
> additional level of visibility of configuration option with CONFIG_EMBEDDED
> compared to CONFIG_EXPERT has since its introduction never become really
> valuable. It requires quite some investigation to actually understand what
> is additionally visible and it does not differ significantly in complexity
> compared to just enabling CONFIG_EXPERT. This CONFIG_EMBEDDED---or any
> other config to show more detailed options beyond CONFIG_EXPERT---is
> unlikely to be valuable unless somebody puts significant effort in
> identifying how such visibility options can be properly split and creating
> clear criteria, when some config option is visible with CONFIG_EXPERT and
> when some config option is visible only with some further option enabled
> beyond CONFIG_EXPERT, such as CONFIG_EMBEDDED attempted to do. For now, it
> is much more reasonable to simply make those additional seven options that
> visible with CONFIG_EMBEDDED, visible with CONFIG_EXPERT, and then remove
> CONFIG_EMBEDDED. If anyone spends significant effort in structuring the
> visibility of config options, they may re-introduce suitable new config
> options simply as they see fit.
>
> Hence, all uses of CONFIG_EMBEDDED have been replaced with CONFIG_EXPERT.
>
> Considering the second purpose, note that already probably arguing that a
> kernel build for an embedded system would choose some values differently is
> already tricky: the set of embedded systems with Linux kernels is already
> quite diverse. Many embedded system have powerful CPUs and it would not be
> clear that all embedded systems just optimize towards one specific aspect,
> e.g., a smaller kernel image size. So, it is unclear if starting with "one
> set of default configuration" that is induced by CONFIG_EMBEDDED is a good
> offer for developers configuring their kernels.
>
> Also, the differences of needed user-space features in an embedded system
> compared to a non-embedded system are probably difficult or even impossible
> to name in some generic way.
>
> So it is not surprising that in the last decade hardly anyone has
> contributed changes to make something default differently in case of
> CONFIG_EMBEDDED=y.
>
> In v6.0-rc4, SECRETMEM is the only config switched off if
> CONFIG_EMBEDDED=y. That one use was removed as well, SECRETMEM was made
> configurable at build time by experts using menuconfig instead.
>
> As there are no further uses of CONFIG_EMBEDDED and CONFIG_EMBEDDED never
> lived up to its intended purpose defined above, simply delete this
> confusing CONFIG_EMBEDDED.
>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>
> ---
> init/Kconfig | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 9e3fd79b089c..d7429e0b8cae 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1818,14 +1818,6 @@ config DEBUG_RSEQ
>
> If unsure, say N.
>
> -config EMBEDDED
> - bool "Embedded system"
> - select EXPERT
> - help
> - This option should be enabled if compiling the kernel for
> - an embedded system so certain expert options are available
> - for configuration.
> -
> config HAVE_PERF_EVENTS
> bool
> help

That's fine, but what happens to existing defconfigs then ?

$ git grep -w CONFIG_EMBEDDED arch/powerpc/
arch/powerpc/configs/40x/klondike_defconfig:CONFIG_EMBEDDED=y
arch/powerpc/configs/44x/fsp2_defconfig:CONFIG_EMBEDDED=y
arch/powerpc/configs/52xx/tqm5200_defconfig:CONFIG_EMBEDDED=y
arch/powerpc/configs/mgcoge_defconfig:CONFIG_EMBEDDED=y
arch/powerpc/configs/microwatt_defconfig:CONFIG_EMBEDDED=y
arch/powerpc/configs/ps3_defconfig:CONFIG_EMBEDDED=y

They need to get converted to selecting CONFIG_EXPERT instead.

And that needs to be done before you remove CONFIG_EMBEDDED.

Christophe