Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
       [not found] <c480ed6b8bf38822263e2c5b7cf32b28600f212d.1787219898.git.geert+renesas@glider.be>
@ 2026-08-20 10:15 ` Geert Uytterhoeven
  2026-08-28 15:34   ` Nicolas Schier
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-20 10:15 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Sandeep Dhavale, Hongbo Li,
	Chunhai Guo, Michael Bommarito, linux-erofs, linux-kernel,
	linux-kbuild

CC kbuild

On Thu, 20 Aug 2026 at 12:01, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> When NR_CPUS is less than 16, or when SMP is disabled, the default value
> of 16 is invalid.
>
> While actual configuration picks up a sensible and valid default
> (NR_CPUS or 1), "make savedefconfig" will still write a line like
>
>     CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
>
> to the defconfig file, even if that matches the sensible default.

Is this a bug in kconfig?

> Avoid needlessly enlarging the defconfig files, and reduce churn for
> updating them, by specifying valid defaults depending on SMP and
> NR_CPUS.
>
> While at it, make the prompt depend on SMP, as there is no point in
> asking the user about the maximum number of decompression streams if
> there is only one valid answer.
>
> Fixes: c9b47e6b23114e93 ("erofs: cap LZMA stream pool size")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  fs/erofs/Kconfig | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> index 2dfc313588d283a0..37495e95a78d9bf6 100644
> --- a/fs/erofs/Kconfig
> +++ b/fs/erofs/Kconfig
> @@ -132,11 +132,13 @@ config EROFS_FS_ZIP_LZMA
>           Say N if you want to disable LZMA compression support.
>
>  config EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
> -       int "EROFS LZMA default maximum decompression streams"
> +       int "EROFS LZMA default maximum decompression streams" if SMP
>         depends on EROFS_FS_ZIP_LZMA
>         range 1 NR_CPUS if SMP
>         range 1 1 if !SMP
> -       default 16
> +       default 16 if SMP && NR_CPUS >= 16
> +       default NR_CPUS if SMP
> +       default 1
>         help
>           By default EROFS allocates one LZMA decompression stream per CPU.
>           Each stream can hold a dictionary of up to 8 MiB taken from the
> @@ -144,7 +146,7 @@ config EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
>           of memory.  This caps the default; the lzma_streams module parameter
>           still overrides it.
>
> -         If unsure, keep the default of 16.
> +         If unsure, keep the suggested default (16 or lower).
>
>  config EROFS_FS_ZIP_DEFLATE
>         bool "EROFS DEFLATE compressed data support"

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
  2026-08-20 10:15 ` [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic Geert Uytterhoeven
@ 2026-08-28 15:34   ` Nicolas Schier
  2026-08-28 17:21     ` Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Schier @ 2026-08-28 15:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Nathan Chancellor, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
	Sandeep Dhavale, Hongbo Li, Chunhai Guo, Michael Bommarito,
	linux-erofs, linux-kernel, linux-kbuild

On Thu, Aug 20, 2026 at 12:15:33PM +0200, Geert Uytterhoeven wrote:
> CC kbuild
> 
> On Thu, 20 Aug 2026 at 12:01, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > When NR_CPUS is less than 16, or when SMP is disabled, the default value
> > of 16 is invalid.
> >
> > While actual configuration picks up a sensible and valid default
> > (NR_CPUS or 1), "make savedefconfig" will still write a line like
> >
> >     CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
> >
> > to the defconfig file, even if that matches the sensible default.
> 
> Is this a bug in kconfig?

I am not able to reproduce that; this is what I see with ARCH=arm64
(arm64 always has SMP=y):

.config:CONFIG_SMP=y
.config:CONFIG_NR_CPUS=3
.config:CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=3

-> defconfig:CONFIG_NR_CPUS=3

similar for ARCH=arm:

.config:CONFIG_SMP=y
.config:CONFIG_NR_CPUS=3
.config:CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=3
defconfig:CONFIG_SMP=y
defconfig:CONFIG_NR_CPUS=3

or with ARCH=arm and SMP=n:

.config:# CONFIG_SMP is not set
.config:CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1

(CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS does not appear in ./defconfig)

and with ARCH=m68k, NR_CPUS=8:

.config:CONFIG_NR_CPUS=1
.config:CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1

(CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS does not appear in ./defconfig)



Thus, to me it looks as expected.  Do you still see the behaviour you
described above?

Kind regards,
Nicolas

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

* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
  2026-08-28 15:34   ` Nicolas Schier
@ 2026-08-28 17:21     ` Geert Uytterhoeven
  2026-08-28 19:20       ` Nicolas Schier
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-28 17:21 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Nathan Chancellor, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
	Sandeep Dhavale, Hongbo Li, Chunhai Guo, Michael Bommarito,
	linux-erofs, linux-kernel, linux-kbuild

Hi Nicolas,

On Fri, 28 Aug 2026 at 17:47, Nicolas Schier <nsc@kernel.org> wrote:
> On Thu, Aug 20, 2026 at 12:15:33PM +0200, Geert Uytterhoeven wrote:
> > On Thu, 20 Aug 2026 at 12:01, Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> > > When NR_CPUS is less than 16, or when SMP is disabled, the default value
> > > of 16 is invalid.
> > >
> > > While actual configuration picks up a sensible and valid default
> > > (NR_CPUS or 1), "make savedefconfig" will still write a line like
> > >
> > >     CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
> > >
> > > to the defconfig file, even if that matches the sensible default.
> >
> > Is this a bug in kconfig?
>
> I am not able to reproduce that; this is what I see with ARCH=arm64
> (arm64 always has SMP=y):

[...]

> Thus, to me it looks as expected.  Do you still see the behaviour you
> described above?

Perhaps you cannot reproduce this because this fix is already
upstream as commit ab74edaeb1ae7c71 ("erofs: Fix
EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic")?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
  2026-08-28 17:21     ` Geert Uytterhoeven
@ 2026-08-28 19:20       ` Nicolas Schier
  2026-08-28 23:19         ` Julian Braha
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Schier @ 2026-08-28 19:20 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Nathan Chancellor, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
	Sandeep Dhavale, Hongbo Li, Chunhai Guo, Michael Bommarito,
	Julian Braha, linux-erofs, linux-kernel, linux-kbuild

Cc: Julian

On Fri, Aug 28, 2026 at 07:21:07PM +0200, Geert Uytterhoeven wrote:
> Hi Nicolas,
> 
> On Fri, 28 Aug 2026 at 17:47, Nicolas Schier <nsc@kernel.org> wrote:
> > On Thu, Aug 20, 2026 at 12:15:33PM +0200, Geert Uytterhoeven wrote:
> > > On Thu, 20 Aug 2026 at 12:01, Geert Uytterhoeven
> > > <geert+renesas@glider.be> wrote:
> > > > When NR_CPUS is less than 16, or when SMP is disabled, the default value
> > > > of 16 is invalid.
> > > >
> > > > While actual configuration picks up a sensible and valid default
> > > > (NR_CPUS or 1), "make savedefconfig" will still write a line like
> > > >
> > > >     CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=1
> > > >
> > > > to the defconfig file, even if that matches the sensible default.
> > >
> > > Is this a bug in kconfig?
> >
> > I am not able to reproduce that; this is what I see with ARCH=arm64
> > (arm64 always has SMP=y):
> 
> [...]
> 
> > Thus, to me it looks as expected.  Do you still see the behaviour you
> > described above?
> 
> Perhaps you cannot reproduce this because this fix is already
> upstream as commit ab74edaeb1ae7c71 ("erofs: Fix
> EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic")?
> 

oh sure, thanks.  Yes, it really looks like a bug to me: if the range is
defined as 1 to 1, the default 16 should not cause a savedefconfig to
write the config set to 1.

-- 
Nicolas

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

* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
  2026-08-28 19:20       ` Nicolas Schier
@ 2026-08-28 23:19         ` Julian Braha
  2026-08-31 12:40           ` Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: Julian Braha @ 2026-08-28 23:19 UTC (permalink / raw)
  To: Geert Uytterhoeven, Nathan Chancellor, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Sandeep Dhavale, Hongbo Li, Chunhai Guo,
	Michael Bommarito, linux-erofs, linux-kernel, linux-kbuild

On 8/28/26 20:20, Nicolas Schier wrote:
> Cc: Julian

Thanks for looping me in.

So it's not great usage of the Kconfig language to have the 'range 1 1'
and the 'default 16' here contradicting each other. But, it's currently
legal.

I would prefer to disallow this, but a proper check would actually
require SAT solving (or similar) in the general case, so it's unlikely
to become an error in the near future.

Anyway, as long as we're continuing to allow it, savedefconfig should be
considered bugged for not handling it accordingly.

Let me see if I can send something out this weekend.

- Julian Braha

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

* Re: [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic
  2026-08-28 23:19         ` Julian Braha
@ 2026-08-31 12:40           ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2026-08-31 12:40 UTC (permalink / raw)
  To: Julian Braha
  Cc: Nathan Chancellor, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu,
	Sandeep Dhavale, Hongbo Li, Chunhai Guo, Michael Bommarito,
	linux-erofs, linux-kernel, linux-kbuild

Hi Julian,

On Sat, 29 Aug 2026 at 01:19, Julian Braha <julianbraha@gmail.com> wrote:
> On 8/28/26 20:20, Nicolas Schier wrote:
> > Cc: Julian
>
> Thanks for looping me in.
>
> So it's not great usage of the Kconfig language to have the 'range 1 1'
> and the 'default 16' here contradicting each other. But, it's currently
> legal.
>
> I would prefer to disallow this, but a proper check would actually
> require SAT solving (or similar) in the general case, so it's unlikely
> to become an error in the near future.
>
> Anyway, as long as we're continuing to allow it, savedefconfig should be
> considered bugged for not handling it accordingly.
>
> Let me see if I can send something out this weekend.

Thank you, my patch can be reverted again once your "PATCH] kconfig:
fix extra output from savedefconfig on out-of-range defaults"[1]
has been accepted upstream.

[1] https://lore.kernel.org/20260830221129.2668354-1-julianbraha@gmail.com

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2026-08-31 12:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <c480ed6b8bf38822263e2c5b7cf32b28600f212d.1787219898.git.geert+renesas@glider.be>
2026-08-20 10:15 ` [PATCH] erofs: Fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic Geert Uytterhoeven
2026-08-28 15:34   ` Nicolas Schier
2026-08-28 17:21     ` Geert Uytterhoeven
2026-08-28 19:20       ` Nicolas Schier
2026-08-28 23:19         ` Julian Braha
2026-08-31 12:40           ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox