From: Pnina Feder <pnina.feder@mobileye.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <bhe@redhat.com>, Mike Rapoport <rppt@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>
Cc: Dave Young <ruirui.yang@linux.dev>,
Jonathan Corbet <corbet@lwn.net>, Alexandre Ghiti <alex@ghiti.fr>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-doc@vger.kernel.org, Pnina Feder <pnina.feder@mobileye.com>
Subject: [PATCH 4/4] mips: vmcore_info: export mips arch-specific struct offsets to vmcoreinfo
Date: Tue, 23 Jun 2026 00:14:30 +0300 [thread overview]
Message-ID: <20260622211430.4008899-5-pnina.feder@mobileye.com> (raw)
In-Reply-To: <20260622211430.4008899-1-pnina.feder@mobileye.com>
Export MIPS architecture-specific struct offsets needed by the
vmcore-tasks tool, including signal frame layouts and register
context structures used to reconstruct user-space register state
from a vmcore dump.
Signed-off-by: Pnina Feder <pnina.feder@mobileye.com>
---
.../admin-guide/kdump/vmcoreinfo.rst | 34 +++++++++++++++++++
arch/mips/kernel/Makefile | 1 +
arch/mips/kernel/signal.c | 8 +++++
arch/mips/kernel/vmcore_info.c | 22 ++++++++++++
4 files changed, 65 insertions(+)
create mode 100644 arch/mips/kernel/vmcore_info.c
diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmcoreinfo.rst
index 3c364434b846..4af32ddf5615 100644
--- a/Documentation/admin-guide/kdump/vmcoreinfo.rst
+++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst
@@ -494,6 +494,40 @@ Used to get the vmalloc_start address from the high_memory symbol.
The maximum number of CPUs.
+MIPS
+====
+
+(rt_sigframe, rs_uc)
+--------------------
+
+Offset of the ucontext member within the MIPS rt_sigframe structure.
+Used to locate the signal context within a signal frame on the user
+stack.
+
+(sigcontext, sc_regs)
+---------------------
+
+Offset of the saved register array within struct sigcontext. Used to
+extract user-space register state from signal frames in a vmcore dump.
+
+PAGE_SHIFT
+----------
+
+The base-2 logarithm of the page size. Used for page frame number
+calculations during address translation.
+
+_PFN_MASK|_PAGE_PRESENT|_PAGE_VALID|_PAGE_GLOBAL
+-------------------------------------------------
+
+Page table entry bit masks and flags. Used for walking MIPS page tables
+and translating virtual to physical addresses in a vmcore dump.
+
+PTRS_PER_PGD|PTRS_PER_PMD|PTRS_PER_PTE
+---------------------------------------
+
+Number of entries per page table level. Used for page table walking
+during virtual-to-physical address translation.
+
powerpc
=======
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 95a1e674fd67..99f2961f6ee1 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -24,6 +24,7 @@ CFLAGS_REMOVE_perf_event_mipsxx.o = $(CC_FLAGS_FTRACE)
endif
obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
+obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o
obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 4a10f18a8806..f2241f52fa17 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -26,6 +26,7 @@
#include <linux/syscalls.h>
#include <linux/uaccess.h>
#include <linux/resume_user_mode.h>
+#include <linux/vmcore_info.h>
#include <asm/abi.h>
#include <asm/asm.h>
@@ -62,6 +63,13 @@ struct rt_sigframe {
struct ucontext rs_uc;
};
+#ifdef CONFIG_VMCORE_INFO
+void mips_rt_signal_frame(void)
+{
+ VMCOREINFO_OFFSET(rt_sigframe, rs_uc);
+}
+#endif
+
#ifdef CONFIG_MIPS_FP_SUPPORT
/*
diff --git a/arch/mips/kernel/vmcore_info.c b/arch/mips/kernel/vmcore_info.c
new file mode 100644
index 000000000000..5d7fdc662065
--- /dev/null
+++ b/arch/mips/kernel/vmcore_info.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/vmcore_info.h>
+
+#include <asm/pgtable.h>
+#include <asm/sigcontext.h>
+
+extern void mips_rt_signal_frame(void);
+
+void arch_crash_save_vmcoreinfo(void)
+{
+ mips_rt_signal_frame();
+ VMCOREINFO_OFFSET(sigcontext, sc_regs);
+ VMCOREINFO_NUMBER(PAGE_SHIFT);
+ VMCOREINFO_NUMBER(_PFN_MASK);
+ VMCOREINFO_NUMBER(_PAGE_PRESENT);
+ VMCOREINFO_NUMBER(_PAGE_VALID);
+ VMCOREINFO_NUMBER(_PAGE_GLOBAL);
+ VMCOREINFO_NUMBER(PTRS_PER_PGD);
+ VMCOREINFO_NUMBER(PTRS_PER_PMD);
+ VMCOREINFO_NUMBER(PTRS_PER_PTE);
+}
--
2.43.0
next prev parent reply other threads:[~2026-06-22 21:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 21:14 [PATCH 0/4] vmcore-tasks: export per-task metadata to vmcoreinfo Pnina Feder
2026-06-22 21:14 ` [PATCH 1/4] vmcoreinfo: increase vmcoreinfo buffer to 8KB Pnina Feder
2026-06-22 21:14 ` [PATCH 2/4] vmcoreinfo: export task and mm struct offsets to vmcoreinfo Pnina Feder
2026-06-22 21:14 ` [PATCH 3/4] riscv: vmcore_info: export riscv arch-specific " Pnina Feder
2026-06-22 21:14 ` Pnina Feder [this message]
2026-07-07 6:21 ` [PATCH 0/4] vmcore-tasks: export per-task metadata " Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260622211430.4008899-5-pnina.feder@mobileye.com \
--to=pnina.feder@mobileye.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bhe@redhat.com \
--cc=corbet@lwn.net \
--cc=kexec@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pasha.tatashin@soleen.com \
--cc=pjw@kernel.org \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox