From nobody Thu Sep 24 12:54:03 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3208943C058 for ; Thu, 24 Sep 2026 07:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790236716; cv=none; b=CqVUFAARNsusXLyQTRelGqp95gxyUoKjOSiq8kfYWOxXfMgf5EtDrzaGCJO9IXiLF11w6CwihNDZ7cQiIh1vba9qfX7u6m3dRMbE+GHF5plrBvwBByk+z1OKdrLQgiNjnxwSU8cqpx2PAbGsj/YIgrXU73xNWG0W0E/09bzBl/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790236716; c=relaxed/simple; bh=2i+pUx8Jx0VbFvLQtBDLV1pztcH4yhr2KxIwlmbPzUw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GqfvWWBk7yXRhoCW8Lf2Vj+ghurxbZqyvfQJSCOdeGCeCwVU4SkNb3jG2qPodhO+bD04taHXtpzrDIwXImhIvf0L4W+sRUngHJ5HSu5OxUFrTe0wd07E0v+DfXBCRPua5HYVyNsknW80LgJ5FSlQVsRr8tBlmO9K4y6yNtt9Bv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: b6d53262b7ed11f19a56ed5b684f684d-20260924 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NAME, IP_TRUSTED, SRC_TRUSTED, SA_UNTRUSTED, SA_UNFAMILIAR SN_UNTRUSTED, SN_UNFAMILIAR, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS CIE_BAD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO, GTI_C_BU AMN_GOOD, ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:cb111aff-4125-417d-a602-48041cbe1fbe,IP:20, URL:0,TC:0,Content:-5,EDM:-20,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:-5 X-CID-INFO: VERSION:1.3.19,REQID:cb111aff-4125-417d-a602-48041cbe1fbe,IP:20,UR L:0,TC:0,Content:-5,EDM:-20,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-5 X-CID-META: VersionHash:7db8b62,CLOUDID:feb0b3b7ee6932ed16d02d9d7988ff3e,BulkI D:260924155827EAH3VYUG,BulkQuantity:0,SF:19|38|66|72|78|81|82|102|127|136| 850|865|898,TC:nil,Content:0|15|50|99,EDM:-19|2|-100,IP:-2,URL:0,File:nil, RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,D KP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FSD X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: b6d53262b7ed11f19a56ed5b684f684d-20260924 X-User: lianyangyang@kylinos.cn Received: from localhost.localdomain [(39.156.73.11)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1967902563; Thu, 24 Sep 2026 15:58:22 +0800 From: Yangyang Lian To: Andrew Morton , Baoquan He , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Huacai Chen Cc: Dave Young , WANG Xuerui , kexec@lists.infradead.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Yangyang Lian , Haoran Jiang , Tao Cui , George Guo Subject: [PATCH v2] LoongArch: kdump: add arch_crash_save_vmcoreinfo() support Date: Thu, 24 Sep 2026 15:56:55 +0800 Message-Id: <20260924075655.375632-1-lianyangyang@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260923060349.146780-1-lianyangyang@kylinos.cn> References: <20260923060349.146780-1-lianyangyang@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since commit 23c85094fe18 ("proc/kcore: add vmcoreinfo note to /proc/kcore") the kernel has exported the vmcoreinfo PT_NOTE on /proc/kcore as wellas /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 the module and vmemmap ranges, VA_BITS, or the KASLR offset of a LoongArch dump. Since commit 18210a104bb9 ("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 Suggested-by: Haoran Jiang Tested-by: Tao Cui Co-developed-by: George Guo Signed-off-by: George Guo Signed-off-by: Yangyang Lian --- V2 -> V1: Export VMEMMAP_END + 1 to make it an exclusive bound, matching what tools like makedumpfile expect. Add Tested-by tag from Tao Cui. .../admin-guide/kdump/vmcoreinfo.rst | 29 +++++++++++++++++++ arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/vmcore_info.c | 21 ++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 arch/loongarch/kernel/vmcore_info.c diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation= /admin-guide/kdump/vmcoreinfo.rst index 7663c610fe90..2ff921232616 100644 --- a/Documentation/admin-guide/kdump/vmcoreinfo.rst +++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst @@ -594,3 +594,32 @@ va_kernel_pa_offset =20 Indicates the offset between the kernel virtual and physical mappings. Used to translate virtual to physical addresses. + +LOONGARCH64 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +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. + +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 arra= y. diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makefile index 001924877772..6260c15adaba 100644 --- a/arch/loongarch/kernel/Makefile +++ b/arch/loongarch/kernel/Makefile @@ -64,6 +64,7 @@ obj-$(CONFIG_RELOCATABLE) +=3D relocate.o obj-$(CONFIG_KEXEC_CORE) +=3D machine_kexec.o relocate_kernel.o obj-$(CONFIG_KEXEC_FILE) +=3D machine_kexec_file.o kexec_efi.o kexec_elf.o obj-$(CONFIG_CRASH_DUMP) +=3D crash_dump.o +obj-$(CONFIG_VMCORE_INFO) +=3D vmcore_info.o =20 obj-$(CONFIG_UNWINDER_GUESS) +=3D unwind_guess.o obj-$(CONFIG_UNWINDER_PROLOGUE) +=3D unwind_prologue.o diff --git a/arch/loongarch/kernel/vmcore_info.c b/arch/loongarch/kernel/vm= core_info.c new file mode 100644 index 000000000000..fb703b716253 --- /dev/null +++ b/arch/loongarch/kernel/vmcore_info.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include +#include +#include + +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)=3D0x%lx\n", VMALLOC_END); +#ifdef CONFIG_64BIT + vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=3D0x%lx\n", MODULES_VADDR); + vmcoreinfo_append_str("NUMBER(MODULES_END)=3D0x%lx\n", MODULES_END); + vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=3D0x%lx\n", (unsigned long)v= memmap); + vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=3D0x%lx\n", VMEMMAP_END + 1); +#endif + vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=3D0x%lx\n", PHYS_OFFSET); + vmcoreinfo_append_str("KERNELOFFSET=3D%lx\n", kaslr_offset()); +} --=20 2.25.1