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]
Date:   Tue, 13 Feb 2018 11:21:39 +0000
From:   Matt Redfearn <matt.redfearn@...s.com>
To:     Serge Semin <fancer.lancer@...il.com>, <ralf@...ux-mips.org>,
        <miodrag.dinic@...s.com>, <jhogan@...nel.org>,
        <goran.ferenc@...s.com>, <david.daney@...ium.com>,
        <paul.gortmaker@...driver.com>, <paul.burton@...s.com>,
        <alex.belits@...ium.com>, <Steven.Hill@...ium.com>
CC:     <alexander.sverdlin@...ia.com>, <kumba@...too.org>,
        <marcin.nowakowski@...s.com>, <James.hogan@...s.com>,
        <Peter.Wotton@...s.com>, <Sergey.Semin@...latforms.ru>,
        <linux-mips@...ux-mips.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 01/15] MIPS: memblock: Add RESERVED_NOMAP memory flag

Hi Serge,

On 02/02/18 03:54, Serge Semin wrote:
> Even if nomap flag is specified the reserved memory declared in dts
> isn't really discarded from the buddy allocator in the current code.
> We'll fix it by adding the no-map MIPS memory flag. Additionally
> lets add the RESERVED_NOMAP memory regions handling to the methods,
> which aren't going to be changed in the further patches.
> 
> Signed-off-by: Serge Semin <fancer.lancer@...il.com>
> ---
>   arch/mips/include/asm/bootinfo.h | 1 +
>   arch/mips/kernel/prom.c          | 8 ++++++--
>   arch/mips/kernel/setup.c         | 8 ++++++++
>   3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
> index e26a093bb17a..276618b5319d 100644
> --- a/arch/mips/include/asm/bootinfo.h
> +++ b/arch/mips/include/asm/bootinfo.h
> @@ -90,6 +90,7 @@ extern unsigned long mips_machtype;
>   #define BOOT_MEM_ROM_DATA	2
>   #define BOOT_MEM_RESERVED	3
>   #define BOOT_MEM_INIT_RAM	4
> +#define BOOT_MEM_RESERVED_NOMAP	5
>   
>   /*
>    * A memory map that's built upon what was determined
> diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
> index 0dbcd152a1a9..b123eb8279cd 100644
> --- a/arch/mips/kernel/prom.c
> +++ b/arch/mips/kernel/prom.c
> @@ -41,7 +41,7 @@ char *mips_get_machine_name(void)
>   #ifdef CONFIG_USE_OF
>   void __init early_init_dt_add_memory_arch(u64 base, u64 size)
>   {
> -	return add_memory_region(base, size, BOOT_MEM_RAM);
> +	add_memory_region(base, size, BOOT_MEM_RAM);

This is an unrelated change.

>   }
>   
>   void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
> @@ -52,7 +52,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
>   int __init early_init_dt_reserve_memory_arch(phys_addr_t base,
>   					phys_addr_t size, bool nomap)
>   {
> -	add_memory_region(base, size, BOOT_MEM_RESERVED);
> +	if (!nomap)
> +		add_memory_region(base, size, BOOT_MEM_RESERVED);
> +	else
> +		add_memory_region(base, size, BOOT_MEM_RESERVED_NOMAP);
> +
>   	return 0;
>   }
>   
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index 702c678de116..1a4d64410303 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -172,6 +172,7 @@ bool __init memory_region_available(phys_addr_t start, phys_addr_t size)
>   				in_ram = true;
>   			break;
>   		case BOOT_MEM_RESERVED:
> +		case BOOT_MEM_RESERVED_NOMAP:
>   			if ((start >= start_ && start < end_) ||
>   			    (start < start_ && start + size >= start_))
>   				free = false;
> @@ -207,6 +208,9 @@ static void __init print_memory_map(void)
>   		case BOOT_MEM_RESERVED:
>   			printk(KERN_CONT "(reserved)\n");
>   			break;
> +		case BOOT_MEM_RESERVED_NOMAP:
> +			printk(KERN_CONT "(reserved nomap)\n");
> +			break;
>   		default:
>   			printk(KERN_CONT "type %lu\n", boot_mem_map.map[i].type);
>   			break;
> @@ -955,9 +959,13 @@ static void __init resource_init(void)
>   			res->name = "System RAM";
>   			res->flags |= IORESOURCE_SYSRAM;
>   			break;
> +		case BOOT_MEM_RESERVED_NOMAP:
> +			res->name = "reserved nomap";
> +			break;
>   		case BOOT_MEM_RESERVED:
>   		default:
>   			res->name = "reserved";
> +			break;

This is an unrelated change.

With those 2 removed, I think this looks fine.

Reviewed-by: Matt Redfearn <matt.redfearn@...s.com>

Thanks,
Matt

>   		}
>   
>   		request_resource(&iomem_resource, res);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ