Re: [PATCH v4 1/4] MIPS: Refactor early_parse_mem() to fix mem= parameter

Mike Rapoport
2022-03-05T13:14:09Z

On Fri, Mar 04, 2022 at 05:11:44PM +0000, Maciej W. Rozycki wrote:
> On Fri, 4 Mar 2022, Thomas Bogendoerfer wrote:
>
> > > > With this patch, when add "mem=3G" to the command-line, the
> > > > kernel boots successfully, we can see the following messages:
> > >
> > > unfortunately this patch would break platforms without memory detection,
> > > which simply use mem=32M for memory configuration. Not sure how many
> > > rely on this mechanism. If we can make sure nobody uses it, I'm fine
> > > with your patch.
> >
> > maybe we could add a CONFIG option, which will be selected by
> > platforms, which don't need/want this usermem thing.
>
> FWIW I don't understand what the issue is here beyond that we have a bug
> that causes a system to hang when "mem=3G" is passed on the kernel command
> line. That is assuming that system does have contiguous RAM available for
> the kernel to use from address 0 up to 3GiB; otherwise it's a user error
> to tell the kernel it has that memory available (I did get bitten by that
> myself too): garbage in, garbage out.

This is exactly the case here because the system does not have contiguous
RAM:

[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000004000000-0x000000000effffff]
[ 0.000000] node 0: [mem 0x0000000090200000-0x00000000ffffffff]
[ 0.000000] node 0: [mem 0x0000000120000000-0x00000001653fffff]

(from patch 3/4 in this series)

I don't see what "bug" this patch is trying to fix. Is indeed possible to
make MIPS' mem= behave like it does not arm64 and ppc, but that would break
systems that use current semantics and I recall seeing some of OpenWRT
machines using mem= to override memory map supplied by firmware.

> Maciej

--
Sincerely yours,
Mike.