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: <ZBhvhBTQhAnN5qdm@kernel.org>
Date:   Mon, 20 Mar 2023 15:36:52 +0100
From:   Simon Horman <horms@...nel.org>
To:     Chen Jiahao <chenjiahao16@...wei.com>
Cc:     paul.walmsley@...ive.com, palmer@...belt.com,
        conor.dooley@...rochip.com, guoren@...nel.org, heiko@...ech.de,
        bjorn@...osinc.com, alex@...ti.fr, akpm@...ux-foundation.org,
        atishp@...osinc.com, bhe@...hat.com, thunder.leizhen@...wei.com,
        linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
        kexec@...ts.infradead.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH -next 1/2] riscv: kdump: Implement
 crashkernel=X,[high,low]

On Tue, Mar 21, 2023 at 04:42:43AM +0800, Chen Jiahao wrote:
> On riscv, the current crash kernel allocation logic is trying to
> allocate within 32bit addressible memory region by default, if
> failed, try to allocate without 4G restriction.
> 
> In need of saving DMA zone memory while allocating a relatively large
> crash kernel region, allocating the reserved memory top down in
> high memory, without overlapping the DMA zone, is a mature solution.
> Here introduce the parameter option crashkernel=X,[high,low].
> 
> We can reserve the crash kernel from high memory above DMA zone range
> by explicitly passing "crashkernel=X,high"; or reserve a memory range
> below 4G with "crashkernel=X,low".
> 
> Signed-off-by: Chen Jiahao <chenjiahao16@...wei.com>

Some minor nits, but I don't think there is any need to respin for them.

Reviewed-by: Simon Horman <horms@...nel.org>

...

> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 478d6763a01a..5def2174b243 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c

...

> @@ -1201,16 +1242,25 @@ static void __init reserve_crashkernel(void)
>  	 */
>  	crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
>  					       search_start,
> -					       min(search_end, (unsigned long) SZ_4G));
> +					       min(search_end, (unsigned long) dma32_phys_limit));

nit: While here, you could drop the space before 'ma32_phys_limit'.
     Or perhaps use min_t, which seems appropriate here.

>  	if (crash_base == 0) {
>  		/* Try again without restricting region to 32bit addressible memory */
>  		crash_base = memblock_phys_alloc_range(crash_size, PMD_SIZE,
> -						search_start, search_end);
> +						       search_start, search_end);
>  		if (crash_base == 0) {
>  			pr_warn("crashkernel: couldn't allocate %lldKB\n",
>  				crash_size >> 10);
>  			return;
>  		}
> +
> +		if (!crash_low_size)
> +			crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE;
> +	}
> +
> +	if ((crash_base > dma32_phys_limit - crash_low_size) &&
> +	     crash_low_size && reserve_crashkernel_low(crash_low_size)) {

nit: The line above should be aligned one character to the left
     (remove one space in the indent).

> +		memblock_phys_free(crash_base, crash_size);
> +		return;
>  	}
>  
>  	pr_info("crashkernel: reserved 0x%016llx - 0x%016llx (%lld MB)\n",

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ