Re: [PATCH v2] MIPS: replace add_memory_region with memblock

From: Thomas Bogendoerfer
Date: Mon Oct 12 2020 - 06:38:20 EST


On Fri, Oct 09, 2020 at 05:15:37PM +0300, Serge Semin wrote:
> On Fri, Oct 09, 2020 at 02:07:52PM +0200, Thomas Bogendoerfer wrote:
> > On Thu, Oct 08, 2020 at 06:20:06PM +0300, Serge Semin wrote:
> > > > @@ -426,13 +387,14 @@ static int __init early_parse_memmap(char *p)
> > > >
> > > > if (*p == '@') {
> > > > start_at = memparse(p+1, &p);
> > > > - add_memory_region(start_at, mem_size, BOOT_MEM_RAM);
> > > > + memblock_add(start_at, mem_size);
> > > > } else if (*p == '#') {
> > > > pr_err("\"memmap=nn#ss\" (force ACPI data) invalid on MIPS\n");
> > > > return -EINVAL;
> > > > } else if (*p == '$') {
> > > > start_at = memparse(p+1, &p);
> > >
> > > > - add_memory_region(start_at, mem_size, BOOT_MEM_RESERVED);
> > > > + memblock_add(start_at, mem_size);
> > > > + memblock_reserve(start_at, mem_size);
> > >
> > > I suppose we could remove the memory addition from here too. What do you think?
> >
>
> > I'm not sure about that, add_memory_region() did a memblock_add
> > and then memblock_reserve for BOOT_MEM_RESERVED, that's why I changed
> > it that way.
>
> The main question here whether we need to preserve the MIPS-specific semantics
> of the kernel 'memmap' parameter. Currently the memmap parameter passed with
> '$' specifier will be perceived as a reserved RAM region, while, for instance,
> the same parameter on x86 will be converted to a region, which won't be
> registered in memblock at all, so the system won't be able to reuse it if it's
> needed to be (see parse_memmap_one() and e820__memblock_setup() for details).
>
> I don't really know what approach is correct...
> Documentation/admin-guide/kernel-parameters.txt isn't certain about that. It
> says that the region must be reserved, but no words whether it is supposed to be
> mappable or non-mappable.

I leave it as in v3 of the patch for now. If we come to the point what
the correct semantic should be, we can change it.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]