Support VMCOREINFO export for RISCV64
Subsystems (5)
v5 cover Support VMCOREINFO export for RISCV64
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/
As others patches in above patch set already applied, so this patch set only contains below two patches.
------
Changes:
Fix commit message in patch 2: use "Document these RISCV64 exports above" instead of "This patch just add the description of VMCOREINFO export for RISCV64."
V1 -> V2:
Remove unnecessary overline above header text in patch 2.
V2 -> V3:
Fix commit message in patch 1,2;
Use 'space' instead of 'region' for vmemmap description in patch 2.
V3 -> V4:
Remove unnecessary kernel space export:
KASAN_SHADOW_START ~ KASAN_SHADOW_END,
ADDRESS_SPACE_END
V4 -> V5:
Remove IS_ENABLED() judgement for KERNEL_LINK_ADDR in patch 1.
Xianting Tian (2):
RISC-V: Add arch_crash_save_vmcoreinfo support
Documentation: kdump: describe VMCOREINFO export for RISCV64
.../admin-guide/kdump/vmcoreinfo.rst | 29 +++++++++++++++++++ arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/crash_core.c | 21 ++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 arch/riscv/kernel/crash_core.c
Signature · 1 line
2.17.1
PATCH v5 1/2 RISC-V: Add arch_crash_save_vmcoreinfo support
Add arch_crash_save_vmcoreinfo(), which exports VM layout(MODULES, VMALLOC, VMEMMAP ranges and KERNEL_LINK_ADDR), va bits and ram base for vmcore.
Default pagetable levels and PAGE_OFFSET aren't same for different kernel version as below. For pagetable levels, it sets sv57 by default and falls back to setting sv48 at boot time if sv57 is not supported by the hardware.
For ram base, the default value is 0x80200000 for qemu riscv64 env and, for example, is 0x200000 on the XuanTie 910 CPU.
* Linux Kernel 5.18 ~
* PGTABLE_LEVELS = 5
* PAGE_OFFSET = 0xff60000000000000
* Linux Kernel 5.17 ~
* PGTABLE_LEVELS = 4
* PAGE_OFFSET = 0xffffaf8000000000
* Linux Kernel 4.19 ~
* PGTABLE_LEVELS = 3
* PAGE_OFFSET = 0xffffffe000000000
Since these configurations change from time to time and version to version, it is preferable to export them via vmcoreinfo than to change the crash's code frequently, it can simplify the development of crash tool.
--- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/crash_core.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 arch/riscv/kernel/crash_core.c
arch/riscv/kernel/Makefile +1 -0
@@ -81,6 +81,7 @@ obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o +obj-$(CONFIG_CRASH_CORE) += crash_core.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o
arch/riscv/kernel/crash_core.c new file +21 -0
@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/crash_core.h> +#include <linux/pagemap.h> + +void arch_crash_save_vmcoreinfo (void ) +{ +VMCOREINFO_NUMBER (VA_BITS ); +VMCOREINFO_NUMBER (phys_ram_base); + +vmcoreinfo_append_str ("NUMBER(PAGE_OFFSET)=0x%lx\n" ,PAGE_OFFSET ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_START)=0x%lx\n" ,VMALLOC_START ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_END)=0x%lx\n" ,VMALLOC_END ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_START)=0x%lx\n" ,VMEMMAP_START ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_END)=0x%lx\n" ,VMEMMAP_END ); +#ifdef CONFIG_64BIT +vmcoreinfo_append_str ("NUMBER(MODULES_VADDR)=0x%lx\n" ,MODULES_VADDR ); +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 ); +}
Signature · 1 line
2.17.1
Re: [PATCH V5 1/2] RISC-V: Add arch_crash_save_vmcoreinfo support
Quoted 73 lines · Xianting Tian
Add
arch_crash_save_vmcoreinfo(), which exports VMlayout(MODULES, VMALLOC, VMEMMAP ranges and KERNEL_LINK_ADDR), va bits and ram base for vmcore.Default pagetable levels and
PAGE_OFFSETaren't same for different kernel version as below. For pagetable levels, it sets sv57 by default and falls back to setting sv48 at boot time if sv57 is not supported by the hardware.For ram base, the default value is
0x80200000for qemu riscv64 env and, for example, is0x200000on the XuanTie 910 CPU.* Linux Kernel 5.18 ~
*PGTABLE_LEVELS= 5
*PAGE_OFFSET=0xff60000000000000
* Linux Kernel 5.17 ~
*PGTABLE_LEVELS= 4
*PAGE_OFFSET=0xffffaf8000000000
* Linux Kernel 4.19 ~
*PGTABLE_LEVELS= 3
*PAGE_OFFSET=0xffffffe000000000Since these configurations change from time to time and version to version, it is preferable to export them via vmcoreinfo than to change the crash's code frequently, it can simplify the development of crash tool.
Signed-off-by Xianting Tian <[email protected]>---
arch/riscv/kernel/Makefile| 1 +arch/riscv/kernel/crash_core.c| 21 +++++++++++++++++++++2 files changed, 22 insertions(+)create mode 100644
arch/riscv/kernel/crash_core.carch/riscv/kernel/Makefile +0
-0@@ -81,6 +81,7 @@ obj-$(CONFIG_KGDB) += kgdb.oobj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o
obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
+obj-$(CONFIG_CRASH_CORE) += crash_core.oobj-$(CONFIG_JUMP_LABEL) += jump_label.o
arch/riscv/kernel/crash_core.c new file +21
-0@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/crash_core.h> +#include <linux/pagemap.h> + +void arch_crash_save_vmcoreinfo (void ) +{ +VMCOREINFO_NUMBER (VA_BITS ); +VMCOREINFO_NUMBER (phys_ram_base); + +vmcoreinfo_append_str ("NUMBER(PAGE_OFFSET)=0x%lx\n" ,PAGE_OFFSET ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_START)=0x%lx\n" ,VMALLOC_START ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_END)=0x%lx\n" ,VMALLOC_END ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_START)=0x%lx\n" ,VMEMMAP_START ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_END)=0x%lx\n" ,VMEMMAP_END ); +#ifdef CONFIG_64BIT +vmcoreinfo_append_str ("NUMBER(MODULES_VADDR)=0x%lx\n" ,MODULES_VADDR ); +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 ); +}Signature · 1 line
2.17.1
I had been looking around to play around with crash-utility.
Applied v5 patches, triggered a crash and have been able to use crash tool with commands like vtop/bt.
Thanks
debug
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V5 1/2] RISC-V: Add arch_crash_save_vmcoreinfo support
In reply to Xianting TianQuoted 74 lines · Xianting Tian
Add
arch_crash_save_vmcoreinfo(), which exports VMlayout(MODULES, VMALLOC, VMEMMAP ranges and KERNEL_LINK_ADDR), va bits and ram base for vmcore.Default pagetable levels and
PAGE_OFFSETaren't same for different kernel version as below. For pagetable levels, it sets sv57 by default and falls back to setting sv48 at boot time if sv57 is not supported by the hardware.For ram base, the default value is
0x80200000for qemu riscv64 env and, for example, is0x200000on the XuanTie 910 CPU.* Linux Kernel 5.18 ~
*PGTABLE_LEVELS= 5
*PAGE_OFFSET=0xff60000000000000
* Linux Kernel 5.17 ~
*PGTABLE_LEVELS= 4
*PAGE_OFFSET=0xffffaf8000000000
* Linux Kernel 4.19 ~
*PGTABLE_LEVELS= 3
*PAGE_OFFSET=0xffffffe000000000Since these configurations change from time to time and version to version, it is preferable to export them via vmcoreinfo than to change the crash's code frequently, it can simplify the development of crash tool.
Signed-off-by Xianting Tian <[email protected]>--- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/crash_core.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 arch/riscv/kernel/crash_core.carch/riscv/kernel/Makefile +1
-0@@ -81,6 +81,7 @@ obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o obj-$(CONFIG_CRASH_DUMP) += crash_dump.o +obj-$(CONFIG_CRASH_CORE) += crash_core.o obj-$(CONFIG_JUMP_LABEL) += jump_label.oarch/riscv/kernel/crash_core.c new file +21
-1@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/crash_core.h> +#include <linux/pagemap.h> + +void arch_crash_save_vmcoreinfo (void ) +{ +VMCOREINFO_NUMBER (VA_BITS ); +VMCOREINFO_NUMBER (phys_ram_base); + +vmcoreinfo_append_str ("NUMBER(PAGE_OFFSET)=0x%lx\n" ,PAGE_OFFSET ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_START)=0x%lx\n" ,VMALLOC_START ); +vmcoreinfo_append_str ("NUMBER(VMALLOC_END)=0x%lx\n" ,VMALLOC_END ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_START)=0x%lx\n" ,VMEMMAP_START ); +vmcoreinfo_append_str ("NUMBER(VMEMMAP_END)=0x%lx\n" ,VMEMMAP_END ); +#ifdef CONFIG_64BIT +vmcoreinfo_append_str ("NUMBER(MODULES_VADDR)=0x%lx\n" ,MODULES_VADDR ); +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 ); +} --2.17.1
Signature · 2 lines
Best Regards Guo Ren
PATCH v5 2/2 Documentation: kdump: describe VMCOREINFO export for RISCV64
In reply to Xianting TianThe following interrelated definitions and ranges are needed by the kdump crash tool, which are exported by "arch/riscv/kernel/crash_core.c":
VA_BITS,
PAGE_OFFSET,
phys_ram_base,
KERNEL_LINK_ADDR,
MODULES_VADDR ~ MODULES_END,
VMALLOC_START ~ VMALLOC_END,
VMEMMAP_START ~ VMEMMAP_END,
Document these RISCV64 exports above.
--- .../admin-guide/kdump/vmcoreinfo.rst | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+)
Documentation/admin-guide/kdump/vmcoreinfo.rst +29 -0
@@ -595,3 +595,32 @@ X2TLB ----- Indicates whether the crashed kernel enabled SH extended mode. + +RISCV64 +======= + +VA_BITS +------- + +The maximum number of bits for virtual addresses. Used to compute the +virtual memory ranges. + +PAGE_OFFSET +----------- + +Indicates the virtual kernel start address of the direct-mapped RAM region. + +phys_ram_base +------------- + +Indicates the start physical RAM address. + +MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END|KERNEL_LINK_ADDR +---------------------------------------------------------------------------------------------- + +Used to get the correct ranges: + + * MODULES_VADDR ~ MODULES_END : Kernel module space. + * 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
Signature · 1 line
2.17.1
Quoted 7 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Quoted 15 lines
------
Changes:
Fix commit message in patch 2: use "Document these RISCV64 exports above" instead of "This patch just add the description of VMCOREINFO export for RISCV64."
V1 -> V2:
Remove unnecessary overline above header text in patch 2.
V2 -> V3:
Fix commit message in patch 1,2;
Use 'space' instead of 'region' for vmemmap description in patch 2.
V3 -> V4:
Remove unnecessary kernel space export:
KASAN_SHADOW_START~KASAN_SHADOW_END,
ADDRESS_SPACE_END
V4 -> V5:
RemoveIS_ENABLED()judgement forKERNEL_LINK_ADDRin patch 1.
This series looks good to me, thanks.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi risc-v maintainers,
Quoted 6 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Could you pick this patchset into risc-v tree since it has got acks and two Tested-by?
Thanks
Baoquan
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Palmer Dabbelt
AppliedQuoted 8 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
[...]
Applied, thanks!
[1/2] RISC-V: Add arch_crash_save_vmcoreinfo support
https://git.kernel.org/palmer/c/649d6b1019a2 [2/2] Documentation: kdump: describe VMCOREINFO export for RISCV64 https://git.kernel.org/palmer/c/c5b4216929eb
Best regards,
Signature · 1 line
Palmer Dabbelt <[email protected]>
Hi Palmer,
Here are another two fix-up patches of kdump for the crash tool.
https://lore.kernel.org/linux-riscv/[email protected]/
https://lore.kernel.org/linux-riscv/[email protected]/
Quoted 21 lines · Palmer Dabbelt
Quoted 8 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
[...]
Applied, thanks!
[1/2] RISC-V: Add
arch_crash_save_vmcoreinfosupporthttps://git.kernel.org/palmer/c/649d6b1019a2 [2/2] Documentation: kdump: describe VMCOREINFO export for RISCV64 https://git.kernel.org/palmer/c/c5b4216929ebBest regards,
--
Palmer Dabbelt <[email protected]>
Signature · 2 lines
Best Regards Guo Ren
Hey Palmer, Xianting,
Quoted 8 lines · Palmer Dabbelt
Quoted 7 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] RISC-V: Add
arch_crash_save_vmcoreinfosupporthttps://git.kernel.org/palmer/c/649d6b1019a2
So this patch seems to be causing issues for the nommu build:
https://lore.kernel.org/oe-kbuild-all/[email protected]/
I had a bit of a poke at trying to see if there were some headers we could pull in before actually checking the .config only to see:
# CONFIG_MMU is not set
Do we have to wrap the whole thing in a #ifdef CONFIG_MMU to fix compilation here?
Thanks,
Conor.
Quoted 22 lines · Conor Dooley
Hey Palmer, Xianting,
Quoted 8 lines · Palmer Dabbelt
Quoted 7 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] RISC-V: Add
arch_crash_save_vmcoreinfosupporthttps://git.kernel.org/palmer/c/649d6b1019a2So this patch seems to be causing issues for the nommu build:
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 6 lines
I had a bit of a poke at trying to see if there were some headers we could pull in before actually checking the .config only to see:
#CONFIG_MMUis not setDo we have to wrap the whole thing in a
#ifdef CONFIG_MMUto fix compilation here?
The problem does not belong to the patch.
Could I send a fixup patch? like this?
arch/riscv/Kconfig +1 -0
@@ -512,6 +512,7 @@ config ARCH_HAS_KEXEC_PURGATORY config CRASH_DUMP bool "Build kdump crash kernel" + depends on KEXEC help Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels which are
Quoted 4 lines
Thanks,
Conor.
Signature · 2 lines
Best Regards Guo Ren
Quoted 27 lines · Guo Ren
Quoted 26 lines · Conor Dooley
Hey Palmer, Xianting,
Quoted 8 lines · Palmer Dabbelt
Quoted 7 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] RISC-V: Add
arch_crash_save_vmcoreinfosupporthttps://git.kernel.org/palmer/c/649d6b1019a2So this patch seems to be causing issues for the nommu build:
https://lore.kernel.org/oe-kbuild-all/[email protected]/I had a bit of a poke at trying to see if there were some headers we could pull in before actually checking the .config only to see:
#CONFIG_MMUis not set
Quoted 5 lines
Quoted 2 lines
Do we have to wrap the whole thing in a
#ifdef CONFIG_MMUto fix compilation here?The problem does not belong to the patch.
Could I send a fixup patch? like this?
That seems like a sane dependancy, but did you build that config? This doesn't fix the problem for me :/
Quoted 23 lines
arch/riscv/Kconfig +1
-0@@ -512,6 +512,7 @@ config ARCH_HAS_KEXEC_PURGATORY config CRASH_DUMP bool "Build kdump crash kernel" + depends on KEXEC help Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels which areQuoted 5 lines
Thanks,
Conor.Signature · 2 lines
Best Regards Guo Ren
Quoted 29 lines · Conor Dooley
Quoted 27 lines · Guo Ren
Quoted 26 lines · Conor Dooley
Hey Palmer, Xianting,
Quoted 8 lines · Palmer Dabbelt
Quoted 7 lines · Xianting Tian
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] RISC-V: Add
arch_crash_save_vmcoreinfosupporthttps://git.kernel.org/palmer/c/649d6b1019a2So this patch seems to be causing issues for the nommu build:
https://lore.kernel.org/oe-kbuild-all/[email protected]/I had a bit of a poke at trying to see if there were some headers we could pull in before actually checking the .config only to see:
#CONFIG_MMUis not set
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Do we have to wrap the whole thing in a
#ifdef CONFIG_MMUto fix compilation here?The problem does not belong to the patch.
Could I send a fixup patch? like this?
That seems like a sane dependancy, but did you build that config? This doesn't fix the problem for me :/
Sorry, It's the wrong fixup. Here is the new version, and tested. Thx for the report.
https://lore.kernel.org/linux-riscv/[email protected]/
Quoted 24 lines
Quoted 24 lines
arch/riscv/Kconfig +1
-0@@ -512,6 +512,7 @@ config ARCH_HAS_KEXEC_PURGATORY config CRASH_DUMP bool "Build kdump crash kernel" + depends on KEXEC help Generate crash dump after being started by kexec. This should be normally only set in special crash dump kernels which areQuoted 5 lines
Thanks,
Conor.--
Best Regards
Guo Ren
Signature · 7 lines
Best Regards Guo Ren _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Hello:
This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:
Quoted 8 lines · On Wed, 26 Oct 2022 22:42:06 +0800 you wrote:
As disscussed in below patch set, the patch of 'describe VMCOREINFO export in Documentation' need to update according to Bagas's comments.
https://lore.kernel.org/linux-riscv/[email protected]/As others patches in above patch set already applied, so this patch set only contains below two patches.
[...]
Here is the summary with links:
- [V5,1/2] RISC-V: Add arch_crash_save_vmcoreinfo support
https://git.kernel.org/riscv/c/649d6b1019a2 - [V5,2/2] Documentation: kdump: describe VMCOREINFO export for RISCV64 https://git.kernel.org/riscv/c/c5b4216929eb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html