Skip to contentSkip to conversation

riscv: Export va_kernel_pa_offset in vmcoreinfo

PATCH RESEND Applied Song Shuai 5 participants 7 messages Jul 24, 2023 – Aug 3, 2023

Subsystems (5)
lore
Share & tools
lore

Song Shuai

author
#0 lore raw

PATCH RESEND 1/2 riscv: Export va_kernel_pa_offset in vmcoreinfo

Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes phys_ram_base from the physical start of the kernel to the actual start of the DRAM.

The Crash-utility's VTOP() still uses phys_ram_base and kernel_map.virt_addr to translate kernel virtual address, that failed the Crash with Linux v6.4 [1].

Export kernel_map.va_kernel_pa_offset in vmcoreinfo to help Crash translate the kernel virtual address correctly.

Fixes 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
---
 arch/riscv/kernel/crash_core.c | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/kernel/crash_core.c +2 -0
index b351a3c01355..55f1d7856b54 100644
@@ -18,4 +18,6 @@ void arch_crash_save_vmcoreinfo(void)
 	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
 #endif
 	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
+	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
+						kernel_map.va_kernel_pa_offset);
 }
Signature · 7 lines
2.20.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author
#1 lore raw

PATCH RESEND 2/2 Documentation: kdump: Add va_kernel_pa_offset for RISCV64

RISC-V Linux exports "va_kernel_pa_offset" in vmcoreinfo to help Crash-utility translate the kernel virtual address correctly.

Here adds the definition of "va_kernel_pa_offset".

Fixes 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
---
 Documentation/admin-guide/kdump/vmcoreinfo.rst | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/admin-guide/kdump/vmcoreinfo.rst +6 -0
index c18d94fa6470..f8ebb63b6c5d 100644
@@ -624,3 +624,9 @@ Used to get the correct ranges:
   * VMALLOC_START ~ VMALLOC_END : vmalloc() / ioremap() space.
   * VMEMMAP_START ~ VMEMMAP_END : vmemmap space, used for struct page array.
   * KERNEL_LINK_ADDR : start address of Kernel link and BPF
+
+va_kernel_pa_offset
+-------------------
+
+Indicates the offset between the kernel virtual and physical mappings.
+Used to translate virtual to physical addresses.
Signature · 7 lines
2.20.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
reviewer Reviewed-by on v1 2/2
#2 lore raw

Re: [RESEND PATCH -fixes 2/2] Documentation: kdump: Add va_kernel_pa_offset for RISCV64

Quoted 17 lines · Song Shuai

RISC-V Linux exports "va_kernel_pa_offset" in vmcoreinfo to help Crash-utility translate the kernel virtual address correctly.

Here adds the definition of "va_kernel_pa_offset".

Fixes 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
---
  Documentation/admin-guide/kdump/vmcoreinfo.rst | 6 ++++++
  1 file changed, 6 insertions(+)
Documentation/admin-guide/kdump/vmcoreinfo.rst +0 -0
index c18d94fa6470..f8ebb63b6c5d 100644

Documentation/admin-guide/kdump/vmcoreinfo.rst Used to get the correct ranges: · line 632

Quoted 9 lines
Documentation/admin-guide/kdump/vmcoreinfo.rst +6 -0
@@ -624,3 +624,9 @@ Used to get the correct ranges:
    * VMALLOC_START ~ VMALLOC_END : vmalloc() / ioremap() space.
    * VMEMMAP_START ~ VMEMMAP_END : vmemmap space, used for struct page array.
    * KERNEL_LINK_ADDR : start address of Kernel link and BPF
+
+va_kernel_pa_offset
+-------------------
+
+Indicates the offset between the kernel virtual and physical mappings.
+Used to translate virtual to physical addresses.

You can add:

Thanks,

Alex

Reviewed-by on v1 1/2
#3 lore raw
In reply to Song Shuai
Quoted 22 lines · Song Shuai

Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes phys_ram_base from the physical start of the kernel to the actual start of the DRAM.

The Crash-utility's VTOP() still uses phys_ram_base and kernel_map.virt_addr to translate kernel virtual address, that failed the Crash with Linux v6.4 [1].

Export kernel_map.va_kernel_pa_offset in vmcoreinfo to help Crash translate the kernel virtual address correctly.

Fixes 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
---
  arch/riscv/kernel/crash_core.c | 2 ++
  1 file changed, 2 insertions(+)
arch/riscv/kernel/crash_core.c +0 -0
index b351a3c01355..55f1d7856b54 100644

arch/riscv/kernel/crash_core.c void arch_crash_save_vmcoreinfo(void) · line 23

Quoted 6 lines
arch/riscv/kernel/crash_core.c +2 -0
@@ -18,4 +18,6 @@ void arch_crash_save_vmcoreinfo(void)
  	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
  #endif
  	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
+	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
+						kernel_map.va_kernel_pa_offset);
  }
reviewer Reviewed-by on v1 1/2
#4 lore raw
In reply to Song Shuai

Hi Song,

Quoted 22 lines · Song Shuai

Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes phys_ram_base from the physical start of the kernel to the actual start of the DRAM.

The Crash-utility's VTOP() still uses phys_ram_base and kernel_map.virt_addr to translate kernel virtual address, that failed the Crash with Linux v6.4 [1].

Export kernel_map.va_kernel_pa_offset in vmcoreinfo to help Crash translate the kernel virtual address correctly.

Fixes 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
---
  arch/riscv/kernel/crash_core.c | 2 ++
  1 file changed, 2 insertions(+)
arch/riscv/kernel/crash_core.c +0 -0
index b351a3c01355..55f1d7856b54 100644

arch/riscv/kernel/crash_core.c void arch_crash_save_vmcoreinfo(void) · line 23

Quoted 6 lines
arch/riscv/kernel/crash_core.c +2 -0
@@ -18,4 +18,6 @@ void arch_crash_save_vmcoreinfo(void)
  	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
  #endif
  	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
+	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
+						kernel_map.va_kernel_pa_offset);
  }

You can add:

Thanks for that and for the instructions on how to reproduce the problem BTW!

Alex

#5 lore raw
In reply to Song Shuai
This series was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This series was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Mon, 24 Jul 2023 18:09:16 +0800 you wrote:

Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes phys_ram_base from the physical start of the kernel to the actual start of the DRAM.

The Crash-utility's VTOP() still uses phys_ram_base and kernel_map.virt_addr to translate kernel virtual address, that failed the Crash with Linux v6.4 [1].

[...]

Here is the summary with links:
- [RESEND,-fixes,1/2] riscv: Export va_kernel_pa_offset in vmcoreinfo

    https://git.kernel.org/riscv/c/fbe7d19d2b7f
  - [RESEND,-fixes,2/2] Documentation: kdump: Add va_kernel_pa_offset for RISCV64
    https://git.kernel.org/riscv/c/640c503d7dbd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#6 lore raw
In reply to Song Shuai
Quoted 8 lines · Song Shuai

Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes phys_ram_base from the physical start of the kernel to the actual start of the DRAM.

The Crash-utility's VTOP() still uses phys_ram_base and kernel_map.virt_addr to translate kernel virtual address, that failed the Crash with Linux v6.4 [1].

[...]

Applied, thanks!

[1/2] riscv: Export va_kernel_pa_offset in vmcoreinfo

      https://git.kernel.org/palmer/c/fbe7d19d2b7f
[2/2] Documentation: kdump: Add va_kernel_pa_offset for RISCV64
      https://git.kernel.org/palmer/c/640c503d7dbd

Best regards,

Signature · 1 line
Palmer Dabbelt <[email protected]>