diff mbox series

[1/2] RISC-V: Use linux,usable-memory-range for crash kernel

Message ID 20230811104117.91406-1-songshuaishuai@tinylab.org (mailing list archive)
State Changes Requested
Headers show
Series [1/2] RISC-V: Use linux,usable-memory-range for crash kernel | expand

Checks

Context Check Description
conchuod/tree_selection fail Failed to apply to next/pending-fixes, riscv/for-next or riscv/master

Commit Message

Song Shuai Aug. 11, 2023, 10:41 a.m. UTC
Now we use "memeory::linux,usable-memory" to indicate the available
memory for the crash kernel.

While booting with UEFI, the crash kernel would use efi.memmap to
re-populate memblock and then first kernel's memory would be corrputed.
Consequently, the /proc/vmcore file failed to create in my local test.

And according to "chosen" dtschema [1], the available memory for the
crash kernel should be held via "chosen::linux,usable-memory-range"
property which will re-cap memblock even after UEFI's re-population.

[1]:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/chosen.yaml

Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
---
 kexec/arch/riscv/kexec-riscv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Conor Dooley Aug. 14, 2023, 11:10 a.m. UTC | #1
On Fri, Aug 11, 2023 at 06:41:16PM +0800, Song Shuai wrote:
> Now we use "memeory::linux,usable-memory" to indicate the available
> memory for the crash kernel.
> 
> While booting with UEFI, the crash kernel would use efi.memmap to
> re-populate memblock and then first kernel's memory would be corrputed.
> Consequently, the /proc/vmcore file failed to create in my local test.
> 
> And according to "chosen" dtschema [1], the available memory for the
> crash kernel should be held via "chosen::linux,usable-memory-range"
> property which will re-cap memblock even after UEFI's re-population.
> 
> [1]:
> https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/chosen.yaml

nit: Please use Link: tags for links rather than free-form text.

This doesn't apply to fixes, for-next or master. What is your base?

> 
> Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
> ---
>  kexec/arch/riscv/kexec-riscv.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kexec/arch/riscv/kexec-riscv.c b/kexec/arch/riscv/kexec-riscv.c
> index fe5dd2d..5aea035 100644
> --- a/kexec/arch/riscv/kexec-riscv.c
> +++ b/kexec/arch/riscv/kexec-riscv.c
> @@ -79,20 +79,20 @@ int load_extra_segments(struct kexec_info *info, uint64_t kernel_base,
>  		}
>  
>  		ret = dtb_add_range_property(&fdt->buf, &fdt->size, start, end,
> -					     "memory", "linux,usable-memory");
> +					     "chosen", "linux,usable-memory-range");
>  		if (ret) {
> -			fprintf(stderr, "Couldn't add usable-memory to fdt\n");
> +			fprintf(stderr, "Couldn't add usable-memory-range to fdt\n");
>  			return ret;
>  		}
>  
>  		max_usable = end;
>  	} else {
>  		/*
> -		 * Make sure we remove elfcorehdr and usable-memory
> +		 * Make sure we remove elfcorehdr and usable-memory-range
>  		 * when switching from crash kernel to a normal one.
>  		 */
>  		dtb_delete_property(fdt->buf, "chosen", "linux,elfcorehdr");
> -		dtb_delete_property(fdt->buf, "memory", "linux,usable-memory");
> +		dtb_delete_property(fdt->buf, "chosen", "linux,usable-memory-range");
>  	}
>  
>  	/* Do we need to include an initrd image ? */
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
diff mbox series

Patch

diff --git a/kexec/arch/riscv/kexec-riscv.c b/kexec/arch/riscv/kexec-riscv.c
index fe5dd2d..5aea035 100644
--- a/kexec/arch/riscv/kexec-riscv.c
+++ b/kexec/arch/riscv/kexec-riscv.c
@@ -79,20 +79,20 @@  int load_extra_segments(struct kexec_info *info, uint64_t kernel_base,
 		}
 
 		ret = dtb_add_range_property(&fdt->buf, &fdt->size, start, end,
-					     "memory", "linux,usable-memory");
+					     "chosen", "linux,usable-memory-range");
 		if (ret) {
-			fprintf(stderr, "Couldn't add usable-memory to fdt\n");
+			fprintf(stderr, "Couldn't add usable-memory-range to fdt\n");
 			return ret;
 		}
 
 		max_usable = end;
 	} else {
 		/*
-		 * Make sure we remove elfcorehdr and usable-memory
+		 * Make sure we remove elfcorehdr and usable-memory-range
 		 * when switching from crash kernel to a normal one.
 		 */
 		dtb_delete_property(fdt->buf, "chosen", "linux,elfcorehdr");
-		dtb_delete_property(fdt->buf, "memory", "linux,usable-memory");
+		dtb_delete_property(fdt->buf, "chosen", "linux,usable-memory-range");
 	}
 
 	/* Do we need to include an initrd image ? */