Re: [PATCH 1/2] kconfig: remove unneeded symbol_empty variable

Yoann Congal
2024-01-25T14:42:35Z

Hi,

Le 24/01/2024 à 21:12, Masahiro Yamada a écrit :
> On Wed, Jan 24, 2024 at 5:56 PM Yoann Congal <yoann.congal@smile.fr> wrote:
>> Le 24/01/2024 à 09:09, Masahiro Yamada a écrit :
>>> On Wed, Jan 24, 2024 at 12:11 AM Yoann Congal <yoann.congal@smile.fr> wrote:
>>>> For what it is worth, CONFIG_BASE_SMALL is defined as an int but is only used as a bool :
>>>> $ git grep BASE_SMALL
>>>> arch/x86/include/asm/mpspec.h:#if CONFIG_BASE_SMALL == 0
>>>> drivers/tty/vt/vc_screen.c:#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
>>>> include/linux/threads.h:#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
>>>> include/linux/threads.h:#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
>>>> include/linux/udp.h:#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
>>>> include/linux/xarray.h:#define XA_CHUNK_SHIFT (CONFIG_BASE_SMALL ? 4 : 6)
>>>> init/Kconfig: default 12 if !BASE_SMALL
>>>> init/Kconfig: default 0 if BASE_SMALL
>>>> init/Kconfig:config BASE_SMALL
>>>> kernel/futex/core.c:#if CONFIG_BASE_SMALL
>>>> kernel/user.c:#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7)
>>>>
>>>> Maybe we should change CONFIG_BASE_SMALL to the bool type?
>>
>> My first test shows that switching CONFIG_BASE_SMALL to bool type does fix the LOG_CPU_MAX_BUF_SHIFT default value.
>>
>>>> I'll poke around to see if I can understand why a int="0" is true for kconfig.
>>
>> Here's what I understood:
>> To get the default value of LOG_CPU_MAX_BUF_SHIFT, kconfig calls sym_get_default_prop(LOG_CPU_MAX_BUF_SHIFT)
>> -> expr_calc_value("BASE_SMALL" as an expr)
>> -> sym_calc_value(BASE_SMALL as a symbol) and returns sym->curr.tri
>>
>> But, if I understood correctly, sym_calc_value() does not set sym->curr.tri in case of a int type config.
>
> Right.

Thanks :)

> The following will restore the original behavior.
>
>
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -349,12 +349,15 @@ void sym_calc_value(struct symbol *sym)
> switch (sym->type) {
> case S_INT:
> newval.val = "0";
> + newval.tri = no;
> break;
> case S_HEX:
> newval.val = "0x0";
> + newval.tri = no;
> break;
> case S_STRING:
> newval.val = "";
> + newval.tri = no;
> break;
> case S_BOOLEAN:
> case S_TRISTATE:
> >
> But, I do not think that is the right thing to do.
>
> Presumably, turning CONFIG_BASE_SMALL is correct.

I'm working on a patch to do that.

Regards,
--
Yoann Congal
Smile ECS - Tech Expert