Re: [PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2023-01-29 Thread Sourabh Jain



On 30/01/23 08:34, Michael Ellerman wrote:

Sourabh Jain  writes:

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 
---
  arch/powerpc/kexec/file_load_64.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Can you please rebase it on top of the fix I posted.

http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20230130014707.541110-1-...@ellerman.id.au/

Sure I will rebase it and send the next version.

Thanks,
Sourabh


Re: [PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2023-01-29 Thread Michael Ellerman
Sourabh Jain  writes:
> 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 
> ---
>  arch/powerpc/kexec/file_load_64.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Can you please rebase it on top of the fix I posted.

http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20230130014707.541110-1-...@ellerman.id.au/

cheers


Re: [PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2023-01-26 Thread Sourabh Jain

Gentle reminder, any comments and suggestions on this fix.

- Sourabh

On 15/12/22 14:08, 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"

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 
---
  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 349a781cea0b3..2c3fd6fe6bc94 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -947,7 +947,7 @@ unsigned int kexec_extra_fdt_size_ppc64(struct kimage 
*image)
 * linux,drconf-usable-memory properties. Get an approximate on the
 * number of usable memory entries and use for FDT size estimation.
 */
-   usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) +
+   usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
   (2 * (resource_size(_res) / drmem_lmb_size(;
return (unsigned int)(usm_entries * sizeof(u64));
  }


Re: [PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2022-12-16 Thread Sourabh Jain



On 16/12/22 11:45, Hari Bathini wrote:



On 15/12/22 2:08 pm, 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"

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 


Thanks for the fix, Sourabh. Looks good to me.

Acked-by: Hari Bathini 


Thanks Hari.

- Sourabh Jain



Re: [PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2022-12-15 Thread Hari Bathini




On 15/12/22 2:08 pm, 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"

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 


Thanks for the fix, Sourabh. Looks good to me.

Acked-by: Hari Bathini 


---
  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 349a781cea0b3..2c3fd6fe6bc94 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -947,7 +947,7 @@ unsigned int kexec_extra_fdt_size_ppc64(struct kimage 
*image)
 * linux,drconf-usable-memory properties. Get an approximate on the
 * number of usable memory entries and use for FDT size estimation.
 */
-   usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) +
+   usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
   (2 * (resource_size(_res) / drmem_lmb_size(;
return (unsigned int)(usm_entries * sizeof(u64));
  }


[PATCH] powerpc/kexec_file: account hot-pluggable memory while estimating FDT size

2022-12-15 Thread Sourabh Jain
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 
---
 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 349a781cea0b3..2c3fd6fe6bc94 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -947,7 +947,7 @@ unsigned int kexec_extra_fdt_size_ppc64(struct kimage 
*image)
 * linux,drconf-usable-memory properties. Get an approximate on the
 * number of usable memory entries and use for FDT size estimation.
 */
-   usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) +
+   usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
   (2 * (resource_size(_res) / drmem_lmb_size(;
return (unsigned int)(usm_entries * sizeof(u64));
 }
-- 
2.38.1