linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size
@ 2023-01-31  3:06 Sourabh Jain
  2023-02-05  9:41 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Sourabh Jain @ 2023-01-31  3:06 UTC (permalink / raw)
  To: linuxppc-dev, mpe; +Cc: mahesh, hbathini

On Systems where online memory is lesser compared to max memory, the
kexec_file_load system call may fail to load the kdump kernel with the
below errors:

    "Failed to update fdt with linux,drconf-usable-memory property"
    "Error setting up usable-memory property for kdump kernel"

This happens because the size estimation for usable memory properties
for the kdump kernel's FDT is based on the online memory whereas the
usable memory properties include max memory. In short, the hot-pluggable
memory is not accounted for while estimating the size of the usable
memory properties.

The issue is addressed by calculating usable memory property size using
max hotplug address instead of the last online memory address.

Fixes: 2377c92e37fe ("powerpc/kexec_file: fix FDT size estimation for kdump kernel")
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
Since v2: rebase the patch on top of
http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20230130014707.541110-1-mpe@ellerman.id.au/

 arch/powerpc/kexec/file_load_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 3caee570e79bf..6af82fb53a493 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -990,7 +990,7 @@ unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image)
 	 * number of usable memory entries and use for FDT size estimation.
 	 */
 	if (drmem_lmb_size()) {
-		usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) +
+		usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
 			       (2 * (resource_size(&crashk_res) / drmem_lmb_size())));
 		extra_size = (unsigned int)(usm_entries * sizeof(u64));
 	} else
-- 
2.39.1


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

* Re: [PATCH v2] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size
  2023-01-31  3:06 [PATCH v2] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size Sourabh Jain
@ 2023-02-05  9:41 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2023-02-05  9:41 UTC (permalink / raw)
  To: mpe, Sourabh Jain, linuxppc-dev; +Cc: mahesh, hbathini

On Tue, 31 Jan 2023 08:36:15 +0530, Sourabh Jain wrote:
> On Systems where online memory is lesser compared to max memory, the
> kexec_file_load system call may fail to load the kdump kernel with the
> below errors:
> 
>     "Failed to update fdt with linux,drconf-usable-memory property"
>     "Error setting up usable-memory property for kdump kernel"
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size
      https://git.kernel.org/powerpc/c/fc546faa559538fb312c77e055243ece18ab3288

cheers

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

end of thread, other threads:[~2023-02-05  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31  3:06 [PATCH v2] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size Sourabh Jain
2023-02-05  9:41 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).