Re: [PATCH v3] erofs: cap LZMA stream pool size

From: Guenter Roeck

Date: Sat Aug 15 2026 - 09:31:26 EST


On 8/15/26 04:41, Geert Uytterhoeven wrote:
Hi Günter,

On Fri, 14 Aug 2026 at 20:44, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
On 8/14/26 11:26, Gao Xiang wrote:
On Wed, Aug 12, 2026 at 07:25:50AM -0700, Guenter Roeck wrote:
Thank you, that seems to work (despite still seeing the warning on m68k,
as NR_CPUS does not exist).

$ make ARCH=m68k allmodconfig
fs/erofs/Kconfig:137:warning: range is invalid

Warning...

Yes, other arches shouldn't have the warning because I think other
arches (including microblaze) defines NR_CPUS in Kconfig, except m68k.

That is not entirely true. openrisc only has it if SMP=y. But it still
does not generate the warning for some reason.

I looked into the documentation a bit
(https://docs.kernel.org/kbuild/kconfig-language.html), especially the
following parts:

- type definition: “bool”/”tristate”/”string”/”hex”/”int” ...
- input prompt: “prompt” <prompt> [“if” <expr>] ...
and "If a prompt is not present, the config option is
a non-visible symbol, ..."

- dependencies: “depends on” <expr> [“if” <expr>] ...
- Menu dependencies ..

and I think that is true, taking openrisc for example:

config NR_CPUS
int "Maximum number of CPUs (2-32)"
range 2 32
depends on SMP
default "2"

which can be transformed into

config NR_CPUS
int
prompt "Maximum number of CPUs (2-32)"
range 2 32
depends on SMP
default "2"

which can be then transformed into

config NR_CPUS
int
prompt "Maximum number of CPUs (2-32)" if SMP
range 2 32 if SMP
default "2" if SMP

so if `SMP=n`, it's equivalent to

config NR_CPUS
int

so NR_CPUS symbol is still there I think (and its value is 0.)

$ grep NR_CPUS .config
CONFIG_FORCE_NR_CPUS=y
$ grep EROFS .config
CONFIG_EROFS_FS=y
# CONFIG_EROFS_FS_DEBUG is not set
CONFIG_EROFS_FS_XATTR=y
CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
CONFIG_EROFS_FS_BACKED_BY_FILE=y
CONFIG_EROFS_FS_ZIP=y
CONFIG_EROFS_FS_ZIP_LZMA=y
CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=0
# CONFIG_EROFS_FS_ZIP_DEFLATE is not set
# CONFIG_EROFS_FS_ZIP_ZSTD is not set
# CONFIG_EROFS_FS_ZIP_ACCEL is not set
# CONFIG_EROFS_FS_PCPU_KTHREAD is not set
# CONFIG_EROFS_FS_PAGE_CACHE_SHARE is not set

The symbol may be there internally, but it does not show up in .config.

config EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
...
range 1 NR_CPUS

Apparently the default value picked by "automatic" configs like
allmodconfig and defconfig is the last item from the range.
If NR_CPUS exists internally (e.g. openrisc and arm), you end up with
the "undefined value", aka zero:

CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=0

As NR_CPUS did not exist on m68k at all, you ended up with the NR_CPUS
literal:

CONFIG_EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS=NR_CPUS


Upstream commit a64d500b0078 ("erofs: fix EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS
on some UP platforms") should fix that problem. Apparently it did not only
affect openrisc.

Thanks,
Guenter