All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/kdump: handle crashkernel memory reservation failure
@ 2018-06-28  5:19 Hari Bathini
  2018-06-28  5:32 ` David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hari Bathini @ 2018-06-28  5:19 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Dave Young, Mahesh J Salgaonkar, dgibson

Memory reservation for crashkernel could fail if there are holes around
kdump kernel offset (128M). Fail gracefully in such cases and print an
error message.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
 arch/powerpc/kernel/machine_kexec.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 936c7e2..6181442 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -188,7 +188,12 @@ void __init reserve_crashkernel(void)
 			(unsigned long)(crashk_res.start >> 20),
 			(unsigned long)(memblock_phys_mem_size() >> 20));
 
-	memblock_reserve(crashk_res.start, crash_size);
+	if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
+	    memblock_reserve(crashk_res.start, crash_size)) {
+		printk(KERN_ERR "Failed to reserve memory for crashkernel!\n");
+		crashk_res.start = crashk_res.end = 0;
+		return;
+	}
 }
 
 int overlaps_crashkernel(unsigned long start, unsigned long size)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/kdump: handle crashkernel memory reservation failure
  2018-06-28  5:19 [PATCH] powerpc/kdump: handle crashkernel memory reservation failure Hari Bathini
@ 2018-06-28  5:32 ` David Gibson
  2018-06-28  6:48 ` Dave Young
  2018-07-19  6:07 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2018-06-28  5:32 UTC (permalink / raw)
  To: Hari Bathini
  Cc: Michael Ellerman, linuxppc-dev, Dave Young, Mahesh J Salgaonkar

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

On Thu, 28 Jun 2018 10:49:56 +0530
Hari Bathini <hbathini@linux.ibm.com> wrote:

> Memory reservation for crashkernel could fail if there are holes around
> kdump kernel offset (128M). Fail gracefully in such cases and print an
> error message.
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>

Tested-by: David Gibson <dgibson@redhat.com>

> ---
>  arch/powerpc/kernel/machine_kexec.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index 936c7e2..6181442 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
> @@ -188,7 +188,12 @@ void __init reserve_crashkernel(void)
>  			(unsigned long)(crashk_res.start >> 20),
>  			(unsigned long)(memblock_phys_mem_size() >> 20));
>  
> -	memblock_reserve(crashk_res.start, crash_size);
> +	if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
> +	    memblock_reserve(crashk_res.start, crash_size)) {
> +		printk(KERN_ERR "Failed to reserve memory for crashkernel!\n");
> +		crashk_res.start = crashk_res.end = 0;
> +		return;
> +	}
>  }
>  
>  int overlaps_crashkernel(unsigned long start, unsigned long size)
> 


-- 
David Gibson <dgibson@redhat.com>
Principal Software Engineer, Virtualization, Red Hat

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/kdump: handle crashkernel memory reservation failure
  2018-06-28  5:19 [PATCH] powerpc/kdump: handle crashkernel memory reservation failure Hari Bathini
  2018-06-28  5:32 ` David Gibson
@ 2018-06-28  6:48 ` Dave Young
  2018-07-19  6:07 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Young @ 2018-06-28  6:48 UTC (permalink / raw)
  To: Hari Bathini; +Cc: Michael Ellerman, linuxppc-dev, Mahesh J Salgaonkar, dgibson

On 06/28/18 at 10:49am, Hari Bathini wrote:
> Memory reservation for crashkernel could fail if there are holes around
> kdump kernel offset (128M). Fail gracefully in such cases and print an
> error message.
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> ---
>  arch/powerpc/kernel/machine_kexec.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index 936c7e2..6181442 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
> @@ -188,7 +188,12 @@ void __init reserve_crashkernel(void)
>  			(unsigned long)(crashk_res.start >> 20),
>  			(unsigned long)(memblock_phys_mem_size() >> 20));
>  
> -	memblock_reserve(crashk_res.start, crash_size);
> +	if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
> +	    memblock_reserve(crashk_res.start, crash_size)) {
> +		printk(KERN_ERR "Failed to reserve memory for crashkernel!\n");
> +		crashk_res.start = crashk_res.end = 0;
> +		return;
> +	}
>  }
>  
>  int overlaps_crashkernel(unsigned long start, unsigned long size)
> 

It would be better to print a separate error message for !memblock_is_region_memory
But I think memblock_reserve is unlikly to fail so this patch is also
good.

Reviewed-by: Dave Young <dyoung@redhat.com>

Thanks
Dave

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: powerpc/kdump: handle crashkernel memory reservation failure
  2018-06-28  5:19 [PATCH] powerpc/kdump: handle crashkernel memory reservation failure Hari Bathini
  2018-06-28  5:32 ` David Gibson
  2018-06-28  6:48 ` Dave Young
@ 2018-07-19  6:07 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-07-19  6:07 UTC (permalink / raw)
  To: Hari Bathini; +Cc: linuxppc-dev, Dave Young, Mahesh J Salgaonkar, dgibson

On Thu, 2018-06-28 at 05:19:56 UTC, Hari Bathini wrote:
> Memory reservation for crashkernel could fail if there are holes around
> kdump kernel offset (128M). Fail gracefully in such cases and print an
> error message.
> 
> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> Tested-by: David Gibson <dgibson@redhat.com>
> Reviewed-by: Dave Young <dyoung@redhat.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/8950329c4a64c6d3ca0bc34711a1af

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-19  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28  5:19 [PATCH] powerpc/kdump: handle crashkernel memory reservation failure Hari Bathini
2018-06-28  5:32 ` David Gibson
2018-06-28  6:48 ` Dave Young
2018-07-19  6:07 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.