mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
LoongArch: Add arch_crash_save_vmcoreinfo() support
Since commit23c85094fe("proc/kcore: add vmcoreinfo note to /proc/ kcore") the kernel has exported the vmcoreinfo PT_NOTE on /proc/kcore as well as /proc/vmcore. LoongArch does not provide arch_crash_save_vmcoreinfo(), so the arch- specific values are missing from the vmcoreinfo PT_NOTE. The generic exporter in kernel/vmcore_info.c already provides NUMBER(VMALLOC_START), but tools like crash cannot derive VMALLOC_END, the module and vmemmap ranges, VA_BITS, or the KASLR offset of a LoongArch dump. Since commit18210a104b("LoongArch: Expand module virtual address space to 2GB") the vmalloc and module boundaries are no longer stable across kernel versions either, so vmcoreinfo is the only reliable source for them. Provide this function in a separate file that is built at the same time as its caller in kernel/vmcore_info.c, and add a LOONGARCH64 section to Documentation/admin-guide/kdump/vmcoreinfo.rst. Reported-by: Haoran Jiang <jianghaoran@kylinos.cn> Suggested-by: Haoran Jiang <jianghaoran@kylinos.cn> Tested-by: Tao Cui <cuitao@kylinos.cn> Co-developed-by: George Guo <guodongtai@kylinos.cn> Signed-off-by: George Guo <guodongtai@kylinos.cn> Signed-off-by: Yangyang Lian <lianyangyang@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
5e0b00fd00
commit
2a5ec3a553
|
|
@ -594,3 +594,39 @@ va_kernel_pa_offset
|
|||
|
||||
Indicates the offset between the kernel virtual and physical mappings.
|
||||
Used to translate virtual to physical addresses.
|
||||
|
||||
LOONGARCH64
|
||||
===========
|
||||
|
||||
VA_BITS
|
||||
-------
|
||||
|
||||
The maximum number of bits for virtual addresses. Used to compute the
|
||||
virtual memory ranges.
|
||||
|
||||
PHYS_OFFSET
|
||||
-----------
|
||||
|
||||
Indicates the physical address of the start of memory. Used to translate
|
||||
virtual to physical addresses.
|
||||
|
||||
PAGE_OFFSET
|
||||
-----------
|
||||
|
||||
Indicates the virtual kernel start address of the direct-mapped RAM region.
|
||||
Used together with PHYS_OFFSET to translate between virtual and physical
|
||||
addresses.
|
||||
|
||||
KERNELOFFSET
|
||||
------------
|
||||
|
||||
The kernel randomization offset. Used to locate the kernel text in virtual
|
||||
memory. If KASLR is disabled, this value is zero.
|
||||
|
||||
MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Used to get the correct ranges:
|
||||
MODULES_VADDR ~ MODULES_END-1 : Kernel module space.
|
||||
VMALLOC_START ~ VMALLOC_END-1 : vmalloc() / ioremap() space.
|
||||
VMEMMAP_START ~ VMEMMAP_END-1 : vmemmap region, used for struct page array.
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ obj-$(CONFIG_RELOCATABLE) += relocate.o
|
|||
obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o
|
||||
obj-$(CONFIG_KEXEC_FILE) += machine_kexec_file.o kexec_efi.o kexec_elf.o
|
||||
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
|
||||
obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o
|
||||
|
||||
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
|
||||
obj-$(CONFIG_UNWINDER_PROLOGUE) += unwind_prologue.o
|
||||
|
|
|
|||
22
arch/loongarch/kernel/vmcore_info.c
Normal file
22
arch/loongarch/kernel/vmcore_info.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/vmcore_info.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
void arch_crash_save_vmcoreinfo(void)
|
||||
{
|
||||
VMCOREINFO_NUMBER(VA_BITS);
|
||||
/* NUMBER(VMALLOC_START) is exported by the generic code */
|
||||
vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_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);
|
||||
vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", (unsigned long)vmemmap);
|
||||
vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END + 1);
|
||||
#endif
|
||||
vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%lx\n", PHYS_OFFSET);
|
||||
vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
|
||||
vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user