Re: [PATCH 1/5] kconfig: include common Kconfig files from top-level Kconfig

From: Masahiro Yamada
Date: Thu Jul 05 2018 - 01:39:26 EST


2018-07-04 1:11 GMT+09:00 Randy Dunlap <rdunlap@xxxxxxxxxxxxx>:
> On 07/03/18 06:36, Christoph Hellwig wrote:
>> On Mon, Jul 02, 2018 at 01:08:16PM -0700, Randy Dunlap wrote:
>>>> I would prefer to have init/Kconfig before arch/$(SRCARCH)/Kconfig.
>>>
>>> Ugh, that won't get this set correctly on x86_64:
>>> CONFIG_PGTABLE_LEVELS=2
>>
>> Did you try it? As far as I can tell modern kconfig isn't really
>> order sensitive any more.
>> --
>
> Yes, it was wrong. :(
>
> Once the symbol has a default value, it won't be assigned a different
> default value (at least that's how it looks; I haven't read the kconfig
> source code).
>

The order does matter.

The 'default' properties are accumulated
as they appear.


If arch/Kconfig were parsed before arch/x86/Kconfig,
it would end up with this:



config PGTABLE_LEVELS
int
default 2 <- from arch/Kconfig
default 5 if X86_5LEVEL <- from arch/x86/Kconfig
default 4 if X86_64 <- from arch/x86/Kconfig
default 3 if X86_PAE <- from arch/x86/Kconfig
default 2 <- from arch/x86/Kconfig

So, PGTABLE_LEVELS would be always 2.
The last four lines are dead code.





The correct order is arch/x86/Kconfig, arch/Kconfig
then we can get this:

config PGTABLE_LEVELS
int
default 5 if X86_5LEVEL <- from arch/x86/Kconfig
default 4 if X86_64 <- from arch/x86/Kconfig
default 3 if X86_PAE <- from arch/x86/Kconfig
default 2 <- from arch/x86/Kconfig
default 2 <- from arch/Kconfig


--
Best Regards
Masahiro Yamada