lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201009120752.GA10588@alpha.franken.de>
Date:   Fri, 9 Oct 2020 14:07:52 +0200
From:   Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To:     Serge Semin <fancer.lancer@...il.com>
Cc:     Hauke Mehrtens <hauke@...ke-m.de>,
        Rafał Miłecki <zajec5@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        bcm-kernel-feedback-list@...adcom.com,
        "Maciej W. Rozycki" <macro@...ux-mips.org>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        Keguang Zhang <keguang.zhang@...il.com>,
        John Crispin <john@...ozen.org>, linux-mips@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2] MIPS: replace add_memory_region with memblock

On Thu, Oct 08, 2020 at 06:20:06PM +0300, Serge Semin wrote:
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
> > ---
> > Changes in v2:
> > 	fixed missing memblock include in fw/sni/sniprom.c
> > 	tested on cobalt, IP22, IP28, IP30, IP32, JAZZ, SNI
> 
> ...
> 
> > diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
> > index 9e50dc8df2f6..fab532cb5a11 100644
> > --- a/arch/mips/kernel/prom.c
> > +++ b/arch/mips/kernel/prom.c
> > @@ -50,14 +50,18 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
> >  		size = PHYS_ADDR_MAX - base;
> >  	}
> >  
> > -	add_memory_region(base, size, BOOT_MEM_RAM);
> > +	memblock_add(base, size);
> >  }
> >  
> >  int __init early_init_dt_reserve_memory_arch(phys_addr_t base,
> >  					phys_addr_t size, bool nomap)
> >  {
> > -	add_memory_region(base, size,
> > -			  nomap ? BOOT_MEM_NOMAP : BOOT_MEM_RESERVED);
> > +	if (nomap) {
> > +		memblock_remove(base, size);
> > +	} else {
> > +		memblock_add(base, size);
> > +		memblock_reserve(base, size);
> > +	}
> >  
> >  	return 0;
> >  }
> 
> I guess originally the arch-specific early_init_dt_add_memory_arch() and
> early_init_dt_reserve_memory_arch() methods have been added since MIPS's got its
> own memory types declarations (BOOT_MEM_RAM, BOOT_MEM_RESERVED, etc) and had had
> a specific internal system memory regions mapping (add_memory_region(),
> boot_mem_map, etc). Since the leftover of that framework is going to be removed,
> we can freely use the standard early_init_dt_add_memory_arch() and
> early_init_dt_reserve_memory_arch() implementations from drivers/of/fdt.c:1102
> drivers/of/fdt.c:1149 .

perfect, I'll remove it in my next version.

> > @@ -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.

Thomas.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ