Skip to contentSkip to conversation

arm64/crashdump-arm64: align 'Kernel code' with '_stext'

PATCH In review Pingfan Liu 2 participants 3 messages May 19, 2021 – May 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/crashdump-arm64: align 'Kernel code' with '_stext'

Since kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from permanent kernel mapping"), the physical address of 'Kernel code' in /proc/iomem is mapped from _text, instead, from _stext.

Change the code to cope with this kernel change.

---
 kexec/arch/arm64/crashdump-arm64.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
kexec/arch/arm64/crashdump-arm64.c +5 -1
index 38d1a0f..1da663e 100644
@@ -148,7 +148,11 @@ static int crash_get_memory_ranges(void)
 	 * For additional kernel code/data segment.
 	 * kern_paddr_start/kern_size are determined in iomem_range_callback
 	 */
-	elf_info.kern_vaddr_start = get_kernel_sym("_text");
+	/* Refer to kernel:
+	 *     kernel_code.start   = __pa_symbol(_stext);
+	 * which is exported through /proc/iomem as "Kernel code"
+	 */
+	elf_info.kern_vaddr_start = get_kernel_sym("_stext");
 	if (!elf_info.kern_vaddr_start)
 		elf_info.kern_vaddr_start = UINT64_MAX;
 
Signature · 7 lines
2.29.2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 7 lines · Pingfan Liu

Since kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from permanent kernel mapping"), the physical address of 'Kernel code' in /proc/iomem is mapped from _text, instead, from _stext.

Change the code to cope with this kernel change.

Thanks, will kexec still work with older kernels with this change in place?

Quoted 30 lines
---
 kexec/arch/arm64/crashdump-arm64.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
kexec/arch/arm64/crashdump-arm64.c +5 -1
index 38d1a0f..1da663e 100644
@@ -148,7 +148,11 @@ static int crash_get_memory_ranges(void)
 	 * For additional kernel code/data segment.
 	 * kern_paddr_start/kern_size are determined in iomem_range_callback
 	 */
-	elf_info.kern_vaddr_start = get_kernel_sym("_text");
+	/* Refer to kernel:
+	 *     kernel_code.start   = __pa_symbol(_stext);
+	 * which is exported through /proc/iomem as "Kernel code"
+	 */
+	elf_info.kern_vaddr_start = get_kernel_sym("_stext");
 	if (!elf_info.kern_vaddr_start)
 		elf_info.kern_vaddr_start = UINT64_MAX;
 
Signature · 7 lines
2.29.2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#2 lore raw
Quoted 11 lines · Simon Horman
Quoted 7 lines · Pingfan Liu

Since kernel commit e2a073dde921 ("arm64: omit [_text, _stext) from permanent kernel mapping"), the physical address of 'Kernel code' in /proc/iomem is mapped from _text, instead, from _stext.

Change the code to cope with this kernel change.

Thanks, will kexec still work with older kernels with this change in place?

Oops, it will. Let me try to bring up another idea to tackle it.

Thanks,
Pingfan

Quoted 25 lines
Quoted 25 lines
---
  kexec/arch/arm64/crashdump-arm64.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
kexec/arch/arm64/crashdump-arm64.c +5 -1
index 38d1a0f..1da663e 100644
@@ -148,7 +148,11 @@ static int crash_get_memory_ranges(void)
  	 * For additional kernel code/data segment.
  	 * kern_paddr_start/kern_size are determined in iomem_range_callback
  	 */
-	elf_info.kern_vaddr_start = get_kernel_sym("_text");
+	/* Refer to kernel:
+	 *     kernel_code.start   = __pa_symbol(_stext);
+	 * which is exported through /proc/iomem as "Kernel code"
+	 */
+	elf_info.kern_vaddr_start = get_kernel_sym("_stext");
  	if (!elf_info.kern_vaddr_start)
  		elf_info.kern_vaddr_start = UINT64_MAX;
 
Signature · 1 line
2.29.2
Quoted 6 lines
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec