* [PATCH v2 00/25] Introduce meminspect
@ 2026-03-10 20:15 Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
` (25 more replies)
0 siblings, 26 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
First of all, I want to thank Eugene for his excellent work on this
series. What began as the Qualcomm Minidump driver from me has now
evolved into meminspect. He also presented meminspect a few months ago
at Linux Plumbers 2025.
Video of the recording is available here for anyone interested:
https://www.youtube.com/watch?v=aDZv4-kOLSc
Introduction:
meminspect is a mechanism which allows the kernel to mark specific
memory areas for memory dumping or specific inspection, statistics,
usage. Once regions are marked, meminspect keeps an internal list with
the regions in a dedicated table. Further, these regions can be
accessed using specific API by any interested driver. Regions being
marked beforehand, when the system is up and running, there is no need
nor dependency on a panic handler, or a working kernel that can dump the
debug information. meminspect can be primarily used for debugging. The
approach is feasible to work when pstore, kdump, or another mechanism do
not. Pstore relies on persistent storage, a dedicated RAM area or
flash, which has the disadvantage of having the memory reserved all the
time, or another specific non volatile memory. Some devices cannot keep
the RAM contents on reboot so ramoops does not work. Some devices do not
allow kexec to run another kernel to debug the crashed one. For such
devices, that have another mechanism to help debugging, like firmware,
kmemdump is a viable solution.
meminspect can create a core image, similar with /proc/vmcore, with only
the registered regions included. This can be loaded into crash tool/gdb
and analyzed. This happens if CRASH_DUMP=y. To have this working,
specific information from the kernel is registered, and this is done at
meminspect init time, no need for the meminspect users to do anything.
This version of the meminspect patch series includes two drivers that
make use of it: one is the Qualcomm Minidump, and the other one is the
Debug Kinfo backend for Android devices, reworked from this source here:
https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/android/debug_kinfo.c
written originally by Jone Chou <jonechou@google.com>
*** History, motivation and available online resources ***
The patch series is based on both minidump and kmemdump previous implementations.
After the three RFC kmemdump versions, considering the ML discussions, it was decided to
move this into kernel/ directory and rework it into naming it meminspect, as Thomas Gleixner
suggested.
Initial version of kmemdump and discussion is available here:
https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
Kmemdump has been presented and discussed at Linaro Connect 2025,
including motivation, scope, usability and feasability.
Video of the recording is available here for anyone interested:
https://www.youtube.com/watch?v=r4gII7MX9zQ&list=PLKZSArYQptsODycGiE0XZdVovzAwYNwtK&index=14
Linaro blog on kmemdump can be found here:
https://www.linaro.org/blog/introduction-to-kmemdump/
Linaro blog on kmemdump step by stem using minidump backend is available here:
https://www.linaro.org/blog/kmemdump-step-by-step-on-qualcomm-automotive-platform/
The implementation is based on the initial Pstore/directly mapped zones
published as an RFC here:
https://lore.kernel.org/all/20250217101706.2104498-1-eugen.hristev@linaro.org/
The back-end implementation for qcom_minidump is based on the minidump
patch series and driver written by Mukesh Ojha, thanks:
https://lore.kernel.org/lkml/20240131110837.14218-1-quic_mojha@quicinc.com/
The RFC v2 version with .section creation and macro annotation kmemdump
is available here:
https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
The RFC v3 version with making everything static, which was pretty much rejected due to
all reasons discussed on the public ML:
https://lore.kernel.org/all/20250912150855.2901211-1-eugen.hristev@linaro.org/
*** How to use meminspect with minidump backend on Qualcomm platform guide ***
Prerequisites:
Crash tool compiled with target=ARM64 and minor changes required for
usual crash mode (minimal mode works without the patch) **A patch can be
applied from here https://p.calebs.dev/1687bc ** This patch will be
eventually sent in a reworked way to crash tool.
Target kernel must be built with : CONFIG_DEBUG_INFO_REDUCED=n ; this
will have vmlinux include all the debugging information needed for crash
tool.
Also, the kernel requires these as well: CONFIG_MEMINSPECT,
CONFIG_CRASH_DUMP and the driver CONFIG_QCOM_MINIDUMP
Kernel arguments: Kernel firmware must be set to mode 'mini' by kernel
module parameter like this : qcom_scm.download_mode=mini
After the kernel boots, and minidump module is loaded, everything is
ready for a possible crash.
Once the crash happens, the firmware will kick in and you will see on
the console the message saying Sahara init, etc, that the firmware is
waiting in download mode. (this is subject to firmware supporting this
mode, I am using sa8775p-ride board)
Example of log on the console:
"
[...]
B - 1096414 - usb: init start
B - 1100287 - usb: qusb_dci_platform , 0x19
B - 1105686 - usb: usb3phy: PRIM success: lane_A , 0x60
B - 1107455 - usb: usb2phy: PRIM success , 0x4
B - 1112670 - usb: dci, chgr_type_det_err
B - 1117154 - usb: ID:0x260, value: 0x4
B - 1121942 - usb: ID:0x108, value: 0x1d90
B - 1124992 - usb: timer_start , 0x4c4b40
B - 1129140 - usb: vbus_det_pm_unavail
B - 1133136 - usb: ID:0x252, value: 0x4
B - 1148874 - usb: SUPER , 0x900e
B - 1275510 - usb: SUPER , 0x900e
B - 1388970 - usb: ID:0x20d, value: 0x0
B - 1411113 - usb: ENUM success
B - 1411113 - Sahara Init
B - 1414285 - Sahara Open
"
Once the board is in download mode, you can use the qdl tool (I
personally use edl , have not tried qdl yet), to get all the regions as
separate files. The tool from the host computer will list the regions
in the order they were downloaded.
Once you have all the files simply use `cat` to put them all together,
in the order of the indexes. For my kernel config and setup, here is my
cat command : (you can use a script or something, I haven't done that so
far):
`cat md_KELF1.BIN md_Kvmcorein2.BIN md_Kconfig3.BIN \
md_Ktotalram4.BIN md_Kcpu_poss5.BIN md_Kcpu_pres6.BIN \
md_Kcpu_onli7.BIN md_Kcpu_acti8.BIN md_Kmem_sect9.BIN \
md_Kjiffies10.BIN md_Klinux_ba11.BIN md_Knr_threa12.BIN \
md_Knr_irqs13.BIN md_Ktainted_14.BIN md_Ktaint_fl15.BIN \
md_Knode_sta16.BIN md_K__per_cp17.BIN md_Knr_swapf18.BIN \
md_Kinit_uts19.BIN md_Kprintk_r20.BIN md_Kprintk_r21.BIN \
md_Kprb22.BIN md_Kprb_desc23.BIN md_Kprb_info24.BIN \
md_Kprb_data25.BIN md_Khigh_mem26.BIN md_Kinit_mm27.BIN \
md_Kunknown29.BIN md_Kunknown30.BIN md_Kunknown31.BIN \
md_Kunknown32.BIN md_Kunknown33.BIN md_Kunknown34.BIN \
md_Kunknown35.BIN md_Kunknown37.BIN \
md_Kunknown38.BIN md_Kunknown39.BIN md_Kunknown40.BIN \
md_Kunknown41.BIN md_Kunknown42.BIN md_Kunknown43.BIN \
md_Kunknown44.BIN md_Kunknown45.BIN md_Kunknown46.BIN \
md_Kunknown47.BIN md_Kunknown48.BIN md_Kunknown49.BIN \
md_Kunknown50.BIN md_Kunknown51.BIN md_Kunknown52.BIN \
md_Kunknown53.BIN md_Kunknown54.BIN > ./minidump_image`
Once you have the resulted file, use `crash` tool to load it, like this:
`./crash --no_modules --no_panic --no_kmem_cache --zero_excluded vmlinux minidump_image`
There is also a --minimal mode for ./crash that would work without any patch applied
to crash tool, but you can't inspect symbols, etc.
Once you load crash you will see something like this :
KERNEL: minidump/20260310-235110/vmlinux [TAINTED]
DUMPFILE: ./minidump/20260310-235110/minidump_image
CPUS: 8 [OFFLINE: 7]
DATE: Thu Jan 1 05:30:00 +0530 1970
UPTIME: 00:00:27
TASKS: 0
NODENAME: qemuarm64
RELEASE: 7.0.0-rc3-next-20260309-00028-g528b3c656121
VERSION: #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
MACHINE: aarch64 (unknown Mhz)
MEMORY: 0
PANIC: "Kernel panic - not syncing: sysrq triggered crash"
crash> log
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x514f0014]
[ 0.000000] Linux version 7.0.0-rc3-next-20260309-00028-g528b3c656121 (@21e3bca4168f) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
*** Debug Kinfo backend driver ***
I need help with the testing of this driver, Anyone who actually wants
to test this, feel free to reply to the patch. we have also written a
simple DT binding for the driver.
Thanks in advance for the review, and apologies if I missed addressing any comment.
-Mukesh
Changes in v2: https://lore.kernel.org/lkml/20251119154427.1033475-1-eugen.hristev@linaro.org/
- Fixed doc warnings
- Fixed kernel-test robot warnings.
- Took Mike suggestion to remove mark inspect flag for dynamic memory.
- Added R-b for printk patch.
- Modified some commit messages for clarity.
- corrected binding change for debug-kinfo as per Rob suggestion.
Changelog for meminspect v1:
- rename to meminspect
- start on top of v2 actually, with the section and all.
- remove the backend thing, change the API to access the table
- move everything to kernel/
- add dependency to CRASH_DUMP instead of a separate knob
- move the minidump driver to soc/qcom
- integrate the meminspect better into memblock by using a new memblock flag
- minor fixes : use dev_err_probe everywhere, rearrange variable declarations,
remove some useless code, etc.
Changelog for RFC v3:
- V2 available here : https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
- Removed the .section as requested by David Hildenbrand.
- Moved all kmemdump registration(when possible) to vmcoreinfo.
- Because of this, some of the variables that I was registering had to be non-static
so I had to modify this as per David Hildenbrand suggestion.
- Fixed minor things in the Kinfo driver: one field was broken, fixed some
compiler warnings, fixed the copyright and remove some useless includes.
- Moved the whole kmemdump from drivers/debug into mm/ and Kconfigs into mm/Kconfig.debug
and it's now available in kernel hacking, as per Randy Dunlap review
- Reworked some of the Documentation as per review from Jon Corbet
Changelog for RFC v2:
- V1 available here: https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
- Reworked the whole minidump implementation based on suggestions from Thomas Gleixner.
This means new API, macros, new way to store the regions inside kmemdump
(ditched the IDR, moved to static allocation, have a static default backend, etc)
- Reworked qcom_minidump driver based on review from Bjorn Andersson
- Reworked printk log buffer registration based on review from Petr Mladek
I appologize if I missed any review comments.
Patches are sent on top on next-20260309 tag
---
Eugen Hristev (21):
kernel: Introduce meminspect
init/version: Annotate static information into meminspect
mm/percpu: Annotate static information into meminspect
cpu: Annotate static information into meminspect
genirq/irqdesc: Annotate static information into meminspect
timers: Annotate static information into meminspect
kernel/fork: Annotate static information into meminspect
mm/page_alloc: Annotate static information into meminspect
mm/show_mem: Annotate static information into meminspect
mm/swapfile: Annotate static information into meminspect
kernel/vmcore_info: Register dynamic information into meminspect
kernel/configs: Register dynamic information into meminspect
mm/init-mm: Annotate static information into meminspect
panic: Annotate static information into meminspect
kallsyms: Annotate static information into meminspect
mm/mm_init: Annotate static information into meminspect
sched/core: Annotate runqueues into meminspect
remoteproc: qcom: Move minidump data structures into its own header
soc: qcom: Add minidump backend driver
soc: qcom: smem: Add minidump platform device
meminspect: Add debug kinfo compatible driver
Mukesh Ojha (4):
mm/numa: Register node data information into meminspect
mm/sparse: Register information into meminspect
printk: Register information into meminspect
dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/meminspect.rst | 144 +++++++
.../bindings/reserved-memory/google,kinfo.yaml | 46 ++
MAINTAINERS | 14 +
drivers/of/platform.c | 1 +
drivers/remoteproc/qcom_common.c | 56 +--
drivers/soc/qcom/Kconfig | 13 +
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/minidump.c | 272 ++++++++++++
drivers/soc/qcom/smem.c | 10 +
include/asm-generic/vmlinux.lds.h | 13 +
include/linux/meminspect.h | 263 ++++++++++++
include/linux/soc/qcom/minidump.h | 72 ++++
init/Kconfig | 1 +
init/version-timestamp.c | 3 +
init/version.c | 3 +
kernel/Makefile | 1 +
kernel/configs.c | 6 +
kernel/cpu.c | 5 +
kernel/fork.c | 3 +
kernel/irq/irqdesc.c | 2 +
kernel/kallsyms.c | 9 +
kernel/meminspect/Kconfig | 30 ++
kernel/meminspect/Makefile | 4 +
kernel/meminspect/kinfo.c | 284 +++++++++++++
kernel/meminspect/meminspect.c | 471 +++++++++++++++++++++
kernel/panic.c | 4 +
kernel/printk/printk.c | 11 +
kernel/sched/core.c | 2 +
kernel/time/timer.c | 2 +
kernel/vmcore_info.c | 4 +
mm/init-mm.c | 11 +
mm/mm_init.c | 2 +
mm/numa.c | 2 +
mm/page_alloc.c | 2 +
mm/percpu.c | 2 +
mm/show_mem.c | 2 +
mm/sparse.c | 6 +
mm/swapfile.c | 2 +
39 files changed, 1725 insertions(+), 55 deletions(-)
---
base-commit: 343f51842f4ed7143872f3aa116a214a5619a4b9
change-id: 20260311-minidump-v2-eed8da647ce5
Best regards,
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 01/25] kernel: Introduce meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-12 4:33 ` Randy Dunlap
2026-03-12 4:46 ` Randy Dunlap
2026-03-10 20:15 ` [PATCH v2 02/25] init/version: Annotate static information into meminspect Mukesh Ojha
` (24 subsequent siblings)
25 siblings, 2 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Inspection mechanism allows registration of a specific memory area(or
object) for later inspection purpose. Ranges are being added into an
inspection table, which can be requested and analyzed by specific
drivers. Drivers would interface any hardware mechanism that will allow
inspection of the data, including but not limited to: dumping for
debugging, creating a coredump, analysis, or statistical information.
Drivers can register a notifier to know when new objects are registered,
or to traverse existing inspection table. Inspection table is created
ahead of time such that it can be later used regardless of the state of
the kernel (running, frozen, crashed, or any particular state).
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
Documentation/dev-tools/index.rst | 1 +
Documentation/dev-tools/meminspect.rst | 144 ++++++++++
MAINTAINERS | 7 +
include/asm-generic/vmlinux.lds.h | 13 +
include/linux/meminspect.h | 263 ++++++++++++++++++
init/Kconfig | 1 +
kernel/Makefile | 1 +
kernel/meminspect/Kconfig | 19 ++
kernel/meminspect/Makefile | 3 +
kernel/meminspect/meminspect.c | 471 +++++++++++++++++++++++++++++++++
10 files changed, 923 insertions(+)
diff --git a/Documentation/dev-tools/index.rst b/Documentation/dev-tools/index.rst
index 59cbb77b33ff..ea2989ca1566 100644
--- a/Documentation/dev-tools/index.rst
+++ b/Documentation/dev-tools/index.rst
@@ -40,3 +40,4 @@ Documentation/process/debugging/index.rst
autofdo
propeller
container
+ meminspect
diff --git a/Documentation/dev-tools/meminspect.rst b/Documentation/dev-tools/meminspect.rst
new file mode 100644
index 000000000000..d0c7222bdcd7
--- /dev/null
+++ b/Documentation/dev-tools/meminspect.rst
@@ -0,0 +1,144 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+==========
+meminspect
+==========
+
+This document provides information about the meminspect feature.
+
+Overview
+========
+
+meminspect is a mechanism that allows the kernel to register a chunk of
+memory into a table, to be used at a later time for a specific
+inspection purpose like debugging, memory dumping or statistics.
+
+meminspect allows drivers to traverse the inspection table on demand,
+or to register a notifier to be called whenever a new entry is being added
+or removed.
+
+The reasoning for meminspect is also to minimize the required information
+in case of a kernel problem. For example a traditional debug method involves
+dumping the whole kernel memory and then inspecting it. Meminspect allows the
+users to select which memory is of interest, in order to help this specific
+use case in production, where memory and connectivity are limited.
+
+Although the kernel has multiple internal mechanisms, meminspect fits
+a particular model which is not covered by the others.
+
+meminspect Internals
+====================
+
+API
+---
+
+Static memory can be registered at compile time, by instructing the compiler
+to create a separate section with annotation info.
+For each such annotated memory (variables usually), a dedicated struct
+is being created with the required information.
+To achieve this goal, some basic APIs are available:
+
+* MEMINSPECT_ENTRY(idx, sym, sz)
+ is the basic macro that takes an ID, the symbol, and a size.
+
+To make it easier, some wrappers are also defined
+
+* MEMINSPECT_SIMPLE_ENTRY(sym)
+ will use the dedicated MEMINSPECT_ID_##sym with a size equal to sizeof(sym)
+
+* MEMINSPECT_NAMED_ENTRY(name, sym)
+ will be a simple entry that has an id that cannot be derived from the sym,
+ so a name has to be provided
+
+* MEMINSPECT_AREA_ENTRY(sym, sz)
+ this will register sym, but with the size given as sz, useful for e.g.
+ arrays which do not have a fixed size at compile time.
+
+For dynamically allocated memory, or for other cases, the following APIs
+are being defined::
+
+ meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone,
+ size_t size, unsigned int type);
+
+which takes the ID and the physical address.
+
+Similarly there are variations:
+
+ * meminspect_register_pa() omits the ID
+ * meminspect_register_id_va() requires the ID but takes a virtual address
+ * meminspect_register_va() omits the ID and requires a virtual address
+
+If the ID is not given, the next avialable dynamic ID is allocated.
+
+To unregister a dynamic entry, some APIs are being defined:
+ * meminspect_unregister_pa(phys_addr_t zone, size_t size);
+ * meminspect_unregister_id(enum meminspect_uid id);
+ * meminspect_unregister_va(va, size);
+
+All of the above have a lock variant that ensures the lock on the table
+is taken.
+
+
+meminspect drivers
+------------------
+
+Drivers are free to traverse the table by using a dedicated function::
+
+ meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb)
+
+The callback will be called for each entry in the table.
+
+Drivers can also register a notifier with meminspect_notifier_register()
+and unregister with meminspect_notifier_unregister() to be called when a new
+entry is being added or removed.
+
+Data structures
+---------------
+
+The regions are being stored in a simple fixed size array. It avoids
+memory allocation overhead. This is not performance critical nor does
+allocating a few hundred entries create a memory consumption problem.
+
+The static variables registered into meminspect are being annotated into
+a dedicated .inspect_table memory section. This is then walked by meminspect
+at a later time and each variable is then copied to the whole inspect table.
+
+meminspect Initialization
+-------------------------
+
+At any time, meminspect will be ready to accept region registration
+from any part of the kernel. The table does not require any initialization.
+In case CONFIG_CRASH_DUMP is enabled, meminspect will create an ELF header
+corresponding to a core dump image, in which each region is added as a
+program header. In this scenario, the first region is this ELF header, and
+the second region is the vmcoreinfo ELF note.
+By using this mechanism, all the meminspect table, if dumped, can be
+concatenated to obtain a core image that is loadable with the `crash` tool.
+
+meminspect example
+==================
+
+A simple scenario for meminspect is the following:
+The kernel registers the linux_banner variable into meminspect with
+a simple annotation like::
+
+ MEMINSPECT_SIMPLE_ENTRY(linux_banner);
+
+The meminspect late initcall will parse the compilation time created table
+and copy the entry information into the inspection table.
+At a later point, any interested driver can call the traverse function to
+find out all entries in the table.
+A specific driver will then note into a specific table the address of the
+banner and the size of it.
+The specific table is then written to a shared memory area that can be
+read by upper level firmware.
+When the kernel freezes (hypothetically), the kernel will no longer feed
+the watchdog. The watchdog will trigger a higher exception level interrupt
+which will be handled by the upper level firmware. This firmware will then
+read the shared memory table and find an entry with the start and size of
+the banner. It will then copy it for debugging purpose. The upper level
+firmware will then be able to provide useful debugging information,
+like in this example, the banner.
+
+As seen here, meminspect facilitates the interaction between the kernel
+and a specific firmware.
diff --git a/MAINTAINERS b/MAINTAINERS
index 1121276c59a1..ebf478dbd15c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16585,6 +16585,13 @@ F: arch/*/include/asm/sync_core.h
F: include/uapi/linux/membarrier.h
F: kernel/sched/membarrier.c
+MEMINSPECT
+M: Eugen Hristev <eugen.hristev@linaro.org>
+S: Maintained
+F: Documentation/dev-tools/meminspect.rst
+F: include/linux/meminspect.h
+F: kernel/meminspect/*
+
MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION
M: Mike Rapoport <rppt@kernel.org>
L: linux-mm@kvack.org
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 1e1580febe4b..a41536b310a5 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -506,6 +506,8 @@
FW_LOADER_BUILT_IN_DATA \
TRACEDATA \
\
+ MEMINSPECT_TABLE \
+ \
PRINTK_INDEX \
\
/* Kernel symbol table: Normal symbols */ \
@@ -911,6 +913,17 @@
#define TRACEDATA
#endif
+#ifdef CONFIG_MEMINSPECT
+#define MEMINSPECT_TABLE \
+ . = ALIGN(8); \
+ .inspect_table : AT(ADDR(.inspect_table) - LOAD_OFFSET) { \
+ BOUNDED_SECTION_POST_LABEL(.inspect_table, \
+ __inspect_table, , _end) \
+ }
+#else
+#define MEMINSPECT_TABLE
+#endif
+
#ifdef CONFIG_PRINTK_INDEX
#define PRINTK_INDEX \
.printk_index : AT(ADDR(.printk_index) - LOAD_OFFSET) { \
diff --git a/include/linux/meminspect.h b/include/linux/meminspect.h
new file mode 100644
index 000000000000..f09cfcef62c2
--- /dev/null
+++ b/include/linux/meminspect.h
@@ -0,0 +1,263 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _MEMINSPECT_H
+#define _MEMINSPECT_H
+
+#include <linux/io.h>
+#include <linux/notifier.h>
+
+enum meminspect_uid {
+ MEMINSPECT_ID_STATIC = 0,
+ MEMINSPECT_ID_ELF,
+ MEMINSPECT_ID_VMCOREINFO,
+ MEMINSPECT_ID_CONFIG,
+ MEMINSPECT_ID__totalram_pages,
+ MEMINSPECT_ID___cpu_possible_mask,
+ MEMINSPECT_ID___cpu_present_mask,
+ MEMINSPECT_ID___cpu_online_mask,
+ MEMINSPECT_ID___cpu_active_mask,
+ MEMINSPECT_ID_mem_section,
+ MEMINSPECT_ID_jiffies_64,
+ MEMINSPECT_ID_linux_banner,
+ MEMINSPECT_ID_nr_threads,
+ MEMINSPECT_ID_nr_irqs,
+ MEMINSPECT_ID_tainted_mask,
+ MEMINSPECT_ID_taint_flags,
+ MEMINSPECT_ID_node_states,
+ MEMINSPECT_ID___per_cpu_offset,
+ MEMINSPECT_ID_nr_swapfiles,
+ MEMINSPECT_ID_init_uts_ns,
+ MEMINSPECT_ID_printk_rb_static,
+ MEMINSPECT_ID_printk_rb_dynamic,
+ MEMINSPECT_ID_prb,
+ MEMINSPECT_ID_prb_descs,
+ MEMINSPECT_ID_prb_infos,
+ MEMINSPECT_ID_prb_data,
+ MEMINSPECT_ID_high_memory,
+ MEMINSPECT_ID_init_mm,
+ MEMINSPECT_ID_init_mm_pgd,
+ MEMINSPECT_ID__sinittext,
+ MEMINSPECT_ID__einittext,
+ MEMINSPECT_ID__end,
+ MEMINSPECT_ID__text,
+ MEMINSPECT_ID__stext,
+ MEMINSPECT_ID__etext,
+ MEMINSPECT_ID_kallsyms_num_syms,
+ MEMINSPECT_ID_kallsyms_relative_base,
+ MEMINSPECT_ID_kallsyms_offsets,
+ MEMINSPECT_ID_kallsyms_names,
+ MEMINSPECT_ID_kallsyms_token_table,
+ MEMINSPECT_ID_kallsyms_token_index,
+ MEMINSPECT_ID_kallsyms_markers,
+ MEMINSPECT_ID_kallsyms_seqs_of_names,
+ MEMINSPECT_ID_swapper_pg_dir,
+ MEMINSPECT_ID_DYNAMIC,
+ MEMINSPECT_ID_MAX = 201,
+};
+
+#define MEMINSPECT_TYPE_REGULAR 0
+
+#define MEMINSPECT_NOTIFIER_ADD 0
+#define MEMINSPECT_NOTIFIER_REMOVE 1
+
+/**
+ * struct inspect_entry - memory inspect entry information
+ * @id: unique id for this entry
+ * @va: virtual address for the memory (pointer)
+ * @pa: physical address for the memory
+ * @size: size of the memory area of this entry
+ * @type: type of the entry (class)
+ */
+struct inspect_entry {
+ enum meminspect_uid id;
+ void *va;
+ phys_addr_t pa;
+ size_t size;
+ unsigned int type;
+};
+
+typedef void (*MEMINSPECT_ITERATOR_CB)(void *priv, const struct inspect_entry *ie);
+
+#ifdef CONFIG_MEMINSPECT
+/* .inspect_table section table markers*/
+extern const struct inspect_entry __inspect_table[];
+extern const struct inspect_entry __inspect_table_end[];
+
+/*
+ * Annotate a static variable into inspection table.
+ * Can be called multiple times for the same ID, in which case
+ * multiple table entries will be created
+ */
+#define MEMINSPECT_ENTRY(idx, sym, sz) \
+ static const struct inspect_entry __UNIQUE_ID(__inspect_entry_##idx) \
+ __used __section(".inspect_table") = { \
+ .id = idx, \
+ .va = (void *)&(sym), \
+ .size = (sz), \
+ }
+/*
+ * A simple entry is just a variable, the size of the entry is the variable size
+ * The variable can also be a pointer, the pointer itself is being added in this
+ * case.
+ */
+#define MEMINSPECT_SIMPLE_ENTRY(sym) \
+ MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sizeof(sym))
+/*
+ * In the case when `sym` is not a variable, but a member of a struct e.g.,
+ * and we cannot derive a name from it, a name must be provided.
+ */
+#define MEMINSPECT_NAMED_ENTRY(name, sym) \
+ MEMINSPECT_ENTRY(MEMINSPECT_ID_##name, sym, sizeof(sym))
+/*
+ * Create a more complex entry, by registering an arbitrary memory starting
+ * at sym. The size is provided as a parameter.
+ * This is used e.g. when the symbol is a start of an unknown sized array.
+ */
+#define MEMINSPECT_AREA_ENTRY(sym, sz) \
+ MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sz)
+
+/* Iterate through .inspect_table section entries */
+#define for_each_meminspect_entry(__entry) \
+ for (__entry = __inspect_table; \
+ __entry < __inspect_table_end; \
+ __entry++)
+
+#else
+#define MEMINSPECT_ENTRY(...)
+#define MEMINSPECT_SIMPLE_ENTRY(...)
+#define MEMINSPECT_NAMED_ENTRY(...)
+#define MEMINSPECT_AREA_ENTRY(...)
+#endif
+
+#ifdef CONFIG_MEMINSPECT
+
+/*
+ * Dynamic helpers to register entries.
+ * These do not lock the table, so use with caution.
+ */
+void meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone,
+ size_t size, unsigned int type);
+void meminspect_table_lock(void);
+void meminspect_table_unlock(void);
+
+#define meminspect_register_pa(...) \
+ meminspect_register_id_pa(MEMINSPECT_ID_DYNAMIC, __VA_ARGS__, MEMINSPECT_TYPE_REGULAR)
+
+#define meminspect_register_id_va(id, va, size) \
+ meminspect_register_id_pa(id, virt_to_phys(va), size, MEMINSPECT_TYPE_REGULAR)
+
+#define meminspect_register_va(...) \
+ meminspect_register_id_va(MEMINSPECT_ID_DYNAMIC, __VA_ARGS__)
+
+void meminspect_unregister_pa(phys_addr_t zone, size_t size);
+void meminspect_unregister_id(enum meminspect_uid id);
+
+#define meminspect_unregister_va(va, size) \
+ meminspect_unregister_pa(virt_to_phys(va), size)
+
+void meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb);
+
+/*
+ * Producers, or registrators, are advised to use the locked API below
+ */
+#define meminspect_lock_register_pa(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_register_pa(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_register_id_va(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_register_id_va(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_register_va(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_register_va(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_unregister_pa(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_unregister_pa(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_unregister_va(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_unregister_va(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_unregister_id(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_unregister_id(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+#define meminspect_lock_traverse(...) \
+ { \
+ meminspect_table_lock(); \
+ meminspect_traverse(__VA_ARGS__); \
+ meminspect_table_unlock(); \
+ }
+
+int meminspect_notifier_register(struct notifier_block *n);
+int meminspect_notifier_unregister(struct notifier_block *n);
+
+#else
+static inline void meminspect_register_id_pa(enum meminspect_uid id,
+ phys_addr_t zone,
+ size_t size, unsigned int type)
+{
+}
+
+static inline void meminspect_table_lock(void)
+{
+}
+
+static inline void meminspect_table_unlock(void)
+{
+}
+
+static inline void meminspect_unregister(phys_addr_t zone, size_t size)
+{
+}
+
+static inline void meminspect_unregister_id(enum meminspect_uid id)
+{
+}
+
+static inline void meminspect_traverse(MEMINSPECT_ITERATOR_CB cb)
+{
+}
+
+static inline int meminspect_notifier_register(struct notifier_block *n)
+{
+ return 0;
+}
+
+static inline int meminspect_notifier_unregister(struct notifier_block *n)
+{
+ return 0;
+}
+
+#define meminspect_register_pa(...)
+#define meminspect_register_id_va(...)
+#define meminspect_register_va(...)
+#define meminspect_lock_register_pa(...)
+#define meminspect_lock_register_va(...)
+#define meminspect_lock_register_id_va(...)
+#define meminspect_lock_traverse(...)
+#define meminspect_lock_unregister_va(...)
+#define meminspect_lock_unregister_pa(...)
+#define meminspect_lock_unregister_id(...)
+#endif
+
+#endif
diff --git a/init/Kconfig b/init/Kconfig
index ebdd3b9d3394..23848994f97e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2231,6 +2231,7 @@ config TRACEPOINTS
source "kernel/Kconfig.kexec"
source "kernel/liveupdate/Kconfig"
+source "kernel/meminspect/Kconfig"
endmenu # General setup
diff --git a/kernel/Makefile b/kernel/Makefile
index 6785982013dc..af532e0b4806 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -52,6 +52,7 @@ obj-y += locking/
obj-y += power/
obj-y += printk/
obj-y += irq/
+obj-y += meminspect/
obj-y += rcu/
obj-y += livepatch/
obj-y += liveupdate/
diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig
new file mode 100644
index 000000000000..fa2b5a84b251
--- /dev/null
+++ b/kernel/meminspect/Kconfig
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0
+
+config MEMINSPECT
+ bool "Allow the kernel to register memory regions for inspection purpose"
+ help
+ Inspection mechanism allows registration of a specific memory
+ area(or object) for later inspection purpose.
+ Ranges are being added into an inspection table, which can be
+ requested and analyzed by specific drivers.
+ Drivers would interface any hardware mechanism that will allow
+ inspection of the data, including but not limited to: dumping
+ for debugging, creating a coredump, analysis, or statistical
+ information.
+ Inspection table is created ahead of time such that it can be later
+ used regardless of the state of the kernel (running, frozen, crashed,
+ or any particular state).
+
+ Note that modules using this feature must be rebuilt if option
+ changes.
diff --git a/kernel/meminspect/Makefile b/kernel/meminspect/Makefile
new file mode 100644
index 000000000000..09fd55e6d9cf
--- /dev/null
+++ b/kernel/meminspect/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_MEMINSPECT) += meminspect.o
diff --git a/kernel/meminspect/meminspect.c b/kernel/meminspect/meminspect.c
new file mode 100644
index 000000000000..be91a839f688
--- /dev/null
+++ b/kernel/meminspect/meminspect.c
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/crash_core.h>
+#include <linux/dma-map-ops.h>
+#include <linux/vmcore_info.h>
+#include <linux/notifier.h>
+#include <linux/meminspect.h>
+
+static DEFINE_MUTEX(meminspect_lock);
+static struct inspect_entry inspect_entries[MEMINSPECT_ID_MAX];
+
+static ATOMIC_NOTIFIER_HEAD(meminspect_notifier_list);
+
+#ifdef CONFIG_CRASH_DUMP
+
+#define CORE_STR "CORE"
+
+static struct elfhdr *ehdr;
+static size_t elf_offset;
+static bool elf_hdr_ready;
+
+static void append_kcore_note(char *notes, size_t *i, const char *name,
+ unsigned int type, const void *desc,
+ size_t descsz)
+{
+ struct elf_note *note = (struct elf_note *)¬es[*i];
+
+ note->n_namesz = strlen(name) + 1;
+ note->n_descsz = descsz;
+ note->n_type = type;
+ *i += sizeof(*note);
+ memcpy(¬es[*i], name, note->n_namesz);
+ *i = ALIGN(*i + note->n_namesz, 4);
+ memcpy(¬es[*i], desc, descsz);
+ *i = ALIGN(*i + descsz, 4);
+}
+
+static void append_kcore_note_nodesc(char *notes, size_t *i, const char *name,
+ unsigned int type, size_t descsz)
+{
+ struct elf_note *note = (struct elf_note *)¬es[*i];
+
+ note->n_namesz = strlen(name) + 1;
+ note->n_descsz = descsz;
+ note->n_type = type;
+ *i += sizeof(*note);
+ memcpy(¬es[*i], name, note->n_namesz);
+ *i = ALIGN(*i + note->n_namesz, 4);
+}
+
+static struct elf_phdr *elf_phdr_entry_addr(struct elfhdr *ehdr, int idx)
+{
+ struct elf_phdr *ephdr = (struct elf_phdr *)((size_t)ehdr + ehdr->e_phoff);
+
+ return &ephdr[idx];
+}
+
+static int clear_elfheader(const struct inspect_entry *e)
+{
+ struct elf_phdr *phdr;
+ struct elf_phdr *tmp_phdr;
+ unsigned int phidx;
+ unsigned int i;
+
+ for (i = 0; i < ehdr->e_phnum; i++) {
+ phdr = elf_phdr_entry_addr(ehdr, i);
+ if (phdr->p_paddr == e->pa &&
+ phdr->p_memsz == ALIGN(e->size, 4))
+ break;
+ }
+
+ if (i == ehdr->e_phnum) {
+ pr_debug("Cannot find program header entry in elf\n");
+ return -EINVAL;
+ }
+
+ phidx = i;
+
+ /* Clear program header */
+ tmp_phdr = elf_phdr_entry_addr(ehdr, phidx);
+ for (i = phidx; i < ehdr->e_phnum - 1; i++) {
+ tmp_phdr = elf_phdr_entry_addr(ehdr, i + 1);
+ phdr = elf_phdr_entry_addr(ehdr, i);
+ memcpy(phdr, tmp_phdr, sizeof(*phdr));
+ phdr->p_offset = phdr->p_offset - ALIGN(e->size, 4);
+ }
+ memset(tmp_phdr, 0, sizeof(*tmp_phdr));
+ ehdr->e_phnum--;
+
+ elf_offset -= ALIGN(e->size, 4);
+
+ return 0;
+}
+
+static void update_elfheader(const struct inspect_entry *e)
+{
+ struct elf_phdr *phdr;
+
+ phdr = elf_phdr_entry_addr(ehdr, ehdr->e_phnum++);
+
+ phdr->p_type = PT_LOAD;
+ phdr->p_offset = elf_offset;
+ phdr->p_vaddr = (elf_addr_t)e->va;
+ if (e->pa)
+ phdr->p_paddr = (elf_addr_t)e->pa;
+ else
+ phdr->p_paddr = (elf_addr_t)virt_to_phys(e->va);
+
+ phdr->p_filesz = ALIGN(e->size, 4);
+ phdr->p_memsz = ALIGN(e->size, 4);
+ phdr->p_flags = PF_R | PF_W;
+ elf_offset += ALIGN(e->size, 4);
+}
+
+/*
+ * This function prepares the elf header for the coredump image.
+ * Initially there is a single program header for the elf NOTE.
+ * The note contains the usual core dump information, and the vmcoreinfo.
+ */
+static int init_elfheader(void)
+{
+ struct elf_phdr *phdr;
+ void *notes;
+ unsigned int elfh_size, buf_sz;
+ unsigned int phdr_off;
+ size_t note_len, i = 0;
+ struct page *p;
+
+ struct elf_prstatus prstatus = {};
+ struct elf_prpsinfo prpsinfo = {
+ .pr_sname = 'R',
+ .pr_fname = "vmlinux",
+ };
+
+ /*
+ * Header buffer contains:
+ * ELF header, Note entry with PR status, PR ps info, and vmcoreinfo.
+ * Also, MEMINSPECT_ID_MAX program headers.
+ */
+ elfh_size = sizeof(*ehdr);
+ elfh_size += sizeof(struct elf_prstatus);
+ elfh_size += sizeof(struct elf_prpsinfo);
+ elfh_size += sizeof(VMCOREINFO_NOTE_NAME);
+ elfh_size += ALIGN(vmcoreinfo_size, 4);
+ elfh_size += (sizeof(*phdr)) * (MEMINSPECT_ID_MAX);
+
+ elfh_size = ALIGN(elfh_size, 4);
+
+ /* Length of the note is made of :
+ * 3 elf notes structs (prstatus, prpsinfo, vmcoreinfo)
+ * 3 notes names (2 core strings, 1 vmcoreinfo name)
+ * sizeof each note
+ */
+ note_len = (3 * sizeof(struct elf_note) +
+ 2 * ALIGN(sizeof(CORE_STR), 4) +
+ VMCOREINFO_NOTE_NAME_BYTES +
+ ALIGN(sizeof(struct elf_prstatus), 4) +
+ ALIGN(sizeof(struct elf_prpsinfo), 4) +
+ ALIGN(vmcoreinfo_size, 4));
+
+ buf_sz = elfh_size + note_len - ALIGN(vmcoreinfo_size, 4);
+
+ /* Never freed */
+ p = dma_alloc_from_contiguous(NULL, buf_sz >> PAGE_SHIFT,
+ get_order(buf_sz), true);
+ if (!p)
+ return -ENOMEM;
+
+ ehdr = dma_common_contiguous_remap(p, buf_sz,
+ pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)),
+ __builtin_return_address(0));
+ if (!ehdr) {
+ dma_release_from_contiguous(NULL, p, buf_sz >> PAGE_SHIFT);
+ return -ENOMEM;
+ }
+
+ memset(ehdr, 0, elfh_size);
+
+ /* Assign Program headers offset, it's right after the elf header. */
+ phdr = (struct elf_phdr *)(ehdr + 1);
+ phdr_off = sizeof(*ehdr);
+
+ memcpy(ehdr->e_ident, ELFMAG, SELFMAG);
+ ehdr->e_ident[EI_CLASS] = ELF_CLASS;
+ ehdr->e_ident[EI_DATA] = ELF_DATA;
+ ehdr->e_ident[EI_VERSION] = EV_CURRENT;
+ ehdr->e_ident[EI_OSABI] = ELF_OSABI;
+ ehdr->e_type = ET_CORE;
+ ehdr->e_machine = ELF_ARCH;
+ ehdr->e_version = EV_CURRENT;
+ ehdr->e_ehsize = sizeof(*ehdr);
+ ehdr->e_phentsize = sizeof(*phdr);
+
+ elf_offset = elfh_size;
+
+ notes = (void *)(((char *)ehdr) + elf_offset);
+
+ /* we have a single program header now */
+ ehdr->e_phnum = 1;
+
+ phdr->p_type = PT_NOTE;
+ phdr->p_offset = elf_offset;
+ phdr->p_filesz = note_len;
+
+ /* advance elf offset */
+ elf_offset += note_len;
+
+ strscpy(prpsinfo.pr_psargs, saved_command_line,
+ sizeof(prpsinfo.pr_psargs));
+
+ append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus,
+ sizeof(prstatus));
+ append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo,
+ sizeof(prpsinfo));
+ append_kcore_note_nodesc(notes, &i, VMCOREINFO_NOTE_NAME, 0,
+ ALIGN(vmcoreinfo_size, 4));
+
+ ehdr->e_phoff = phdr_off;
+
+ /* This is the first coredump region, the ELF header */
+ meminspect_register_id_pa(MEMINSPECT_ID_ELF, page_to_phys(p),
+ buf_sz, MEMINSPECT_TYPE_REGULAR);
+
+ /*
+ * The second region is the vmcoreinfo, which goes right after.
+ * It's being registered through vmcoreinfo.
+ */
+
+ return 0;
+}
+#endif
+
+/**
+ * meminspect_unregister_id() - Unregister region from inspection table.
+ * @id: region's id in the table
+ *
+ * Return: None
+ */
+void meminspect_unregister_id(enum meminspect_uid id)
+{
+ struct inspect_entry *e;
+
+ WARN_ON(!mutex_is_locked(&meminspect_lock));
+
+ e = &inspect_entries[id];
+ if (!e->id)
+ return;
+
+ atomic_notifier_call_chain(&meminspect_notifier_list,
+ MEMINSPECT_NOTIFIER_REMOVE, e);
+#ifdef CONFIG_CRASH_DUMP
+ if (elf_hdr_ready)
+ clear_elfheader(e);
+#endif
+ memset(e, 0, sizeof(*e));
+}
+EXPORT_SYMBOL_GPL(meminspect_unregister_id);
+
+/**
+ * meminspect_unregister_pa() - Unregister region from inspection table.
+ * @pa: Physical address of the memory region to remove
+ * @size: Size of the memory region to remove
+ *
+ * Return: None
+ */
+void meminspect_unregister_pa(phys_addr_t pa, size_t size)
+{
+ struct inspect_entry *e;
+ enum meminspect_uid i;
+
+ WARN_ON(!mutex_is_locked(&meminspect_lock));
+
+ for (i = MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++) {
+ e = &inspect_entries[i];
+ if (e->pa != pa)
+ continue;
+ if (e->size != size)
+ continue;
+ meminspect_unregister_id(e->id);
+ return;
+ }
+}
+EXPORT_SYMBOL_GPL(meminspect_unregister_pa);
+
+/**
+ * meminspect_register_id_pa() - Register region into inspection table
+ * with given ID and physical address.
+ * @req_id: Requested unique meminspect_uid that identifies the region
+ * This can be MEMINSPECT_ID_DYNAMIC, in which case the function will
+ * find an unused ID and register with it.
+ * @pa: physical address of the memory region
+ * @size: region size
+ * @type: region type
+ *
+ * Return: None
+ */
+void meminspect_register_id_pa(enum meminspect_uid req_id, phys_addr_t pa,
+ size_t size, unsigned int type)
+{
+ struct inspect_entry *e;
+ enum meminspect_uid uid = req_id;
+
+ WARN_ON(!mutex_is_locked(&meminspect_lock));
+
+ if (uid < MEMINSPECT_ID_STATIC || uid >= MEMINSPECT_ID_MAX)
+ return;
+
+ if (uid == MEMINSPECT_ID_DYNAMIC)
+ while (uid < MEMINSPECT_ID_MAX) {
+ if (!inspect_entries[uid].id)
+ break;
+ uid++;
+ }
+
+ if (uid == MEMINSPECT_ID_MAX)
+ return;
+
+ e = &inspect_entries[uid];
+
+ if (e->id)
+ meminspect_unregister_id(e->id);
+
+ e->pa = pa;
+ e->va = phys_to_virt(pa);
+ e->size = size;
+ e->id = uid;
+ e->type = type;
+#ifdef CONFIG_CRASH_DUMP
+ if (elf_hdr_ready)
+ update_elfheader(e);
+#endif
+ atomic_notifier_call_chain(&meminspect_notifier_list,
+ MEMINSPECT_NOTIFIER_ADD, e);
+}
+EXPORT_SYMBOL_GPL(meminspect_register_id_pa);
+
+/**
+ * meminspect_table_lock() - Lock the mutex on the inspection table
+ *
+ * Return: None
+ */
+void meminspect_table_lock(void)
+{
+ mutex_lock(&meminspect_lock);
+}
+EXPORT_SYMBOL_GPL(meminspect_table_lock);
+
+/**
+ * meminspect_table_unlock() - Unlock the mutex on the inspection table
+ *
+ * Return: None
+ */
+void meminspect_table_unlock(void)
+{
+ mutex_unlock(&meminspect_lock);
+}
+EXPORT_SYMBOL_GPL(meminspect_table_unlock);
+
+/**
+ * meminspect_traverse() - Traverse the meminspect table and call the
+ * callback function for each valid entry.
+ * @priv: private data to be called to the callback
+ * @cb: meminspect iterator callback that should be called for each entry
+ *
+ * Return: None
+ */
+void meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb)
+{
+ const struct inspect_entry *e;
+ int i;
+
+ WARN_ON(!mutex_is_locked(&meminspect_lock));
+
+ for (i = MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++) {
+ e = &inspect_entries[i];
+ if (e->id)
+ cb(priv, e);
+ }
+}
+EXPORT_SYMBOL_GPL(meminspect_traverse);
+
+/**
+ * meminspect_notifier_register() - Register a notifier to meminspect table
+ * @n: notifier block to register. This will be called whenever an entry
+ * is being added or removed.
+ *
+ * Return: errno
+ */
+int meminspect_notifier_register(struct notifier_block *n)
+{
+ return atomic_notifier_chain_register(&meminspect_notifier_list, n);
+}
+EXPORT_SYMBOL_GPL(meminspect_notifier_register);
+
+/**
+ * meminspect_notifier_unregister() - Unregister a previously registered
+ * notifier from meminspect table.
+ * @n: notifier block to unregister.
+ *
+ * Return: errno
+ */
+int meminspect_notifier_unregister(struct notifier_block *n)
+{
+ return atomic_notifier_chain_unregister(&meminspect_notifier_list, n);
+}
+EXPORT_SYMBOL_GPL(meminspect_notifier_unregister);
+
+#ifdef CONFIG_CRASH_DUMP
+static int __init meminspect_prepare_crashdump(void)
+{
+ const struct inspect_entry *e;
+ int ret;
+ enum meminspect_uid i;
+
+ ret = init_elfheader();
+
+ if (ret < 0)
+ return ret;
+
+ /*
+ * Some regions may have been registered very early.
+ * Update the elf header for all existing regions,
+ * except for MEMINSPECT_ID_ELF and MEMINSPECT_ID_VMCOREINFO,
+ * those are included in the ELF header upon its creation.
+ */
+ for (i = MEMINSPECT_ID_VMCOREINFO + 1; i < MEMINSPECT_ID_MAX; i++) {
+ e = &inspect_entries[i];
+ if (e->id)
+ update_elfheader(e);
+ }
+
+ elf_hdr_ready = true;
+
+ return 0;
+}
+#endif
+
+static int __init meminspect_prepare_table(void)
+{
+ const struct inspect_entry *e;
+ enum meminspect_uid i;
+
+ meminspect_table_lock();
+ /*
+ * First, copy all entries from the compiler built table
+ * In case some entries are registered multiple times,
+ * the last chronological entry will be stored.
+ * Previusly registered entries will be dropped.
+ */
+ for_each_meminspect_entry(e) {
+ inspect_entries[e->id] = *e;
+ }
+#ifdef CONFIG_CRASH_DUMP
+ meminspect_prepare_crashdump();
+#endif
+ /* if we have early notifiers registered, call them now */
+ for (i = MEMINSPECT_ID_STATIC; i < MEMINSPECT_ID_MAX; i++)
+ if (inspect_entries[i].id)
+ atomic_notifier_call_chain(&meminspect_notifier_list,
+ MEMINSPECT_NOTIFIER_ADD,
+ &inspect_entries[i]);
+ meminspect_table_unlock();
+
+ pr_debug("Memory inspection table initialized");
+
+ return 0;
+}
+late_initcall(meminspect_prepare_table);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 02/25] init/version: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 03/25] mm/percpu: " Mukesh Ojha
` (23 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- init_uts_ns
- linux_banner
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
init/version-timestamp.c | 3 +++
init/version.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/init/version-timestamp.c b/init/version-timestamp.c
index 375726e05f69..37bdcdd443f9 100644
--- a/init/version-timestamp.c
+++ b/init/version-timestamp.c
@@ -6,6 +6,7 @@
#include <linux/refcount.h>
#include <linux/uts.h>
#include <linux/utsname.h>
+#include <linux/meminspect.h>
struct uts_namespace init_uts_ns = {
.ns = NS_COMMON_INIT(init_uts_ns),
@@ -24,3 +25,5 @@ struct uts_namespace init_uts_ns = {
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+
+MEMINSPECT_SIMPLE_ENTRY(linux_banner);
diff --git a/init/version.c b/init/version.c
index 94c96f6fbfe6..eeb139236562 100644
--- a/init/version.c
+++ b/init/version.c
@@ -16,6 +16,7 @@
#include <linux/uts.h>
#include <linux/utsname.h>
#include <linux/proc_ns.h>
+#include <linux/meminspect.h>
static int __init early_hostname(char *arg)
{
@@ -51,4 +52,6 @@ const char linux_banner[] __weak;
#include "version-timestamp.c"
+MEMINSPECT_SIMPLE_ENTRY(init_uts_ns);
+
EXPORT_SYMBOL_GPL(init_uts_ns);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 03/25] mm/percpu: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 02/25] init/version: Annotate static information into meminspect Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-12 20:18 ` kernel test robot
2026-03-13 8:06 ` kernel test robot
2026-03-10 20:15 ` [PATCH v2 04/25] cpu: " Mukesh Ojha
` (22 subsequent siblings)
25 siblings, 2 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information in meminspect:
- __per_cpu_offset
Information on these annotated variables is stored in a dedicated
meminspect section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/percpu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/percpu.c b/mm/percpu.c
index b0676b8054ed..d4209bdfbef5 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -87,6 +87,7 @@
#include <linux/sched.h>
#include <linux/sched/mm.h>
#include <linux/memcontrol.h>
+#include <linux/meminspect.h>
#include <asm/cacheflush.h>
#include <asm/sections.h>
@@ -3359,6 +3360,7 @@ void __init setup_per_cpu_areas(void)
#endif /* CONFIG_SMP */
+MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
/*
* pcpu_nr_pages - calculate total number of populated backing pages
*
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 04/25] cpu: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (2 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 03/25] mm/percpu: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 05/25] genirq/irqdesc: " Mukesh Ojha
` (21 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into memory inspection table:
- __cpu_present_mask
- __cpu_online_mask
- __cpu_possible_mask
- __cpu_active_mask
Information on these annotated variables is stored in a dedicated
meminspect section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/cpu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index bc4f7a9ba64e..25b0fffbda83 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -37,6 +37,7 @@
#include <linux/random.h>
#include <linux/cc_platform.h>
#include <linux/parser.h>
+#include <linux/meminspect.h>
#include <trace/events/power.h>
#define CREATE_TRACE_POINTS
@@ -3087,19 +3088,23 @@ struct cpumask __cpu_possible_mask __ro_after_init;
unsigned int __num_possible_cpus __ro_after_init;
#endif
EXPORT_SYMBOL(__cpu_possible_mask);
+MEMINSPECT_SIMPLE_ENTRY(__cpu_possible_mask);
EXPORT_SYMBOL(__num_possible_cpus);
struct cpumask __cpu_online_mask __read_mostly;
EXPORT_SYMBOL(__cpu_online_mask);
+MEMINSPECT_SIMPLE_ENTRY(__cpu_online_mask);
struct cpumask __cpu_enabled_mask __read_mostly;
EXPORT_SYMBOL(__cpu_enabled_mask);
struct cpumask __cpu_present_mask __read_mostly;
EXPORT_SYMBOL(__cpu_present_mask);
+MEMINSPECT_SIMPLE_ENTRY(__cpu_present_mask);
struct cpumask __cpu_active_mask __read_mostly;
EXPORT_SYMBOL(__cpu_active_mask);
+MEMINSPECT_SIMPLE_ENTRY(__cpu_active_mask);
struct cpumask __cpu_dying_mask __read_mostly;
EXPORT_SYMBOL(__cpu_dying_mask);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 05/25] genirq/irqdesc: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (3 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 04/25] cpu: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 06/25] timers: " Mukesh Ojha
` (20 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- nr_irqs
Information on these annotated variables is stored in a dedicated
meminspect section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/irq/irqdesc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 7173b8b634f2..44ef0ebcc3ce 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -16,6 +16,7 @@
#include <linux/irqdomain.h>
#include <linux/sysfs.h>
#include <linux/string_choices.h>
+#include <linux/meminspect.h>
#include "internals.h"
@@ -141,6 +142,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
}
static unsigned int nr_irqs = NR_IRQS;
+MEMINSPECT_SIMPLE_ENTRY(nr_irqs);
/**
* irq_get_nr_irqs() - Number of interrupts supported by the system.
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 06/25] timers: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (4 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 05/25] genirq/irqdesc: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 07/25] kernel/fork: " Mukesh Ojha
` (19 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- jiffies_64
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/time/timer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 7e1e3bde6b8b..ba86a5a7ebbf 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -44,6 +44,7 @@
#include <linux/compat.h>
#include <linux/random.h>
#include <linux/sysctl.h>
+#include <linux/meminspect.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
@@ -60,6 +61,7 @@
__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
EXPORT_SYMBOL(jiffies_64);
+MEMINSPECT_SIMPLE_ENTRY(jiffies_64);
/*
* The timer wheel has LVL_DEPTH array levels. Each level provides an array of
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 07/25] kernel/fork: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (5 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 06/25] timers: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 08/25] mm/page_alloc: " Mukesh Ojha
` (18 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- nr_threads
Information on these annotated variables is stored in a dedicated
meminspect section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/fork.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/fork.c b/kernel/fork.c
index 17d2c2a9af93..5f20b6250259 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -108,6 +108,8 @@
#include <linux/tick.h>
#include <linux/unwind_deferred.h>
#include <linux/pgalloc.h>
+#include <linux/meminspect.h>
+
#include <linux/uaccess.h>
#include <asm/mmu_context.h>
@@ -144,6 +146,7 @@
*/
unsigned long total_forks; /* Handle normal Linux uptimes. */
int nr_threads; /* The idle threads do not count.. */
+MEMINSPECT_SIMPLE_ENTRY(nr_threads);
static int max_threads; /* tunable limit on nr_threads */
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 08/25] mm/page_alloc: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (6 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 07/25] kernel/fork: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 09/25] mm/show_mem: " Mukesh Ojha
` (17 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- node_states
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/page_alloc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 75ee81445640..c28a84d11d49 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -54,6 +54,7 @@
#include <linux/delayacct.h>
#include <linux/cacheinfo.h>
#include <linux/pgalloc_tag.h>
+#include <linux/meminspect.h>
#include <linux/mmzone_lock.h>
#include <asm/div64.h>
#include "internal.h"
@@ -199,6 +200,7 @@ nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
#endif /* NUMA */
};
EXPORT_SYMBOL(node_states);
+MEMINSPECT_SIMPLE_ENTRY(node_states);
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 09/25] mm/show_mem: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (7 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 08/25] mm/page_alloc: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 10/25] mm/swapfile: " Mukesh Ojha
` (16 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- _totalram_pages
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/show_mem.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/show_mem.c b/mm/show_mem.c
index d7d1b6cd6442..f6a92c7d9d1d 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -15,12 +15,14 @@
#include <linux/mmzone_lock.h>
#include <linux/swap.h>
#include <linux/vmstat.h>
+#include <linux/meminspect.h>
#include "internal.h"
#include "swap.h"
atomic_long_t _totalram_pages __read_mostly;
EXPORT_SYMBOL(_totalram_pages);
+MEMINSPECT_SIMPLE_ENTRY(_totalram_pages);
unsigned long totalreserve_pages __read_mostly;
unsigned long totalcma_pages __read_mostly;
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 10/25] mm/swapfile: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (8 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 09/25] mm/show_mem: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 11/25] kernel/vmcore_info: Register dynamic " Mukesh Ojha
` (15 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- nr_swapfiles
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/swapfile.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index f39c3d712273..03aee425bdbd 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -42,6 +42,7 @@
#include <linux/suspend.h>
#include <linux/zswap.h>
#include <linux/plist.h>
+#include <linux/meminspect.h>
#include <asm/tlbflush.h>
#include <linux/leafops.h>
@@ -67,6 +68,7 @@ static void move_cluster(struct swap_info_struct *si,
*/
static DEFINE_SPINLOCK(swap_lock);
static unsigned int nr_swapfiles;
+MEMINSPECT_SIMPLE_ENTRY(nr_swapfiles);
atomic_long_t nr_swap_pages;
/*
* Some modules use swappable objects and may try to swap them out under
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 11/25] kernel/vmcore_info: Register dynamic information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (9 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 10/25] mm/swapfile: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 12/25] kernel/configs: " Mukesh Ojha
` (14 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Register vmcoreinfo information into inspection table. Because the size
of the info is computed after all entries are being added, there is no
point in registering the whole page, rather, call the inspection
registration once everything is in place with the right size. A second
reason is that the vmcoreinfo is added as a region inside the ELF
coreimage note, there is no point in having blank space at the end.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/vmcore_info.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c
index 94e4ef75b1b2..4ebb280dc38a 100644
--- a/kernel/vmcore_info.c
+++ b/kernel/vmcore_info.c
@@ -14,6 +14,7 @@
#include <linux/cpuhotplug.h>
#include <linux/memblock.h>
#include <linux/kmemleak.h>
+#include <linux/meminspect.h>
#include <asm/page.h>
#include <asm/sections.h>
@@ -249,6 +250,9 @@ static int __init crash_save_vmcoreinfo_init(void)
arch_crash_save_vmcoreinfo();
update_vmcoreinfo_note();
+ meminspect_register_id_va(MEMINSPECT_ID_VMCOREINFO,
+ (void *)vmcoreinfo_data, vmcoreinfo_size);
+
return 0;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 12/25] kernel/configs: Register dynamic information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (10 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 11/25] kernel/vmcore_info: Register dynamic " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 13/25] mm/init-mm: Annotate static " Mukesh Ojha
` (13 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Register kernel_config_data information into inspection table.
Debugging tools look for the start and end markers, so we need to
capture those as well into the region.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/configs.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/configs.c b/kernel/configs.c
index a28c79c5f713..1e7b86a8b3fc 100644
--- a/kernel/configs.c
+++ b/kernel/configs.c
@@ -15,6 +15,7 @@
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/uaccess.h>
+#include <linux/meminspect.h>
/*
* "IKCFG_ST" and "IKCFG_ED" are used to extract the config data from
@@ -64,6 +65,11 @@ static int __init ikconfig_init(void)
proc_set_size(entry, &kernel_config_data_end - &kernel_config_data);
+ /* Register 8 bytes before and after, to catch the marker too */
+ meminspect_lock_register_id_va(MEMINSPECT_ID_CONFIG,
+ (void *)&kernel_config_data - 8,
+ &kernel_config_data_end - &kernel_config_data + 16);
+
return 0;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 13/25] mm/init-mm: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (11 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 12/25] kernel/configs: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-12 14:28 ` kernel test robot
2026-03-10 20:15 ` [PATCH v2 14/25] panic: " Mukesh Ojha
` (12 subsequent siblings)
25 siblings, 1 reply; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- init_mm
- swapper_pg_dir
- _sinittext
- _einittext
- _end
- _text
- _stext
- _etext
Information on these variables is stored into dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/init-mm.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/mm/init-mm.c b/mm/init-mm.c
index c5556bb9d5f0..4add144a0e99 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -7,6 +7,7 @@
#include <linux/cpumask.h>
#include <linux/mman.h>
#include <linux/pgtable.h>
+#include <linux/meminspect.h>
#include <linux/atomic.h>
#include <linux/user_namespace.h>
@@ -19,6 +20,13 @@
const struct vm_operations_struct vma_dummy_vm_ops;
+MEMINSPECT_AREA_ENTRY(_sinittext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_einittext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_end, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_text, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_stext, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(_etext, sizeof(void *));
+
/*
* For dynamically allocated mm_structs, there is a dynamically sized cpumask
* at the end of the structure, the size of which depends on the maximum CPU
@@ -51,6 +59,9 @@ struct mm_struct init_mm = {
INIT_MM_CONTEXT(init_mm)
};
+MEMINSPECT_SIMPLE_ENTRY(init_mm);
+MEMINSPECT_AREA_ENTRY(swapper_pg_dir, sizeof(void *));
+
void setup_initial_init_mm(void *start_code, void *end_code,
void *end_data, void *brk)
{
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 14/25] panic: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (12 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 13/25] mm/init-mm: Annotate static " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 15/25] kallsyms: " Mukesh Ojha
` (11 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- tainted_mask
- taint_flags
Information on these variables is stored into dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/panic.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/panic.c b/kernel/panic.c
index 20feada5319d..ea1969d81fd9 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -37,6 +37,7 @@
#include <linux/context_tracking.h>
#include <linux/seq_buf.h>
#include <linux/sys_info.h>
+#include <linux/meminspect.h>
#include <trace/events/error_report.h>
#include <asm/sections.h>
@@ -57,6 +58,7 @@ static unsigned int __read_mostly sysctl_oops_all_cpu_backtrace;
int panic_on_oops = IS_ENABLED(CONFIG_PANIC_ON_OOPS);
static unsigned long tainted_mask =
IS_ENABLED(CONFIG_RANDSTRUCT) ? (1 << TAINT_RANDSTRUCT) : 0;
+MEMINSPECT_SIMPLE_ENTRY(tainted_mask);
static int pause_on_oops;
static int pause_on_oops_flag;
static DEFINE_SPINLOCK(pause_on_oops_lock);
@@ -827,6 +829,8 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
TAINT_FLAG(FWCTL, 'J', ' '),
};
+MEMINSPECT_SIMPLE_ENTRY(taint_flags);
+
#undef TAINT_FLAG
static void print_tainted_seq(struct seq_buf *s, bool verbose)
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 15/25] kallsyms: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (13 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 14/25] panic: " Mukesh Ojha
@ 2026-03-10 20:15 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 16/25] mm/mm_init: " Mukesh Ojha
` (10 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:15 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into meminspect:
- kallsysms_num_syms
- kallsysms_offsets
- kallsysms_names
- kallsyms_token_table
- kallsyms_token_index
- kallsyms_markers
- kallsyms_seqs_of_names
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/kallsyms.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index aec2f06858af..e71c085ec837 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -31,9 +31,18 @@
#include <linux/kernel.h>
#include <linux/bsearch.h>
#include <linux/btf_ids.h>
+#include <linux/meminspect.h>
#include "kallsyms_internal.h"
+MEMINSPECT_SIMPLE_ENTRY(kallsyms_num_syms);
+MEMINSPECT_AREA_ENTRY(kallsyms_offsets, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(kallsyms_names, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(kallsyms_token_table, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(kallsyms_token_index, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(kallsyms_markers, sizeof(void *));
+MEMINSPECT_AREA_ENTRY(kallsyms_seqs_of_names, sizeof(void *));
+
/*
* Expand a compressed symbol data into the resulting uncompressed string,
* if uncompressed string is too long (>= maxlen), it will be truncated,
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 16/25] mm/mm_init: Annotate static information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (14 preceding siblings ...)
2026-03-10 20:15 ` [PATCH v2 15/25] kallsyms: " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 17/25] sched/core: Annotate runqueues " Mukesh Ojha
` (9 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate vital static information into inspection table:
- high_memory
Information on these variables is stored in a dedicated meminspect
section.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/mm_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/mm_init.c b/mm/mm_init.c
index cec7bb758bdd..3cfaea1e0b21 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -32,6 +32,7 @@
#include <linux/vmstat.h>
#include <linux/kexec_handover.h>
#include <linux/hugetlb.h>
+#include <linux/meminspect.h>
#include <linux/mmzone_lock.h>
#include "internal.h"
#include "slab.h"
@@ -53,6 +54,7 @@ EXPORT_SYMBOL(mem_map);
*/
void *high_memory;
EXPORT_SYMBOL(high_memory);
+MEMINSPECT_SIMPLE_ENTRY(high_memory);
unsigned long zero_page_pfn __ro_after_init;
EXPORT_SYMBOL(zero_page_pfn);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 17/25] sched/core: Annotate runqueues into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (15 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 16/25] mm/mm_init: " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 18/25] mm/numa: Register node data information " Mukesh Ojha
` (8 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Annotate runqueues into meminspect. Even if these are static, they are
defined percpu, and a later init call will instantiate them for each
cpu. Hence, we cannot annotate them in the usual way, but rather have to
call meminspect API at init time.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 82afa387d529..09a532a5e9f7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -69,6 +69,7 @@
#include <linux/wait_api.h>
#include <linux/workqueue_api.h>
#include <linux/livepatch_sched.h>
+#include <linux/meminspect.h>
#ifdef CONFIG_PREEMPT_DYNAMIC
# ifdef CONFIG_GENERIC_IRQ_ENTRY
@@ -8804,6 +8805,7 @@ void __init sched_init(void)
rq->core_cookie = 0UL;
#endif
zalloc_cpumask_var_node(&rq->scratch_mask, GFP_KERNEL, cpu_to_node(i));
+ meminspect_lock_register_va(rq, sizeof(*rq));
}
set_load_weight(&init_task, false);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 18/25] mm/numa: Register node data information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (16 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 17/25] sched/core: Annotate runqueues " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 19/25] mm/sparse: Register " Mukesh Ojha
` (7 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
Register dynamic information into meminspect for debugging:
- dynamic node data for each node
Use meminspect_register_pa() to collect node data into meminspect.
Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/numa.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/numa.c b/mm/numa.c
index 7d5e06fe5bd4..fcf31bf2c552 100644
--- a/mm/numa.c
+++ b/mm/numa.c
@@ -4,6 +4,7 @@
#include <linux/printk.h>
#include <linux/numa.h>
#include <linux/numa_memblks.h>
+#include <linux/meminspect.h>
struct pglist_data *node_data[MAX_NUMNODES];
EXPORT_SYMBOL(node_data);
@@ -20,6 +21,7 @@ void __init alloc_node_data(int nid)
if (!nd_pa)
panic("Cannot allocate %zu bytes for node %d data\n",
nd_size, nid);
+ meminspect_register_pa(nd_pa, nd_size);
/* report and initialize */
pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 19/25] mm/sparse: Register information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (17 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 18/25] mm/numa: Register node data information " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 20/25] printk: " Mukesh Ojha
` (6 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
Annotate vital static, dynamic information into meminspect for
debugging:
- mem_section (static)
- section (dynamic)
- mem_section_usage(dynamic)
meminspect uses a different API to annotate variables for inspection,
and information about these variables is stored in the inspection table.
Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
mm/sparse.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/sparse.c b/mm/sparse.c
index dfabe554adf8..38beae2d4294 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -15,6 +15,7 @@
#include <linux/swapops.h>
#include <linux/bootmem_info.h>
#include <linux/vmstat.h>
+#include <linux/meminspect.h>
#include "internal.h"
#include <asm/dma.h>
@@ -30,6 +31,7 @@ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]
____cacheline_internodealigned_in_smp;
#endif
EXPORT_SYMBOL(mem_section);
+MEMINSPECT_SIMPLE_ENTRY(mem_section);
#ifdef NODE_NOT_IN_PAGE_FLAGS
/*
@@ -253,6 +255,7 @@ static void __init memblocks_present(void)
size = sizeof(struct mem_section *) * NR_SECTION_ROOTS;
align = 1 << (INTERNODE_CACHE_SHIFT);
mem_section = memblock_alloc_or_panic(size, align);
+ meminspect_register_va(mem_section, size);
}
#endif
@@ -343,6 +346,9 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
limit = MEMBLOCK_ALLOC_ACCESSIBLE;
goto again;
}
+
+ meminspect_register_va(usage, size);
+
return usage;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 20/25] printk: Register information into meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (18 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 19/25] mm/sparse: Register " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-16 9:39 ` John Ogness
2026-03-10 20:16 ` [PATCH v2 21/25] remoteproc: qcom: Move minidump data structures into its own header Mukesh Ojha
` (5 subsequent siblings)
25 siblings, 1 reply; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
Annotate vital static, dynamic information into meminspect for debugging
Static:
- prb_descs
- prb_infos
- prb
- prb_data
- printk_rb_static
- printk_rb_dynamic
Dynamic:
- new_descs
- new_infos
- new_log_buf
meminspect uses a different API to annotate variables for inspection,
and information about these variables is stored in the inspection table.
Reviewed-by: Petr Mladek <pmladek@suse.com>
Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
kernel/printk/printk.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 0323149548f6..03216e7ef807 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -49,6 +49,7 @@
#include <linux/sched/debug.h>
#include <linux/sched/task_stack.h>
#include <linux/panic.h>
+#include <linux/meminspect.h>
#include <linux/uaccess.h>
#include <asm/sections.h>
@@ -518,10 +519,16 @@ static u32 log_buf_len = __LOG_BUF_LEN;
#endif
_DEFINE_PRINTKRB(printk_rb_static, CONFIG_LOG_BUF_SHIFT - PRB_AVGBITS,
PRB_AVGBITS, &__log_buf[0]);
+MEMINSPECT_NAMED_ENTRY(prb_descs, _printk_rb_static_descs);
+MEMINSPECT_NAMED_ENTRY(prb_infos, _printk_rb_static_infos);
+MEMINSPECT_NAMED_ENTRY(prb_data, __log_buf);
+MEMINSPECT_SIMPLE_ENTRY(printk_rb_static);
static struct printk_ringbuffer printk_rb_dynamic;
+MEMINSPECT_SIMPLE_ENTRY(printk_rb_dynamic);
struct printk_ringbuffer *prb = &printk_rb_static;
+MEMINSPECT_SIMPLE_ENTRY(prb);
/*
* We cannot access per-CPU data (e.g. per-CPU flush irq_work) before
@@ -1238,6 +1245,10 @@ void __init setup_log_buf(int early)
local_irq_restore(flags);
+ meminspect_register_va(new_log_buf, new_log_buf_len);
+ meminspect_register_va(new_descs, new_descs_size);
+ meminspect_register_va(new_infos, new_infos_size);
+
/*
* Copy any remaining messages that might have appeared from
* NMI context after copying but before switching to the
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 21/25] remoteproc: qcom: Move minidump data structures into its own header
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (19 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 20/25] printk: " Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 22/25] soc: qcom: Add minidump backend driver Mukesh Ojha
` (4 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Move the minidump data structures into its own header such that it can
be reused by other drivers. No functional change.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/qcom_common.c | 56 +-------------------------------
include/linux/soc/qcom/minidump.h | 68 +++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 55 deletions(-)
diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 6c31140268ac..864c89f060b1 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -18,6 +18,7 @@
#include <linux/rpmsg/qcom_smd.h>
#include <linux/slab.h>
#include <linux/soc/qcom/mdt_loader.h>
+#include <linux/soc/qcom/minidump.h>
#include <linux/soc/qcom/smem.h>
#include "remoteproc_internal.h"
@@ -28,61 +29,6 @@
#define to_ssr_subdev(d) container_of(d, struct qcom_rproc_ssr, subdev)
#define to_pdm_subdev(d) container_of(d, struct qcom_rproc_pdm, subdev)
-#define MAX_NUM_OF_SS 10
-#define MAX_REGION_NAME_LENGTH 16
-#define SBL_MINIDUMP_SMEM_ID 602
-#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << 0)
-#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << 0)
-#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0)
-
-/**
- * struct minidump_region - Minidump region
- * @name : Name of the region to be dumped
- * @seq_num: : Use to differentiate regions with same name.
- * @valid : This entry to be dumped (if set to 1)
- * @address : Physical address of region to be dumped
- * @size : Size of the region
- */
-struct minidump_region {
- char name[MAX_REGION_NAME_LENGTH];
- __le32 seq_num;
- __le32 valid;
- __le64 address;
- __le64 size;
-};
-
-/**
- * struct minidump_subsystem - Subsystem's SMEM Table of content
- * @status : Subsystem toc init status
- * @enabled : if set to 1, this region would be copied during coredump
- * @encryption_status: Encryption status for this subsystem
- * @encryption_required : Decides to encrypt the subsystem regions or not
- * @region_count : Number of regions added in this subsystem toc
- * @regions_baseptr : regions base pointer of the subsystem
- */
-struct minidump_subsystem {
- __le32 status;
- __le32 enabled;
- __le32 encryption_status;
- __le32 encryption_required;
- __le32 region_count;
- __le64 regions_baseptr;
-};
-
-/**
- * struct minidump_global_toc - Global Table of Content
- * @status : Global Minidump init status
- * @md_revision : Minidump revision
- * @enabled : Minidump enable status
- * @subsystems : Array of subsystems toc
- */
-struct minidump_global_toc {
- __le32 status;
- __le32 md_revision;
- __le32 enabled;
- struct minidump_subsystem subsystems[MAX_NUM_OF_SS];
-};
-
struct qcom_ssr_subsystem {
const char *name;
struct srcu_notifier_head notifier_list;
diff --git a/include/linux/soc/qcom/minidump.h b/include/linux/soc/qcom/minidump.h
new file mode 100644
index 000000000000..25247a6216e2
--- /dev/null
+++ b/include/linux/soc/qcom/minidump.h
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Qualcomm Minidump definitions
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ * Copyright (C) 2015 Sony Mobile Communications Inc
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef __QCOM_MINIDUMP_H__
+#define __QCOM_MINIDUMP_H__
+
+#define MAX_NUM_OF_SS 10
+#define MAX_REGION_NAME_LENGTH 16
+#define SBL_MINIDUMP_SMEM_ID 602
+#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << 0)
+#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << 0)
+#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0)
+
+/**
+ * struct minidump_region - Minidump region
+ * @name : Name of the region to be dumped
+ * @seq_num: : Use to differentiate regions with same name.
+ * @valid : This entry to be dumped (if set to 1)
+ * @address : Physical address of region to be dumped
+ * @size : Size of the region
+ */
+struct minidump_region {
+ char name[MAX_REGION_NAME_LENGTH];
+ __le32 seq_num;
+ __le32 valid;
+ __le64 address;
+ __le64 size;
+};
+
+/**
+ * struct minidump_subsystem - Subsystem's SMEM Table of content
+ * @status : Subsystem toc init status
+ * @enabled : if set to 1, this region would be copied during coredump
+ * @encryption_status: Encryption status for this subsystem
+ * @encryption_required : Decides to encrypt the subsystem regions or not
+ * @region_count : Number of regions added in this subsystem toc
+ * @regions_baseptr : regions base pointer of the subsystem
+ */
+struct minidump_subsystem {
+ __le32 status;
+ __le32 enabled;
+ __le32 encryption_status;
+ __le32 encryption_required;
+ __le32 region_count;
+ __le64 regions_baseptr;
+};
+
+/**
+ * struct minidump_global_toc - Global Table of Content
+ * @status : Global Minidump init status
+ * @md_revision : Minidump revision
+ * @enabled : Minidump enable status
+ * @subsystems : Array of subsystems toc
+ */
+struct minidump_global_toc {
+ __le32 status;
+ __le32 md_revision;
+ __le32 enabled;
+ struct minidump_subsystem subsystems[MAX_NUM_OF_SS];
+};
+
+#endif
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 22/25] soc: qcom: Add minidump backend driver
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (20 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 21/25] remoteproc: qcom: Move minidump data structures into its own header Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 23/25] soc: qcom: smem: Add minidump platform device Mukesh Ojha
` (3 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Qualcomm Minidump is a backend driver that manages the minidump shared
memory table on Qualcomm platforms. It uses the meminspect table that
it parses in order to obtain inspection entries from the kernel and
convert them into regions. Regions are afterwards being registered into
the shared memory's Minidump table of contents. Further, Qualcomm boot
firmware can read the table of contents and dump the memory accordingly,
as per the firmware requirements.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/soc/qcom/Kconfig | 13 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/minidump.c | 272 ++++++++++++++++++++++++++++++++++++++
include/linux/soc/qcom/minidump.h | 4 +
4 files changed, 290 insertions(+)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 2caadbbcf830..be768537528e 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -180,6 +180,19 @@ config QCOM_SMEM
The driver provides an interface to items in a heap shared among all
processors in a Qualcomm platform.
+config QCOM_MINIDUMP
+ tristate "Qualcomm Minidump memory inspection driver"
+ depends on ARCH_QCOM || COMPILE_TEST
+ depends on QCOM_SMEM
+ help
+ Say y here to enable the Qualcomm Minidump memory inspection driver.
+ This driver uses memory inspection mechanism to register minidump
+ regions with the Qualcomm firmware, into the shared memory.
+ The registered regions are being linked into the minidump table
+ of contents.
+ Further on, the firmware will be able to read the table of contents
+ and extract the memory regions on case-by-case basis.
+
config QCOM_SMD_RPM
tristate "Qualcomm Resource Power Manager (RPM) over SMD"
depends on ARCH_QCOM || COMPILE_TEST
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index b7f1d2a57367..3e5a2cacccd4 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -25,6 +25,7 @@ qcom_rpmh-y += rpmh.o
obj-$(CONFIG_QCOM_SMD_RPM) += rpm-proc.o smd-rpm.o
obj-$(CONFIG_QCOM_SMEM) += smem.o
obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
+obj-$(CONFIG_QCOM_MINIDUMP) += minidump.o
CFLAGS_smp2p.o := -I$(src)
obj-$(CONFIG_QCOM_SMP2P) += smp2p.o
obj-$(CONFIG_QCOM_SMSM) += smsm.o
diff --git a/drivers/soc/qcom/minidump.c b/drivers/soc/qcom/minidump.c
new file mode 100644
index 000000000000..8d2e5047b5d9
--- /dev/null
+++ b/drivers/soc/qcom/minidump.c
@@ -0,0 +1,272 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Qualcomm Minidump kernel inspect driver
+ * Copyright (C) 2016,2024-2025 Linaro Ltd
+ * Copyright (C) 2015 Sony Mobile Communications Inc
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/notifier.h>
+#include <linux/sizes.h>
+#include <linux/slab.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/minidump.h>
+#include <linux/meminspect.h>
+
+/**
+ * struct minidump - Minidump driver data information
+ *
+ * @dev: Minidump device struct.
+ * @toc: Minidump table of contents subsystem.
+ * @regions: Minidump regions array.
+ * @nb: Notifier block to register to meminspect.
+ */
+struct minidump {
+ struct device *dev;
+ struct minidump_subsystem *toc;
+ struct minidump_region *regions;
+ struct notifier_block nb;
+};
+
+static const char * const meminspect_id_to_md_string[] = {
+ "",
+ "ELF",
+ "vmcoreinfo",
+ "config",
+ "totalram",
+ "cpu_possible",
+ "cpu_present",
+ "cpu_online",
+ "cpu_active",
+ "mem_section",
+ "jiffies",
+ "linux_banner",
+ "nr_threads",
+ "nr_irqs",
+ "tainted_mask",
+ "taint_flags",
+ "node_states",
+ "__per_cpu_offset",
+ "nr_swapfiles",
+ "init_uts_ns",
+ "printk_rb_static",
+ "printk_rb_dynamic",
+ "prb",
+ "prb_descs",
+ "prb_infos",
+ "prb_data",
+ "high_memory",
+ "init_mm",
+ "init_mm_pgd",
+};
+
+/**
+ * qcom_md_table_init() - Initialize the minidump table
+ * @md: minidump data
+ * @mdss_toc: minidump subsystem table of contents
+ *
+ * Return: On success, it returns 0 and negative error value on failure.
+ */
+static int qcom_md_table_init(struct minidump *md,
+ struct minidump_subsystem *mdss_toc)
+{
+ md->toc = mdss_toc;
+ md->regions = devm_kcalloc(md->dev, MAX_NUM_REGIONS,
+ sizeof(*md->regions), GFP_KERNEL);
+ if (!md->regions)
+ return -ENOMEM;
+
+ md->toc->regions_baseptr = cpu_to_le64(virt_to_phys(md->regions));
+ md->toc->enabled = cpu_to_le32(MINIDUMP_SS_ENABLED);
+ md->toc->status = cpu_to_le32(1);
+ md->toc->region_count = cpu_to_le32(0);
+
+ /* Tell bootloader not to encrypt the regions of this subsystem */
+ md->toc->encryption_status = cpu_to_le32(MINIDUMP_SS_ENCR_DONE);
+ md->toc->encryption_required = cpu_to_le32(MINIDUMP_SS_ENCR_NOTREQ);
+
+ return 0;
+}
+
+/**
+ * qcom_md_get_region_index() - Lookup minidump region by id
+ * @md: minidump data
+ * @id: minidump region id
+ *
+ * Return: On success, it returns the internal region index, on failure,
+ * returns negative error value
+ */
+static int qcom_md_get_region_index(struct minidump *md, int id)
+{
+ unsigned int count = le32_to_cpu(md->toc->region_count);
+ unsigned int i;
+
+ for (i = 0; i < count; i++)
+ if (md->regions[i].seq_num == id)
+ return i;
+
+ return -ENOENT;
+}
+
+/**
+ * register_md_region() - Register a new minidump region
+ * @priv: private data
+ * @e: pointer to inspect entry
+ *
+ * Return: None
+ */
+static void __maybe_unused register_md_region(void *priv,
+ const struct inspect_entry *e)
+{
+ unsigned int num_region, region_cnt;
+ const char *name = "unknown";
+ struct minidump_region *mdr;
+ struct minidump *md = priv;
+
+ if (!(e->va || e->pa) || !e->size) {
+ dev_dbg(md->dev, "invalid region requested\n");
+ return;
+ }
+
+ if (e->id < ARRAY_SIZE(meminspect_id_to_md_string))
+ name = meminspect_id_to_md_string[e->id];
+
+ if (qcom_md_get_region_index(md, e->id) >= 0) {
+ dev_dbg(md->dev, "%s:%d region is already registered\n",
+ name, e->id);
+ return;
+ }
+
+ /* Check if there is a room for a new entry */
+ num_region = le32_to_cpu(md->toc->region_count);
+ if (num_region >= MAX_NUM_REGIONS) {
+ dev_dbg(md->dev, "maximum region limit %u reached\n",
+ num_region);
+ return;
+ }
+
+ region_cnt = le32_to_cpu(md->toc->region_count);
+ mdr = &md->regions[region_cnt];
+ scnprintf(mdr->name, MAX_REGION_NAME_LENGTH, "K%.8s", name);
+ mdr->seq_num = e->id;
+ if (e->pa)
+ mdr->address = cpu_to_le64(e->pa);
+ else if (e->va)
+ mdr->address = cpu_to_le64(__pa(e->va));
+ mdr->size = cpu_to_le64(ALIGN(e->size, 4));
+ mdr->valid = cpu_to_le32(MINIDUMP_REGION_VALID);
+ region_cnt++;
+ md->toc->region_count = cpu_to_le32(region_cnt);
+
+ dev_dbg(md->dev, "%s:%d region registered %llx:%llx\n",
+ mdr->name, mdr->seq_num, mdr->address, mdr->size);
+}
+
+/**
+ * unregister_md_region() - Unregister a previously registered minidump region
+ * @priv: private data
+ * @e: pointer to inspect entry
+ *
+ * Return: None
+ */
+static void __maybe_unused unregister_md_region(void *priv,
+ const struct inspect_entry *e)
+{
+ struct minidump_region *mdr;
+ struct minidump *md = priv;
+ unsigned int region_cnt;
+ unsigned int idx;
+
+ idx = qcom_md_get_region_index(md, e->id);
+ if (idx < 0) {
+ dev_dbg(md->dev, "%d region is not present\n", e->id);
+ return;
+ }
+
+ mdr = &md->regions[0];
+ region_cnt = le32_to_cpu(md->toc->region_count);
+
+ /*
+ * Left shift one position all the regions located after the
+ * region being removed, in order to fill the gap.
+ * Then, zero out the last region at the end.
+ */
+ memmove(&mdr[idx], &mdr[idx + 1], (region_cnt - idx - 1) * sizeof(*mdr));
+ memset(&mdr[region_cnt - 1], 0, sizeof(*mdr));
+ region_cnt--;
+ md->toc->region_count = cpu_to_le32(region_cnt);
+}
+
+static int qcom_md_notifier_cb(struct notifier_block *nb,
+ unsigned long code, void *entry)
+{
+ struct minidump *md = container_of(nb, struct minidump, nb);
+
+ if (code == MEMINSPECT_NOTIFIER_ADD)
+ register_md_region(md, entry);
+ else if (code == MEMINSPECT_NOTIFIER_REMOVE)
+ unregister_md_region(md, entry);
+
+ return 0;
+}
+
+static int qcom_md_probe(struct platform_device *pdev)
+{
+ struct minidump_global_toc *mdgtoc;
+ struct device *dev = &pdev->dev;
+ struct minidump *md;
+ size_t size;
+ int ret;
+
+ md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL);
+ if (!md)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, md);
+
+ md->dev = dev;
+ md->nb.notifier_call = qcom_md_notifier_cb;
+
+ mdgtoc = qcom_smem_get(QCOM_SMEM_HOST_ANY, SBL_MINIDUMP_SMEM_ID, &size);
+ if (IS_ERR(mdgtoc)) {
+ ret = PTR_ERR(mdgtoc);
+ dev_err_probe(dev, ret, "Couldn't find minidump smem item\n");
+ }
+
+ if (size < sizeof(*mdgtoc) || !mdgtoc->status)
+ dev_err_probe(dev, -EINVAL, "minidump table not ready\n");
+
+ ret = qcom_md_table_init(md, &mdgtoc->subsystems[MINIDUMP_SUBSYSTEM_APSS]);
+ if (ret)
+ dev_err_probe(dev, ret, "Could not initialize table\n");
+
+ meminspect_notifier_register(&md->nb);
+
+ meminspect_lock_traverse(md, register_md_region);
+ return 0;
+}
+
+static void qcom_md_remove(struct platform_device *pdev)
+{
+ struct minidump *md = platform_get_drvdata(pdev);
+
+ meminspect_notifier_unregister(&md->nb);
+ meminspect_lock_traverse(md, unregister_md_region);
+}
+
+static struct platform_driver qcom_md_driver = {
+ .probe = qcom_md_probe,
+ .remove = qcom_md_remove,
+ .driver = {
+ .name = "qcom-minidump",
+ },
+};
+
+module_platform_driver(qcom_md_driver);
+
+MODULE_AUTHOR("Eugen Hristev <eugen.hristev@linaro.org>");
+MODULE_AUTHOR("Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>");
+MODULE_DESCRIPTION("Qualcomm minidump inspect driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/soc/qcom/minidump.h b/include/linux/soc/qcom/minidump.h
index 25247a6216e2..f90b61feb550 100644
--- a/include/linux/soc/qcom/minidump.h
+++ b/include/linux/soc/qcom/minidump.h
@@ -10,12 +10,16 @@
#ifndef __QCOM_MINIDUMP_H__
#define __QCOM_MINIDUMP_H__
+#define MINIDUMP_SUBSYSTEM_APSS 0
#define MAX_NUM_OF_SS 10
#define MAX_REGION_NAME_LENGTH 16
#define SBL_MINIDUMP_SMEM_ID 602
#define MINIDUMP_REGION_VALID ('V' << 24 | 'A' << 16 | 'L' << 8 | 'I' << 0)
#define MINIDUMP_SS_ENCR_DONE ('D' << 24 | 'O' << 16 | 'N' << 8 | 'E' << 0)
+#define MINIDUMP_SS_ENCR_NOTREQ (0 << 24 | 0 << 16 | 'N' << 8 | 'R' << 0)
#define MINIDUMP_SS_ENABLED ('E' << 24 | 'N' << 16 | 'B' << 8 | 'L' << 0)
+#define MAX_NUM_REGIONS 201
+
/**
* struct minidump_region - Minidump region
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 23/25] soc: qcom: smem: Add minidump platform device
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (21 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 22/25] soc: qcom: Add minidump backend driver Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Mukesh Ojha
` (2 subsequent siblings)
25 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
Minidump can collect various memory snippets using Qualcomm boot firmware
support. To determine which snippets should be collected, each snippet
must be registered by the kernel into a shared memory table managed by
the Qualcomm SMEM driver. To instantiate the minidump platform driver,
register its data using platform_device_register_data(). The minidump
driver will later probe the device and retrieve the required memory
snippets from the memory inspection table (meminspect).
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/soc/qcom/smem.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index d5c94b47f431..65d7b4d99677 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -270,6 +270,7 @@ struct smem_region {
* @partitions: list of partitions of current processor/host
* @item_count: max accepted item number
* @socinfo: platform device pointer
+ * @mdinfo: minidump device pointer
* @num_regions: number of @regions
* @regions: list of the memory regions defining the shared memory
*/
@@ -280,6 +281,7 @@ struct qcom_smem {
u32 item_count;
struct platform_device *socinfo;
+ struct platform_device *mdinfo;
struct smem_ptable *ptable;
struct smem_partition global_partition;
struct smem_partition partitions[SMEM_HOST_COUNT];
@@ -1242,12 +1244,20 @@ static int qcom_smem_probe(struct platform_device *pdev)
if (IS_ERR(smem->socinfo))
dev_dbg(&pdev->dev, "failed to register socinfo device\n");
+ smem->mdinfo = platform_device_register_data(&pdev->dev, "qcom-minidump",
+ PLATFORM_DEVID_AUTO, NULL,
+ 0);
+ if (IS_ERR(smem->mdinfo))
+ dev_err(&pdev->dev, "failed to register platform md device\n");
+
return 0;
}
static void qcom_smem_remove(struct platform_device *pdev)
{
platform_device_unregister(__smem->socinfo);
+ if (!IS_ERR(__smem->mdinfo))
+ platform_device_unregister(__smem->mdinfo);
/* Set to -EPROBE_DEFER to signal unprobed state */
__smem = ERR_PTR(-EPROBE_DEFER);
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (22 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 23/25] soc: qcom: smem: Add minidump platform device Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-11 9:05 ` Krzysztof Kozlowski
2026-03-10 20:16 ` [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver Mukesh Ojha
2026-03-16 2:24 ` [PATCH v2 00/25] Introduce meminspect Bjorn Andersson
25 siblings, 1 reply; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
Add documentation for Google Kinfo Pixel reserved memory area.
Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
.../bindings/reserved-memory/google,kinfo.yaml | 46 ++++++++++++++++++++++
MAINTAINERS | 6 +++
2 files changed, 52 insertions(+)
diff --git a/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
new file mode 100644
index 000000000000..2f964151f0c0
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reserved-memory/google,kinfo.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Google Pixel Kinfo reserved memory
+
+maintainers:
+ - Eugen Hristev <eugen.hristev@linaro.org>
+ - Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
+
+description: |
+ This binding represents reserved-memory used to store data for firmware/bootloader
+ on the Pixel platform. The stored data is debugging information of the running
+ kernel.
+
+allOf:
+ - $ref: reserved-memory.yaml
+
+properties:
+ compatible:
+ const: google,debug-kinfo
+
+ reg:
+ description: page-aligned region of memory containing debugging data of running kernel
+
+required:
+ - compatible
+ - reg
+ - no-map
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ reserved-memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ debug-kinfo@fa00000 {
+ compatible = "google,debug-kinfo";
+ reg = <0xfa00000 0x1000>;
+ no-map;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index ebf478dbd15c..2504b7df0e7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16592,6 +16592,12 @@ F: Documentation/dev-tools/meminspect.rst
F: include/linux/meminspect.h
F: kernel/meminspect/*
+MEMINSPECT KINFO DRIVER
+M: Eugen Hristev <eugen.hristev@linaro.org>
+M: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
+S: Maintained
+F: Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
+
MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION
M: Mike Rapoport <rppt@kernel.org>
L: linux-mm@kvack.org
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (23 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Mukesh Ojha
@ 2026-03-10 20:16 ` Mukesh Ojha
2026-03-11 9:09 ` Krzysztof Kozlowski
2026-03-11 22:07 ` Randy Dunlap
2026-03-16 2:24 ` [PATCH v2 00/25] Introduce meminspect Bjorn Andersson
25 siblings, 2 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-10 20:16 UTC (permalink / raw)
To: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
From: Eugen Hristev <eugen.hristev@linaro.org>
With this driver, the registered regions are copied to a shared memory
zone at register time. The shared memory zone is supplied via OF. This
driver will select only regions that are of interest, and keep only
addresses. The format of the list is Kinfo compatible, with devices like
Google Pixel phone. The firmware is only interested in some symbols'
addresses.
Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
MAINTAINERS | 1 +
drivers/of/platform.c | 1 +
kernel/meminspect/Kconfig | 11 ++
kernel/meminspect/Makefile | 1 +
kernel/meminspect/kinfo.c | 284 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 298 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 2504b7df0e7d..48b5457fae98 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16597,6 +16597,7 @@ M: Eugen Hristev <eugen.hristev@linaro.org>
M: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
S: Maintained
F: Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
+F: kernel/meminspect/kinfo.c
MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION
M: Mike Rapoport <rppt@kernel.org>
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 2a7111e8354d..09047e021de4 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -495,6 +495,7 @@ static const struct of_device_id reserved_mem_matches[] = {
{ .compatible = "ramoops" },
{ .compatible = "nvmem-rmem" },
{ .compatible = "google,open-dice" },
+ { .compatible = "google,debug-kinfo" },
{}
};
diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig
index fa2b5a84b251..396510908e47 100644
--- a/kernel/meminspect/Kconfig
+++ b/kernel/meminspect/Kconfig
@@ -17,3 +17,14 @@ config MEMINSPECT
Note that modules using this feature must be rebuilt if option
changes.
+
+config MEMINSPECT_KINFO
+ tristate "Shared memory KInfo compatible driver"
+ depends on MEMINSPECT
+ help
+ Say y here to enable the Shared memory KInfo compatible driver
+ With this driver, the registered regions are copied to a shared
+ memory zone at register time.
+ The shared memory zone is supplied via OF.
+ This driver will select only regions that are of interest,
+ and keep only addresses. The format of the list is Kinfo compatible.
diff --git a/kernel/meminspect/Makefile b/kernel/meminspect/Makefile
index 09fd55e6d9cf..283604d892e5 100644
--- a/kernel/meminspect/Makefile
+++ b/kernel/meminspect/Makefile
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_MEMINSPECT) += meminspect.o
+obj-$(CONFIG_MEMINSPECT_KINFO) += kinfo.o
diff --git a/kernel/meminspect/kinfo.c b/kernel/meminspect/kinfo.c
new file mode 100644
index 000000000000..79918908968d
--- /dev/null
+++ b/kernel/meminspect/kinfo.c
@@ -0,0 +1,284 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *
+ * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
+ * Copyright 2021 Google LLC
+ * Copyright 2025 Linaro Ltd. Eugen Hristev <eugen.hristev@linaro.org>
+ */
+#include <linux/container_of.h>
+#include <linux/kallsyms.h>
+#include <linux/meminspect.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/utsname.h>
+
+#define BUILD_INFO_LEN 256
+#define DEBUG_KINFO_MAGIC 0xcceeddff
+
+/*
+ * Header structure must be byte-packed, since the table is provided to
+ * bootloader.
+ */
+struct kernel_info {
+ /* For kallsyms */
+ u8 enabled_all;
+ u8 enabled_base_relative;
+ u8 enabled_absolute_percpu;
+ u8 enabled_cfi_clang;
+ u32 num_syms;
+ u16 name_len;
+ u16 bit_per_long;
+ u16 module_name_len;
+ u16 symbol_len;
+ u64 _relative_pa;
+ u64 _text_pa;
+ u64 _stext_pa;
+ u64 _etext_pa;
+ u64 _sinittext_pa;
+ u64 _einittext_pa;
+ u64 _end_pa;
+ u64 _offsets_pa;
+ u64 _names_pa;
+ u64 _token_table_pa;
+ u64 _token_index_pa;
+ u64 _markers_pa;
+ u64 _seqs_of_names_pa;
+
+ /* For frame pointer */
+ u32 thread_size;
+
+ /* For virt_to_phys */
+ u64 swapper_pg_dir_pa;
+
+ /* For linux banner */
+ u8 last_uts_release[__NEW_UTS_LEN];
+
+ /* Info of running build */
+ u8 build_info[BUILD_INFO_LEN];
+
+ /* For module kallsyms */
+ u32 enabled_modules_tree_lookup;
+ u32 mod_mem_offset;
+ u32 mod_kallsyms_offset;
+} __packed;
+
+struct kernel_all_info {
+ u32 magic_number;
+ u32 combined_checksum;
+ struct kernel_info info;
+} __packed;
+
+struct debug_kinfo {
+ struct device *dev;
+ void *all_info_addr;
+ size_t all_info_size;
+ struct notifier_block nb;
+};
+
+static void update_kernel_all_info(struct kernel_all_info *all_info)
+{
+ struct kernel_info *info;
+ u32 *checksum_info;
+ int index;
+
+ all_info->magic_number = DEBUG_KINFO_MAGIC;
+ all_info->combined_checksum = 0;
+
+ info = &all_info->info;
+ checksum_info = (u32 *)info;
+ for (index = 0; index < sizeof(*info) / sizeof(u32); index++)
+ all_info->combined_checksum ^= checksum_info[index];
+}
+
+static u8 global_build_info[BUILD_INFO_LEN];
+
+static int build_info_set(const char *str, const struct kernel_param *kp)
+{
+ size_t build_info_size = sizeof(global_build_info);
+
+ if (strlen(str) > build_info_size)
+ return -ENOMEM;
+ memcpy(global_build_info, str, min(build_info_size - 1, strlen(str)));
+ return 0;
+}
+
+static const struct kernel_param_ops build_info_op = {
+ .set = build_info_set,
+};
+
+module_param_cb(build_info, &build_info_op, NULL, 0200);
+MODULE_PARM_DESC(build_info, "Write build info to field 'build_info' of debug kinfo.");
+
+static void __maybe_unused register_kinfo_region(void *priv,
+ const struct inspect_entry *e)
+{
+ struct debug_kinfo *kinfo = priv;
+ struct kernel_all_info *all_info = kinfo->all_info_addr;
+ struct kernel_info *info = &all_info->info;
+ struct uts_namespace *uts;
+ u64 paddr;
+
+ if (e->pa)
+ paddr = e->pa;
+ else
+ paddr = __pa(e->va);
+
+ switch (e->id) {
+ case MEMINSPECT_ID__sinittext:
+ info->_sinittext_pa = paddr;
+ break;
+ case MEMINSPECT_ID__einittext:
+ info->_einittext_pa = paddr;
+ break;
+ case MEMINSPECT_ID__end:
+ info->_end_pa = paddr;
+ break;
+ case MEMINSPECT_ID__text:
+ info->_text_pa = paddr;
+ break;
+ case MEMINSPECT_ID__stext:
+ info->_stext_pa = paddr;
+ break;
+ case MEMINSPECT_ID__etext:
+ info->_etext_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_num_syms:
+ info->num_syms = *(__u32 *)e->va;
+ break;
+ case MEMINSPECT_ID_kallsyms_relative_base:
+ info->_relative_pa = (u64)__pa(*(u64 *)e->va);
+ break;
+ case MEMINSPECT_ID_kallsyms_offsets:
+ info->_offsets_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_names:
+ info->_names_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_token_table:
+ info->_token_table_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_token_index:
+ info->_token_index_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_markers:
+ info->_markers_pa = paddr;
+ break;
+ case MEMINSPECT_ID_kallsyms_seqs_of_names:
+ info->_seqs_of_names_pa = paddr;
+ break;
+ case MEMINSPECT_ID_swapper_pg_dir:
+ info->swapper_pg_dir_pa = paddr;
+ break;
+ case MEMINSPECT_ID_init_uts_ns:
+ if (!e->va)
+ return;
+ uts = e->va;
+ strscpy(info->last_uts_release, uts->name.release, __NEW_UTS_LEN);
+ break;
+ default:
+ break;
+ };
+
+ update_kernel_all_info(all_info);
+}
+
+static int kinfo_notifier_cb(struct notifier_block *nb,
+ unsigned long code, void *entry)
+{
+ struct debug_kinfo *kinfo = container_of(nb, struct debug_kinfo, nb);
+
+ if (code == MEMINSPECT_NOTIFIER_ADD)
+ register_kinfo_region(kinfo, entry);
+
+ return NOTIFY_DONE;
+}
+
+static int debug_kinfo_probe(struct platform_device *pdev)
+{
+ struct kernel_all_info *all_info;
+ struct device *dev = &pdev->dev;
+ struct reserved_mem *rmem;
+ struct debug_kinfo *kinfo;
+ struct kernel_info *info;
+
+ rmem = of_reserved_mem_lookup(dev->of_node);
+ if (!rmem)
+ return dev_err_probe(dev, -ENODEV, "no such reserved mem of node name %s\n",
+ dev->of_node->name);
+
+ /* Need to wait for reserved memory to be mapped */
+ if (!rmem->priv)
+ return -EPROBE_DEFER;
+
+ if (!rmem->base || !rmem->size)
+ dev_err_probe(dev, -EINVAL, "unexpected reserved memory\n");
+
+ if (rmem->size < sizeof(struct kernel_all_info))
+ dev_err_probe(dev, -EINVAL, "reserved memory size too small\n");
+
+ kinfo = devm_kzalloc(dev, sizeof(*kinfo), GFP_KERNEL);
+ if (!kinfo)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, kinfo);
+
+ kinfo->dev = dev;
+ kinfo->all_info_addr = rmem->priv;
+ kinfo->all_info_size = rmem->size;
+
+ all_info = kinfo->all_info_addr;
+
+ memset(all_info, 0, sizeof(struct kernel_all_info));
+ info = &all_info->info;
+ info->enabled_all = IS_ENABLED(CONFIG_KALLSYMS_ALL);
+ info->enabled_absolute_percpu = IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PERCPU);
+ info->enabled_base_relative = IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE);
+ info->enabled_cfi_clang = IS_ENABLED(CONFIG_CFI_CLANG);
+ info->name_len = KSYM_NAME_LEN;
+ info->bit_per_long = BITS_PER_LONG;
+ info->module_name_len = MODULE_NAME_LEN;
+ info->symbol_len = KSYM_SYMBOL_LEN;
+ info->thread_size = THREAD_SIZE;
+ info->enabled_modules_tree_lookup = IS_ENABLED(CONFIG_MODULES_TREE_LOOKUP);
+ info->mod_mem_offset = offsetof(struct module, mem);
+ info->mod_kallsyms_offset = offsetof(struct module, kallsyms);
+
+ memcpy(info->build_info, global_build_info, strlen(global_build_info));
+
+ kinfo->nb.notifier_call = kinfo_notifier_cb;
+
+ meminspect_notifier_register(&kinfo->nb);
+ meminspect_lock_traverse(kinfo, register_kinfo_region);
+
+ return 0;
+}
+
+static void debug_kinfo_remove(struct platform_device *pdev)
+{
+ struct debug_kinfo *kinfo = platform_get_drvdata(pdev);
+
+ meminspect_notifier_unregister(&kinfo->nb);
+}
+
+static const struct of_device_id debug_kinfo_of_match[] = {
+ { .compatible = "google,debug-kinfo" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, debug_kinfo_of_match);
+
+static struct platform_driver debug_kinfo_driver = {
+ .probe = debug_kinfo_probe,
+ .remove = debug_kinfo_remove,
+ .driver = {
+ .name = "debug-kinfo",
+ .of_match_table = of_match_ptr(debug_kinfo_of_match),
+ },
+};
+module_platform_driver(debug_kinfo_driver);
+
+MODULE_AUTHOR("Eugen Hristev <eugen.hristev@linaro.org>");
+MODULE_AUTHOR("Jone Chou <jonechou@google.com>");
+MODULE_DESCRIPTION("meminspect Kinfo Driver");
+MODULE_LICENSE("GPL");
--
2.50.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
2026-03-10 20:16 ` [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Mukesh Ojha
@ 2026-03-11 9:05 ` Krzysztof Kozlowski
2026-03-16 11:12 ` Mukesh Ojha
0 siblings, 1 reply; 42+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-11 9:05 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan, workflows, linux-doc, linux-kernel, linux-arch,
linux-mm, linux-arm-msm, linux-remoteproc, devicetree
On Wed, Mar 11, 2026 at 01:46:08AM +0530, Mukesh Ojha wrote:
> Add documentation for Google Kinfo Pixel reserved memory area.
>
> Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
> Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
> .../bindings/reserved-memory/google,kinfo.yaml | 46 ++++++++++++++++++++++
> MAINTAINERS | 6 +++
> 2 files changed, 52 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
> new file mode 100644
> index 000000000000..2f964151f0c0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
Nothing improved, read previous feedback.
> @@ -0,0 +1,46 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reserved-memory/google,kinfo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Google Pixel Kinfo reserved memory
> +
> +maintainers:
> + - Eugen Hristev <eugen.hristev@linaro.org>
> + - Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> +
> +description: |
Do not need '|' unless you need to preserve formatting.
> + This binding represents reserved-memory used to store data for firmware/bootloader
Nothing improved.
> + on the Pixel platform. The stored data is debugging information of the running
> + kernel.
> +
> +allOf:
> + - $ref: reserved-memory.yaml
> +
> +properties:
> + compatible:
> + const: google,debug-kinfo
> +
> + reg:
> + description: page-aligned region of memory containing debugging data of running kernel
Missing constraints.
Please wrap code according to the preferred limit expressed in Kernel
coding style (checkpatch is not a coding style description, but only a
tool). However don't wrap blindly (see Kernel coding style).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver
2026-03-10 20:16 ` [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver Mukesh Ojha
@ 2026-03-11 9:09 ` Krzysztof Kozlowski
2026-03-11 22:07 ` Randy Dunlap
1 sibling, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-11 9:09 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan, workflows, linux-doc, linux-kernel, linux-arch,
linux-mm, linux-arm-msm, linux-remoteproc, devicetree
On Wed, Mar 11, 2026 at 01:46:09AM +0530, Mukesh Ojha wrote:
> From: Eugen Hristev <eugen.hristev@linaro.org>
>
> With this driver, the registered regions are copied to a shared memory
> zone at register time. The shared memory zone is supplied via OF. This
> driver will select only regions that are of interest, and keep only
> addresses. The format of the list is Kinfo compatible, with devices like
> Google Pixel phone. The firmware is only interested in some symbols'
> addresses.
>
> Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
> MAINTAINERS | 1 +
> drivers/of/platform.c | 1 +
> kernel/meminspect/Kconfig | 11 ++
> kernel/meminspect/Makefile | 1 +
> kernel/meminspect/kinfo.c | 284 +++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 298 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2504b7df0e7d..48b5457fae98 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16597,6 +16597,7 @@ M: Eugen Hristev <eugen.hristev@linaro.org>
> M: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> S: Maintained
> F: Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
> +F: kernel/meminspect/kinfo.c
>
> MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION
> M: Mike Rapoport <rppt@kernel.org>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 2a7111e8354d..09047e021de4 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -495,6 +495,7 @@ static const struct of_device_id reserved_mem_matches[] = {
> { .compatible = "ramoops" },
> { .compatible = "nvmem-rmem" },
> { .compatible = "google,open-dice" },
> + { .compatible = "google,debug-kinfo" },
place it before open-dice
> {}
> };
>
> diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig
> index fa2b5a84b251..396510908e47 100644
> --- a/kernel/meminspect/Kconfig
> +++ b/kernel/meminspect/Kconfig
> @@ -17,3 +17,14 @@ config MEMINSPECT
>
> Note that modules using this feature must be rebuilt if option
> changes.
> +
> +config MEMINSPECT_KINFO
> + tristate "Shared memory KInfo compatible driver"
> + depends on MEMINSPECT
> + help
> + Say y here to enable the Shared memory KInfo compatible driver
> + With this driver, the registered regions are copied to a shared
> + memory zone at register time.
> + The shared memory zone is supplied via OF.
> + This driver will select only regions that are of interest,
> + and keep only addresses. The format of the list is Kinfo compatible.
> diff --git a/kernel/meminspect/Makefile b/kernel/meminspect/Makefile
> index 09fd55e6d9cf..283604d892e5 100644
> --- a/kernel/meminspect/Makefile
> +++ b/kernel/meminspect/Makefile
> @@ -1,3 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0
>
> obj-$(CONFIG_MEMINSPECT) += meminspect.o
> +obj-$(CONFIG_MEMINSPECT_KINFO) += kinfo.o
> diff --git a/kernel/meminspect/kinfo.c b/kernel/meminspect/kinfo.c
> new file mode 100644
> index 000000000000..79918908968d
> --- /dev/null
> +++ b/kernel/meminspect/kinfo.c
> @@ -0,0 +1,284 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + *
> + * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
> + * Copyright 2021 Google LLC
> + * Copyright 2025 Linaro Ltd. Eugen Hristev <eugen.hristev@linaro.org>
> + */
> +#include <linux/container_of.h>
> +#include <linux/kallsyms.h>
> +#include <linux/meminspect.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_reserved_mem.h>
> +#include <linux/platform_device.h>
> +#include <linux/utsname.h>
> +
> +#define BUILD_INFO_LEN 256
> +#define DEBUG_KINFO_MAGIC 0xcceeddff
> +
> +/*
> + * Header structure must be byte-packed, since the table is provided to
> + * bootloader.
> + */
> +struct kernel_info {
> + /* For kallsyms */
> + u8 enabled_all;
> + u8 enabled_base_relative;
> + u8 enabled_absolute_percpu;
> + u8 enabled_cfi_clang;
> + u32 num_syms;
> + u16 name_len;
> + u16 bit_per_long;
> + u16 module_name_len;
> + u16 symbol_len;
> + u64 _relative_pa;
> + u64 _text_pa;
> + u64 _stext_pa;
> + u64 _etext_pa;
> + u64 _sinittext_pa;
> + u64 _einittext_pa;
> + u64 _end_pa;
> + u64 _offsets_pa;
> + u64 _names_pa;
> + u64 _token_table_pa;
> + u64 _token_index_pa;
> + u64 _markers_pa;
> + u64 _seqs_of_names_pa;
> +
> + /* For frame pointer */
> + u32 thread_size;
> +
> + /* For virt_to_phys */
> + u64 swapper_pg_dir_pa;
> +
> + /* For linux banner */
> + u8 last_uts_release[__NEW_UTS_LEN];
> +
> + /* Info of running build */
> + u8 build_info[BUILD_INFO_LEN];
> +
> + /* For module kallsyms */
> + u32 enabled_modules_tree_lookup;
> + u32 mod_mem_offset;
> + u32 mod_kallsyms_offset;
> +} __packed;
> +
> +struct kernel_all_info {
> + u32 magic_number;
> + u32 combined_checksum;
> + struct kernel_info info;
> +} __packed;
> +
> +struct debug_kinfo {
> + struct device *dev;
> + void *all_info_addr;
> + size_t all_info_size;
> + struct notifier_block nb;
> +};
> +
> +static void update_kernel_all_info(struct kernel_all_info *all_info)
> +{
> + struct kernel_info *info;
> + u32 *checksum_info;
> + int index;
> +
> + all_info->magic_number = DEBUG_KINFO_MAGIC;
> + all_info->combined_checksum = 0;
> +
> + info = &all_info->info;
> + checksum_info = (u32 *)info;
> + for (index = 0; index < sizeof(*info) / sizeof(u32); index++)
> + all_info->combined_checksum ^= checksum_info[index];
> +}
> +
> +static u8 global_build_info[BUILD_INFO_LEN];
Don't create singletons. That's a driver so you can have multiple
instances of it.
> +
> +static int build_info_set(const char *str, const struct kernel_param *kp)
> +{
> + size_t build_info_size = sizeof(global_build_info);
> +
> + if (strlen(str) > build_info_size)
> + return -ENOMEM;
> + memcpy(global_build_info, str, min(build_info_size - 1, strlen(str)));
> + return 0;
> +}
> +
> +static const struct kernel_param_ops build_info_op = {
> + .set = build_info_set,
> +};
> +
> +module_param_cb(build_info, &build_info_op, NULL, 0200);
> +MODULE_PARM_DESC(build_info, "Write build info to field 'build_info' of debug kinfo.");
Drop. Build info is a static, fixed information, there is no need to write it
from user-space.
...
> + memset(all_info, 0, sizeof(struct kernel_all_info));
> + info = &all_info->info;
> + info->enabled_all = IS_ENABLED(CONFIG_KALLSYMS_ALL);
> + info->enabled_absolute_percpu = IS_ENABLED(CONFIG_KALLSYMS_ABSOLUTE_PERCPU);
> + info->enabled_base_relative = IS_ENABLED(CONFIG_KALLSYMS_BASE_RELATIVE);
> + info->enabled_cfi_clang = IS_ENABLED(CONFIG_CFI_CLANG);
> + info->name_len = KSYM_NAME_LEN;
> + info->bit_per_long = BITS_PER_LONG;
> + info->module_name_len = MODULE_NAME_LEN;
> + info->symbol_len = KSYM_SYMBOL_LEN;
> + info->thread_size = THREAD_SIZE;
> + info->enabled_modules_tree_lookup = IS_ENABLED(CONFIG_MODULES_TREE_LOOKUP);
> + info->mod_mem_offset = offsetof(struct module, mem);
> + info->mod_kallsyms_offset = offsetof(struct module, kallsyms);
> +
> + memcpy(info->build_info, global_build_info, strlen(global_build_info));
> +
> + kinfo->nb.notifier_call = kinfo_notifier_cb;
> +
> + meminspect_notifier_register(&kinfo->nb);
> + meminspect_lock_traverse(kinfo, register_kinfo_region);
> +
> + return 0;
> +}
> +
> +static void debug_kinfo_remove(struct platform_device *pdev)
> +{
> + struct debug_kinfo *kinfo = platform_get_drvdata(pdev);
> +
> + meminspect_notifier_unregister(&kinfo->nb);
> +}
> +
> +static const struct of_device_id debug_kinfo_of_match[] = {
> + { .compatible = "google,debug-kinfo" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, debug_kinfo_of_match);
> +
> +static struct platform_driver debug_kinfo_driver = {
> + .probe = debug_kinfo_probe,
> + .remove = debug_kinfo_remove,
> + .driver = {
> + .name = "debug-kinfo",
> + .of_match_table = of_match_ptr(debug_kinfo_of_match),
Drop of_match_ptr, you have warning here.
> + },
> +};
> +module_platform_driver(debug_kinfo_driver);
> +
> +MODULE_AUTHOR("Eugen Hristev <eugen.hristev@linaro.org>");
> +MODULE_AUTHOR("Jone Chou <jonechou@google.com>");
> +MODULE_DESCRIPTION("meminspect Kinfo Driver");
> +MODULE_LICENSE("GPL");
>
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver
2026-03-10 20:16 ` [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver Mukesh Ojha
2026-03-11 9:09 ` Krzysztof Kozlowski
@ 2026-03-11 22:07 ` Randy Dunlap
1 sibling, 0 replies; 42+ messages in thread
From: Randy Dunlap @ 2026-03-11 22:07 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On 3/10/26 1:16 PM, Mukesh Ojha wrote:
> diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig
> index fa2b5a84b251..396510908e47 100644
> --- a/kernel/meminspect/Kconfig
> +++ b/kernel/meminspect/Kconfig
> @@ -17,3 +17,14 @@ config MEMINSPECT
>
> Note that modules using this feature must be rebuilt if option
> changes.
> +
> +config MEMINSPECT_KINFO
> + tristate "Shared memory KInfo compatible driver"
> + depends on MEMINSPECT
> + help
> + Say y here to enable the Shared memory KInfo compatible driver
Use a period (full stop) ('.') at the end of the sentence above.
> + With this driver, the registered regions are copied to a shared
> + memory zone at register time.
> + The shared memory zone is supplied via OF.
> + This driver will select only regions that are of interest,
> + and keep only addresses. The format of the list is Kinfo compatible.
--
~Randy
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 01/25] kernel: Introduce meminspect
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
@ 2026-03-12 4:33 ` Randy Dunlap
2026-03-12 4:46 ` Randy Dunlap
1 sibling, 0 replies; 42+ messages in thread
From: Randy Dunlap @ 2026-03-12 4:33 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On 3/10/26 1:15 PM, Mukesh Ojha wrote:
> diff --git a/kernel/meminspect/Kconfig b/kernel/meminspect/Kconfig
> new file mode 100644
> index 000000000000..fa2b5a84b251
> --- /dev/null
> +++ b/kernel/meminspect/Kconfig
> @@ -0,0 +1,19 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +config MEMINSPECT
> + bool "Allow the kernel to register memory regions for inspection purpose"
purposes"
> + help
> + Inspection mechanism allows registration of a specific memory
> + area(or object) for later inspection purpose.
area (or object) purposes.
> + Ranges are being added into an inspection table, which can be
are added
> + requested and analyzed by specific drivers.
> + Drivers would interface any hardware mechanism that will allow
> + inspection of the data, including but not limited to: dumping
> + for debugging, creating a coredump, analysis, or statistical
> + information.
> + Inspection table is created ahead of time such that it can be later
The inspection table
> + used regardless of the state of the kernel (running, frozen, crashed,
> + or any particular state).
> +
> + Note that modules using this feature must be rebuilt if option
if this option
> + changes.
--
~Randy
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 01/25] kernel: Introduce meminspect
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
2026-03-12 4:33 ` Randy Dunlap
@ 2026-03-12 4:46 ` Randy Dunlap
2026-03-16 8:31 ` Mukesh Ojha
1 sibling, 1 reply; 42+ messages in thread
From: Randy Dunlap @ 2026-03-12 4:46 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On 3/10/26 1:15 PM, Mukesh Ojha wrote:
> diff --git a/Documentation/dev-tools/meminspect.rst b/Documentation/dev-tools/meminspect.rst
> new file mode 100644
> index 000000000000..d0c7222bdcd7
> --- /dev/null
> +++ b/Documentation/dev-tools/meminspect.rst
> @@ -0,0 +1,144 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +==========
> +meminspect
> +==========
> +
> +This document provides information about the meminspect feature.
> +
> +Overview
> +========
> +
> +meminspect is a mechanism that allows the kernel to register a chunk of
> +memory into a table, to be used at a later time for a specific
> +inspection purpose like debugging, memory dumping or statistics.
> +
> +meminspect allows drivers to traverse the inspection table on demand,
> +or to register a notifier to be called whenever a new entry is being added
preferably... is added
> +or removed.
> +
> +The reasoning for meminspect is also to minimize the required information
> +in case of a kernel problem. For example a traditional debug method involves
> +dumping the whole kernel memory and then inspecting it. Meminspect allows the
> +users to select which memory is of interest, in order to help this specific
> +use case in production, where memory and connectivity are limited.
> +
> +Although the kernel has multiple internal mechanisms, meminspect fits
> +a particular model which is not covered by the others.
> +
> +meminspect Internals
> +====================
> +
> +API
> +---
> +
> +Static memory can be registered at compile time, by instructing the compiler
> +to create a separate section with annotation info.
> +For each such annotated memory (variables usually), a dedicated struct
> +is being created with the required information.
is created
> +To achieve this goal, some basic APIs are available:
> +
> +* MEMINSPECT_ENTRY(idx, sym, sz)
> + is the basic macro that takes an ID, the symbol, and a size.
> +
> +To make it easier, some wrappers are also defined
> +
> +* MEMINSPECT_SIMPLE_ENTRY(sym)
> + will use the dedicated MEMINSPECT_ID_##sym with a size equal to sizeof(sym)
uses the dedicated
> +
> +* MEMINSPECT_NAMED_ENTRY(name, sym)
> + will be a simple entry that has an id that cannot be derived from the sym,
is a simple entry that
> + so a name has to be provided
> +
> +* MEMINSPECT_AREA_ENTRY(sym, sz)
> + this will register sym, but with the size given as sz, useful for e.g.
registers sym, but with
> + arrays which do not have a fixed size at compile time.
> +
> +For dynamically allocated memory, or for other cases, the following APIs
> +are being defined::
are defined::
> +
> + meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone,
> + size_t size, unsigned int type);
> +
> +which takes the ID and the physical address.
> +
> +Similarly there are variations:
> +
> + * meminspect_register_pa() omits the ID
> + * meminspect_register_id_va() requires the ID but takes a virtual address
> + * meminspect_register_va() omits the ID and requires a virtual address
> +
> +If the ID is not given, the next avialable dynamic ID is allocated.
available
> +
> +To unregister a dynamic entry, some APIs are being defined:
are defined:
> + * meminspect_unregister_pa(phys_addr_t zone, size_t size);
> + * meminspect_unregister_id(enum meminspect_uid id);
> + * meminspect_unregister_va(va, size);
> +
> +All of the above have a lock variant that ensures the lock on the table
> +is taken.
> +
> +
> +meminspect drivers
> +------------------
> +
> +Drivers are free to traverse the table by using a dedicated function::
> +
> + meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb)
> +
> +The callback will be called for each entry in the table.
maybe is called
> +
> +Drivers can also register a notifier with meminspect_notifier_register()
> +and unregister with meminspect_notifier_unregister() to be called when a new
> +entry is being added or removed.
is added or removed.
> +
> +Data structures
> +---------------
> +
> +The regions are being stored in a simple fixed size array. It avoids
are stored
> +memory allocation overhead. This is not performance critical nor does
> +allocating a few hundred entries create a memory consumption problem.
> +
> +The static variables registered into meminspect are being annotated into
are annotated into
> +a dedicated .inspect_table memory section. This is then walked by meminspect> +at a later time and each variable is then copied to the whole inspect table.
> +
> +meminspect Initialization
> +-------------------------
> +
> +At any time, meminspect will be ready to accept region registration
meminspect is ready
> +from any part of the kernel. The table does not require any initialization.
> +In case CONFIG_CRASH_DUMP is enabled, meminspect will create an ELF header
meminspect creates an ELF header
> +corresponding to a core dump image, in which each region is added as a
> +program header. In this scenario, the first region is this ELF header, and
> +the second region is the vmcoreinfo ELF note.
> +By using this mechanism, all the meminspect table, if dumped, can be
> +concatenated to obtain a core image that is loadable with the `crash` tool.
> +
> +meminspect example
> +==================
> +
> +A simple scenario for meminspect is the following:
> +The kernel registers the linux_banner variable into meminspect with
> +a simple annotation like::
> +
> + MEMINSPECT_SIMPLE_ENTRY(linux_banner);
> +
> +The meminspect late initcall will parse the compilation time created table
maybe... compile-time
> +and copy the entry information into the inspection table.
> +At a later point, any interested driver can call the traverse function to
> +find out all entries in the table.
> +A specific driver will then note into a specific table the address of the
> +banner and the size of it.
> +The specific table is then written to a shared memory area that can be
> +read by upper level firmware.
> +When the kernel freezes (hypothetically), the kernel will no longer feed
> +the watchdog. The watchdog will trigger a higher exception level interrupt
> +which will be handled by the upper level firmware. This firmware will then
> +read the shared memory table and find an entry with the start and size of
> +the banner. It will then copy it for debugging purpose. The upper level
> +firmware will then be able to provide useful debugging information,
> +like in this example, the banner.
> +
> +As seen here, meminspect facilitates the interaction between the kernel
> +and a specific firmware.
--
~Randy
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 13/25] mm/init-mm: Annotate static information into meminspect
2026-03-10 20:15 ` [PATCH v2 13/25] mm/init-mm: Annotate static " Mukesh Ojha
@ 2026-03-12 14:28 ` kernel test robot
0 siblings, 0 replies; 42+ messages in thread
From: kernel test robot @ 2026-03-12 14:28 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman
Cc: llvm, oe-kbuild-all, Linux Memory Management List
Hi Mukesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on 343f51842f4ed7143872f3aa116a214a5619a4b9]
url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/kernel-Introduce-meminspect/20260311-042334
base: 343f51842f4ed7143872f3aa116a214a5619a4b9
patch link: https://lore.kernel.org/r/20260311-minidump-v2-v2-13-f91cedc6f99e%40oss.qualcomm.com
patch subject: [PATCH v2 13/25] mm/init-mm: Annotate static information into meminspect
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260312/202603122259.3cXlDDN9-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260312/202603122259.3cXlDDN9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603122259.3cXlDDN9-lkp@intel.com/
All errors (new ones prefixed by >>):
>> mm/init-mm.c:23:23: error: use of undeclared identifier '_sinittext'
23 | MEMINSPECT_AREA_ENTRY(_sinittext, sizeof(void *));
| ^
>> mm/init-mm.c:24:23: error: use of undeclared identifier '_einittext'
24 | MEMINSPECT_AREA_ENTRY(_einittext, sizeof(void *));
| ^
>> mm/init-mm.c:25:23: error: use of undeclared identifier '_end'
25 | MEMINSPECT_AREA_ENTRY(_end, sizeof(void *));
| ^
>> mm/init-mm.c:26:23: error: use of undeclared identifier '_text'
26 | MEMINSPECT_AREA_ENTRY(_text, sizeof(void *));
| ^
>> mm/init-mm.c:27:23: error: use of undeclared identifier '_stext'
27 | MEMINSPECT_AREA_ENTRY(_stext, sizeof(void *));
| ^
>> mm/init-mm.c:28:23: error: use of undeclared identifier '_etext'
28 | MEMINSPECT_AREA_ENTRY(_etext, sizeof(void *));
| ^
6 errors generated.
vim +/_sinittext +23 mm/init-mm.c
22
> 23 MEMINSPECT_AREA_ENTRY(_sinittext, sizeof(void *));
> 24 MEMINSPECT_AREA_ENTRY(_einittext, sizeof(void *));
> 25 MEMINSPECT_AREA_ENTRY(_end, sizeof(void *));
> 26 MEMINSPECT_AREA_ENTRY(_text, sizeof(void *));
> 27 MEMINSPECT_AREA_ENTRY(_stext, sizeof(void *));
> 28 MEMINSPECT_AREA_ENTRY(_etext, sizeof(void *));
29
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 03/25] mm/percpu: Annotate static information into meminspect
2026-03-10 20:15 ` [PATCH v2 03/25] mm/percpu: " Mukesh Ojha
@ 2026-03-12 20:18 ` kernel test robot
2026-03-13 8:06 ` kernel test robot
1 sibling, 0 replies; 42+ messages in thread
From: kernel test robot @ 2026-03-12 20:18 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman
Cc: llvm, oe-kbuild-all, Linux Memory Management List
Hi Mukesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on 343f51842f4ed7143872f3aa116a214a5619a4b9]
url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/kernel-Introduce-meminspect/20260311-042334
base: 343f51842f4ed7143872f3aa116a214a5619a4b9
patch link: https://lore.kernel.org/r/20260311-minidump-v2-v2-3-f91cedc6f99e%40oss.qualcomm.com
patch subject: [PATCH v2 03/25] mm/percpu: Annotate static information into meminspect
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260313/202603130444.K3MmZnxY-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 7d47b695929cc7f85eeb0f87d0189adc04c1c629)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260313/202603130444.K3MmZnxY-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603130444.K3MmZnxY-lkp@intel.com/
All errors (new ones prefixed by >>):
>> mm/percpu.c:3363:25: error: use of undeclared identifier '__per_cpu_offset'; did you mean '__per_cpu_start'?
3363 | MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
| ^~~~~~~~~~~~~~~~
| __per_cpu_start
include/linux/meminspect.h:103:40: note: expanded from macro 'MEMINSPECT_SIMPLE_ENTRY'
103 | MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sizeof(sym))
| ^~~
include/linux/meminspect.h:94:19: note: expanded from macro 'MEMINSPECT_ENTRY'
94 | .va = (void *)&(sym), \
| ^~~
include/asm-generic/sections.h:42:13: note: '__per_cpu_start' declared here
42 | extern char __per_cpu_start[], __per_cpu_end[];
| ^
>> mm/percpu.c:3363:25: error: use of undeclared identifier '__per_cpu_offset'; did you mean '__per_cpu_start'?
3363 | MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
| ^~~~~~~~~~~~~~~~
| __per_cpu_start
include/linux/meminspect.h:103:52: note: expanded from macro 'MEMINSPECT_SIMPLE_ENTRY'
103 | MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sizeof(sym))
| ^~~
include/linux/meminspect.h:95:12: note: expanded from macro 'MEMINSPECT_ENTRY'
95 | .size = (sz), \
| ^~
include/asm-generic/sections.h:42:13: note: '__per_cpu_start' declared here
42 | extern char __per_cpu_start[], __per_cpu_end[];
| ^
>> mm/percpu.c:3363:1: error: invalid application of 'sizeof' to an incomplete type 'char[]'
3363 | MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/meminspect.h:103:51: note: expanded from macro 'MEMINSPECT_SIMPLE_ENTRY'
103 | MEMINSPECT_ENTRY(MEMINSPECT_ID_##sym, sym, sizeof(sym))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
include/linux/meminspect.h:95:12: note: expanded from macro 'MEMINSPECT_ENTRY'
95 | .size = (sz), \
| ^~
3 errors generated.
vim +3363 mm/percpu.c
3362
> 3363 MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
3364 /*
3365 * pcpu_nr_pages - calculate total number of populated backing pages
3366 *
3367 * This reflects the number of pages populated to back chunks. Metadata is
3368 * excluded in the number exposed in meminfo as the number of backing pages
3369 * scales with the number of cpus and can quickly outweigh the memory used for
3370 * metadata. It also keeps this calculation nice and simple.
3371 *
3372 * RETURNS:
3373 * Total number of populated backing pages in use by the allocator.
3374 */
3375 unsigned long pcpu_nr_pages(void)
3376 {
3377 return data_race(READ_ONCE(pcpu_nr_populated)) * pcpu_nr_units;
3378 }
3379
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 03/25] mm/percpu: Annotate static information into meminspect
2026-03-10 20:15 ` [PATCH v2 03/25] mm/percpu: " Mukesh Ojha
2026-03-12 20:18 ` kernel test robot
@ 2026-03-13 8:06 ` kernel test robot
1 sibling, 0 replies; 42+ messages in thread
From: kernel test robot @ 2026-03-13 8:06 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman
Cc: oe-kbuild-all, Linux Memory Management List
Hi Mukesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on 343f51842f4ed7143872f3aa116a214a5619a4b9]
url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/kernel-Introduce-meminspect/20260311-042334
base: 343f51842f4ed7143872f3aa116a214a5619a4b9
patch link: https://lore.kernel.org/r/20260311-minidump-v2-v2-3-f91cedc6f99e%40oss.qualcomm.com
patch subject: [PATCH v2 03/25] mm/percpu: Annotate static information into meminspect
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260313/202603131622.xpsC6cMy-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260313/202603131622.xpsC6cMy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603131622.xpsC6cMy-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/percpu.c:90:
>> mm/percpu.c:3363:25: error: '__per_cpu_offset' undeclared here (not in a function); did you mean '__per_cpu_start'?
3363 | MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
| ^~~~~~~~~~~~~~~~
include/linux/meminspect.h:94:33: note: in definition of macro 'MEMINSPECT_ENTRY'
94 | .va = (void *)&(sym), \
| ^~~
mm/percpu.c:3363:1: note: in expansion of macro 'MEMINSPECT_SIMPLE_ENTRY'
3363 | MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +3363 mm/percpu.c
3362
> 3363 MEMINSPECT_SIMPLE_ENTRY(__per_cpu_offset);
3364 /*
3365 * pcpu_nr_pages - calculate total number of populated backing pages
3366 *
3367 * This reflects the number of pages populated to back chunks. Metadata is
3368 * excluded in the number exposed in meminfo as the number of backing pages
3369 * scales with the number of cpus and can quickly outweigh the memory used for
3370 * metadata. It also keeps this calculation nice and simple.
3371 *
3372 * RETURNS:
3373 * Total number of populated backing pages in use by the allocator.
3374 */
3375 unsigned long pcpu_nr_pages(void)
3376 {
3377 return data_race(READ_ONCE(pcpu_nr_populated)) * pcpu_nr_units;
3378 }
3379
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/25] Introduce meminspect
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
` (24 preceding siblings ...)
2026-03-10 20:16 ` [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver Mukesh Ojha
@ 2026-03-16 2:24 ` Bjorn Andersson
2026-03-16 18:16 ` Mukesh Ojha
25 siblings, 1 reply; 42+ messages in thread
From: Bjorn Andersson @ 2026-03-16 2:24 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Mathieu Poirier, Konrad Dybcio,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On Wed, Mar 11, 2026 at 01:45:44AM +0530, Mukesh Ojha wrote:
> First of all, I want to thank Eugene for his excellent work on this
> series. What began as the Qualcomm Minidump driver from me has now
> evolved into meminspect. He also presented meminspect a few months ago
> at Linux Plumbers 2025.
>
> Video of the recording is available here for anyone interested:
> https://www.youtube.com/watch?v=aDZv4-kOLSc
>
> Introduction:
>
> meminspect is a mechanism which allows the kernel to mark specific
> memory areas for memory dumping or specific inspection, statistics,
> usage. Once regions are marked, meminspect keeps an internal list with
> the regions in a dedicated table. Further, these regions can be
> accessed using specific API by any interested driver. Regions being
> marked beforehand, when the system is up and running, there is no need
> nor dependency on a panic handler, or a working kernel that can dump the
> debug information. meminspect can be primarily used for debugging. The
> approach is feasible to work when pstore, kdump, or another mechanism do
> not. Pstore relies on persistent storage, a dedicated RAM area or
> flash, which has the disadvantage of having the memory reserved all the
> time, or another specific non volatile memory. Some devices cannot keep
> the RAM contents on reboot so ramoops does not work. Some devices do not
> allow kexec to run another kernel to debug the crashed one. For such
> devices, that have another mechanism to help debugging, like firmware,
> kmemdump is a viable solution.
>
> meminspect can create a core image, similar with /proc/vmcore, with only
> the registered regions included. This can be loaded into crash tool/gdb
> and analyzed. This happens if CRASH_DUMP=y. To have this working,
> specific information from the kernel is registered, and this is done at
> meminspect init time, no need for the meminspect users to do anything.
>
> This version of the meminspect patch series includes two drivers that
> make use of it: one is the Qualcomm Minidump, and the other one is the
> Debug Kinfo backend for Android devices, reworked from this source here:
> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/android/debug_kinfo.c
> written originally by Jone Chou <jonechou@google.com>
>
> *** History, motivation and available online resources ***
>
> The patch series is based on both minidump and kmemdump previous implementations.
>
> After the three RFC kmemdump versions, considering the ML discussions, it was decided to
> move this into kernel/ directory and rework it into naming it meminspect, as Thomas Gleixner
> suggested.
>
> Initial version of kmemdump and discussion is available here:
> https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
>
> Kmemdump has been presented and discussed at Linaro Connect 2025,
> including motivation, scope, usability and feasability.
> Video of the recording is available here for anyone interested:
> https://www.youtube.com/watch?v=r4gII7MX9zQ&list=PLKZSArYQptsODycGiE0XZdVovzAwYNwtK&index=14
>
> Linaro blog on kmemdump can be found here:
> https://www.linaro.org/blog/introduction-to-kmemdump/
>
> Linaro blog on kmemdump step by stem using minidump backend is available here:
> https://www.linaro.org/blog/kmemdump-step-by-step-on-qualcomm-automotive-platform/
>
> The implementation is based on the initial Pstore/directly mapped zones
> published as an RFC here:
> https://lore.kernel.org/all/20250217101706.2104498-1-eugen.hristev@linaro.org/
>
> The back-end implementation for qcom_minidump is based on the minidump
> patch series and driver written by Mukesh Ojha, thanks:
> https://lore.kernel.org/lkml/20240131110837.14218-1-quic_mojha@quicinc.com/
>
> The RFC v2 version with .section creation and macro annotation kmemdump
> is available here:
> https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
>
> The RFC v3 version with making everything static, which was pretty much rejected due to
> all reasons discussed on the public ML:
> https://lore.kernel.org/all/20250912150855.2901211-1-eugen.hristev@linaro.org/
>
> *** How to use meminspect with minidump backend on Qualcomm platform guide ***
>
> Prerequisites:
> Crash tool compiled with target=ARM64 and minor changes required for
> usual crash mode (minimal mode works without the patch) **A patch can be
> applied from here https://p.calebs.dev/1687bc ** This patch will be
> eventually sent in a reworked way to crash tool.
>
That patch was written 8 months ago, what's the timeline for landing
this?
It's not feasible to have every users rebuild crash from source and
maintain this copy in order to use the tool.
> Target kernel must be built with : CONFIG_DEBUG_INFO_REDUCED=n ; this
> will have vmlinux include all the debugging information needed for crash
> tool.
>
> Also, the kernel requires these as well: CONFIG_MEMINSPECT,
> CONFIG_CRASH_DUMP and the driver CONFIG_QCOM_MINIDUMP
>
> Kernel arguments: Kernel firmware must be set to mode 'mini' by kernel
> module parameter like this : qcom_scm.download_mode=mini
>
> After the kernel boots, and minidump module is loaded, everything is
> ready for a possible crash.
>
> Once the crash happens, the firmware will kick in and you will see on
> the console the message saying Sahara init, etc, that the firmware is
> waiting in download mode. (this is subject to firmware supporting this
> mode, I am using sa8775p-ride board)
>
> Example of log on the console:
> "
> [...]
> B - 1096414 - usb: init start
> B - 1100287 - usb: qusb_dci_platform , 0x19
> B - 1105686 - usb: usb3phy: PRIM success: lane_A , 0x60
> B - 1107455 - usb: usb2phy: PRIM success , 0x4
> B - 1112670 - usb: dci, chgr_type_det_err
> B - 1117154 - usb: ID:0x260, value: 0x4
> B - 1121942 - usb: ID:0x108, value: 0x1d90
> B - 1124992 - usb: timer_start , 0x4c4b40
> B - 1129140 - usb: vbus_det_pm_unavail
> B - 1133136 - usb: ID:0x252, value: 0x4
> B - 1148874 - usb: SUPER , 0x900e
> B - 1275510 - usb: SUPER , 0x900e
> B - 1388970 - usb: ID:0x20d, value: 0x0
> B - 1411113 - usb: ENUM success
> B - 1411113 - Sahara Init
> B - 1414285 - Sahara Open
> "
This doesn't add any specific value, it's just "Device entered ramdump
mode".
>
> Once the board is in download mode, you can use the qdl tool (I
> personally use edl , have not tried qdl yet)
Is this your or Eugen's comment? Why haven't you tested qdl yet?
>, to get all the regions as
> separate files. The tool from the host computer will list the regions
> in the order they were downloaded.
>
> Once you have all the files simply use `cat` to put them all together,
> in the order of the indexes. For my kernel config and setup, here is my
> cat command : (you can use a script or something, I haven't done that so
> far):
So these need to be sorted in numerical order, by that number at the end
of the file name?
Do you manually punch these in? How do we make this user friendly?
Regards,
Bjorn
>
> `cat md_KELF1.BIN md_Kvmcorein2.BIN md_Kconfig3.BIN \
> md_Ktotalram4.BIN md_Kcpu_poss5.BIN md_Kcpu_pres6.BIN \
> md_Kcpu_onli7.BIN md_Kcpu_acti8.BIN md_Kmem_sect9.BIN \
> md_Kjiffies10.BIN md_Klinux_ba11.BIN md_Knr_threa12.BIN \
> md_Knr_irqs13.BIN md_Ktainted_14.BIN md_Ktaint_fl15.BIN \
> md_Knode_sta16.BIN md_K__per_cp17.BIN md_Knr_swapf18.BIN \
> md_Kinit_uts19.BIN md_Kprintk_r20.BIN md_Kprintk_r21.BIN \
> md_Kprb22.BIN md_Kprb_desc23.BIN md_Kprb_info24.BIN \
> md_Kprb_data25.BIN md_Khigh_mem26.BIN md_Kinit_mm27.BIN \
> md_Kunknown29.BIN md_Kunknown30.BIN md_Kunknown31.BIN \
> md_Kunknown32.BIN md_Kunknown33.BIN md_Kunknown34.BIN \
> md_Kunknown35.BIN md_Kunknown37.BIN \
> md_Kunknown38.BIN md_Kunknown39.BIN md_Kunknown40.BIN \
> md_Kunknown41.BIN md_Kunknown42.BIN md_Kunknown43.BIN \
> md_Kunknown44.BIN md_Kunknown45.BIN md_Kunknown46.BIN \
> md_Kunknown47.BIN md_Kunknown48.BIN md_Kunknown49.BIN \
> md_Kunknown50.BIN md_Kunknown51.BIN md_Kunknown52.BIN \
> md_Kunknown53.BIN md_Kunknown54.BIN > ./minidump_image`
>
> Once you have the resulted file, use `crash` tool to load it, like this:
> `./crash --no_modules --no_panic --no_kmem_cache --zero_excluded vmlinux minidump_image`
>
> There is also a --minimal mode for ./crash that would work without any patch applied
> to crash tool, but you can't inspect symbols, etc.
>
> Once you load crash you will see something like this :
> KERNEL: minidump/20260310-235110/vmlinux [TAINTED]
> DUMPFILE: ./minidump/20260310-235110/minidump_image
> CPUS: 8 [OFFLINE: 7]
> DATE: Thu Jan 1 05:30:00 +0530 1970
> UPTIME: 00:00:27
> TASKS: 0
> NODENAME: qemuarm64
> RELEASE: 7.0.0-rc3-next-20260309-00028-g528b3c656121
> VERSION: #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
> MACHINE: aarch64 (unknown Mhz)
> MEMORY: 0
> PANIC: "Kernel panic - not syncing: sysrq triggered crash"
>
> crash> log
> [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x514f0014]
> [ 0.000000] Linux version 7.0.0-rc3-next-20260309-00028-g528b3c656121 (@21e3bca4168f) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
>
> *** Debug Kinfo backend driver ***
> I need help with the testing of this driver, Anyone who actually wants
> to test this, feel free to reply to the patch. we have also written a
> simple DT binding for the driver.
>
> Thanks in advance for the review, and apologies if I missed addressing any comment.
>
> -Mukesh
>
> Changes in v2: https://lore.kernel.org/lkml/20251119154427.1033475-1-eugen.hristev@linaro.org/
> - Fixed doc warnings
> - Fixed kernel-test robot warnings.
> - Took Mike suggestion to remove mark inspect flag for dynamic memory.
> - Added R-b for printk patch.
> - Modified some commit messages for clarity.
> - corrected binding change for debug-kinfo as per Rob suggestion.
>
> Changelog for meminspect v1:
> - rename to meminspect
> - start on top of v2 actually, with the section and all.
> - remove the backend thing, change the API to access the table
> - move everything to kernel/
> - add dependency to CRASH_DUMP instead of a separate knob
> - move the minidump driver to soc/qcom
> - integrate the meminspect better into memblock by using a new memblock flag
> - minor fixes : use dev_err_probe everywhere, rearrange variable declarations,
> remove some useless code, etc.
>
> Changelog for RFC v3:
> - V2 available here : https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
> - Removed the .section as requested by David Hildenbrand.
> - Moved all kmemdump registration(when possible) to vmcoreinfo.
> - Because of this, some of the variables that I was registering had to be non-static
> so I had to modify this as per David Hildenbrand suggestion.
> - Fixed minor things in the Kinfo driver: one field was broken, fixed some
> compiler warnings, fixed the copyright and remove some useless includes.
> - Moved the whole kmemdump from drivers/debug into mm/ and Kconfigs into mm/Kconfig.debug
> and it's now available in kernel hacking, as per Randy Dunlap review
> - Reworked some of the Documentation as per review from Jon Corbet
>
> Changelog for RFC v2:
> - V1 available here: https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
> - Reworked the whole minidump implementation based on suggestions from Thomas Gleixner.
> This means new API, macros, new way to store the regions inside kmemdump
> (ditched the IDR, moved to static allocation, have a static default backend, etc)
> - Reworked qcom_minidump driver based on review from Bjorn Andersson
> - Reworked printk log buffer registration based on review from Petr Mladek
>
> I appologize if I missed any review comments.
> Patches are sent on top on next-20260309 tag
>
> ---
> Eugen Hristev (21):
> kernel: Introduce meminspect
> init/version: Annotate static information into meminspect
> mm/percpu: Annotate static information into meminspect
> cpu: Annotate static information into meminspect
> genirq/irqdesc: Annotate static information into meminspect
> timers: Annotate static information into meminspect
> kernel/fork: Annotate static information into meminspect
> mm/page_alloc: Annotate static information into meminspect
> mm/show_mem: Annotate static information into meminspect
> mm/swapfile: Annotate static information into meminspect
> kernel/vmcore_info: Register dynamic information into meminspect
> kernel/configs: Register dynamic information into meminspect
> mm/init-mm: Annotate static information into meminspect
> panic: Annotate static information into meminspect
> kallsyms: Annotate static information into meminspect
> mm/mm_init: Annotate static information into meminspect
> sched/core: Annotate runqueues into meminspect
> remoteproc: qcom: Move minidump data structures into its own header
> soc: qcom: Add minidump backend driver
> soc: qcom: smem: Add minidump platform device
> meminspect: Add debug kinfo compatible driver
>
> Mukesh Ojha (4):
> mm/numa: Register node data information into meminspect
> mm/sparse: Register information into meminspect
> printk: Register information into meminspect
> dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
>
> Documentation/dev-tools/index.rst | 1 +
> Documentation/dev-tools/meminspect.rst | 144 +++++++
> .../bindings/reserved-memory/google,kinfo.yaml | 46 ++
> MAINTAINERS | 14 +
> drivers/of/platform.c | 1 +
> drivers/remoteproc/qcom_common.c | 56 +--
> drivers/soc/qcom/Kconfig | 13 +
> drivers/soc/qcom/Makefile | 1 +
> drivers/soc/qcom/minidump.c | 272 ++++++++++++
> drivers/soc/qcom/smem.c | 10 +
> include/asm-generic/vmlinux.lds.h | 13 +
> include/linux/meminspect.h | 263 ++++++++++++
> include/linux/soc/qcom/minidump.h | 72 ++++
> init/Kconfig | 1 +
> init/version-timestamp.c | 3 +
> init/version.c | 3 +
> kernel/Makefile | 1 +
> kernel/configs.c | 6 +
> kernel/cpu.c | 5 +
> kernel/fork.c | 3 +
> kernel/irq/irqdesc.c | 2 +
> kernel/kallsyms.c | 9 +
> kernel/meminspect/Kconfig | 30 ++
> kernel/meminspect/Makefile | 4 +
> kernel/meminspect/kinfo.c | 284 +++++++++++++
> kernel/meminspect/meminspect.c | 471 +++++++++++++++++++++
> kernel/panic.c | 4 +
> kernel/printk/printk.c | 11 +
> kernel/sched/core.c | 2 +
> kernel/time/timer.c | 2 +
> kernel/vmcore_info.c | 4 +
> mm/init-mm.c | 11 +
> mm/mm_init.c | 2 +
> mm/numa.c | 2 +
> mm/page_alloc.c | 2 +
> mm/percpu.c | 2 +
> mm/show_mem.c | 2 +
> mm/sparse.c | 6 +
> mm/swapfile.c | 2 +
> 39 files changed, 1725 insertions(+), 55 deletions(-)
> ---
> base-commit: 343f51842f4ed7143872f3aa116a214a5619a4b9
> change-id: 20260311-minidump-v2-eed8da647ce5
>
> Best regards,
> --
> -Mukesh Ojha
>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 01/25] kernel: Introduce meminspect
2026-03-12 4:46 ` Randy Dunlap
@ 2026-03-16 8:31 ` Mukesh Ojha
0 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-16 8:31 UTC (permalink / raw)
To: Randy Dunlap
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan, workflows, linux-doc, linux-kernel, linux-arch,
linux-mm, linux-arm-msm, linux-remoteproc, devicetree
On Wed, Mar 11, 2026 at 09:46:57PM -0700, Randy Dunlap wrote:
>
>
> On 3/10/26 1:15 PM, Mukesh Ojha wrote:
> > diff --git a/Documentation/dev-tools/meminspect.rst b/Documentation/dev-tools/meminspect.rst
> > new file mode 100644
> > index 000000000000..d0c7222bdcd7
> > --- /dev/null
> > +++ b/Documentation/dev-tools/meminspect.rst
> > @@ -0,0 +1,144 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +==========
> > +meminspect
> > +==========
> > +
> > +This document provides information about the meminspect feature.
> > +
> > +Overview
> > +========
> > +
> > +meminspect is a mechanism that allows the kernel to register a chunk of
> > +memory into a table, to be used at a later time for a specific
> > +inspection purpose like debugging, memory dumping or statistics.
> > +
> > +meminspect allows drivers to traverse the inspection table on demand,
> > +or to register a notifier to be called whenever a new entry is being added
>
> preferably... is added
>
> > +or removed.
> > +
> > +The reasoning for meminspect is also to minimize the required information
> > +in case of a kernel problem. For example a traditional debug method involves
> > +dumping the whole kernel memory and then inspecting it. Meminspect allows the
> > +users to select which memory is of interest, in order to help this specific
> > +use case in production, where memory and connectivity are limited.
> > +
> > +Although the kernel has multiple internal mechanisms, meminspect fits
> > +a particular model which is not covered by the others.
> > +
> > +meminspect Internals
> > +====================
> > +
> > +API
> > +---
> > +
> > +Static memory can be registered at compile time, by instructing the compiler
> > +to create a separate section with annotation info.
> > +For each such annotated memory (variables usually), a dedicated struct
> > +is being created with the required information.
>
> is created
>
> > +To achieve this goal, some basic APIs are available:
> > +
> > +* MEMINSPECT_ENTRY(idx, sym, sz)
> > + is the basic macro that takes an ID, the symbol, and a size.
> > +
> > +To make it easier, some wrappers are also defined
> > +
> > +* MEMINSPECT_SIMPLE_ENTRY(sym)
> > + will use the dedicated MEMINSPECT_ID_##sym with a size equal to sizeof(sym)
>
> uses the dedicated
>
> > +
> > +* MEMINSPECT_NAMED_ENTRY(name, sym)
> > + will be a simple entry that has an id that cannot be derived from the sym,
>
> is a simple entry that
>
> > + so a name has to be provided
> > +
> > +* MEMINSPECT_AREA_ENTRY(sym, sz)
> > + this will register sym, but with the size given as sz, useful for e.g.
>
> registers sym, but with
>
> > + arrays which do not have a fixed size at compile time.
> > +
> > +For dynamically allocated memory, or for other cases, the following APIs
> > +are being defined::
>
> are defined::
>
> > +
> > + meminspect_register_id_pa(enum meminspect_uid id, phys_addr_t zone,
> > + size_t size, unsigned int type);
> > +
> > +which takes the ID and the physical address.
> > +
> > +Similarly there are variations:
> > +
> > + * meminspect_register_pa() omits the ID
> > + * meminspect_register_id_va() requires the ID but takes a virtual address
> > + * meminspect_register_va() omits the ID and requires a virtual address
> > +
> > +If the ID is not given, the next avialable dynamic ID is allocated.
>
> available
>
> > +
> > +To unregister a dynamic entry, some APIs are being defined:
>
> are defined:
>
> > + * meminspect_unregister_pa(phys_addr_t zone, size_t size);
> > + * meminspect_unregister_id(enum meminspect_uid id);
> > + * meminspect_unregister_va(va, size);
> > +
> > +All of the above have a lock variant that ensures the lock on the table
> > +is taken.
> > +
> > +
> > +meminspect drivers
> > +------------------
> > +
> > +Drivers are free to traverse the table by using a dedicated function::
> > +
> > + meminspect_traverse(void *priv, MEMINSPECT_ITERATOR_CB cb)
> > +
> > +The callback will be called for each entry in the table.
>
> maybe is called
>
> > +
> > +Drivers can also register a notifier with meminspect_notifier_register()
> > +and unregister with meminspect_notifier_unregister() to be called when a new
> > +entry is being added or removed.
>
> is added or removed.
>
> > +
> > +Data structures
> > +---------------
> > +
> > +The regions are being stored in a simple fixed size array. It avoids
>
> are stored
>
> > +memory allocation overhead. This is not performance critical nor does
> > +allocating a few hundred entries create a memory consumption problem.
> > +
> > +The static variables registered into meminspect are being annotated into
>
> are annotated into
>
> > +a dedicated .inspect_table memory section. This is then walked by meminspect> +at a later time and each variable is then copied to the whole inspect table.
> > +
> > +meminspect Initialization
> > +-------------------------
> > +
> > +At any time, meminspect will be ready to accept region registration
>
> meminspect is ready
>
> > +from any part of the kernel. The table does not require any initialization.
> > +In case CONFIG_CRASH_DUMP is enabled, meminspect will create an ELF header
>
> meminspect creates an ELF header
>
> > +corresponding to a core dump image, in which each region is added as a
> > +program header. In this scenario, the first region is this ELF header, and
> > +the second region is the vmcoreinfo ELF note.
> > +By using this mechanism, all the meminspect table, if dumped, can be
> > +concatenated to obtain a core image that is loadable with the `crash` tool.
> > +
> > +meminspect example
> > +==================
> > +
> > +A simple scenario for meminspect is the following:
> > +The kernel registers the linux_banner variable into meminspect with
> > +a simple annotation like::
> > +
> > + MEMINSPECT_SIMPLE_ENTRY(linux_banner);
> > +
> > +The meminspect late initcall will parse the compilation time created table
>
> maybe... compile-time
>
> > +and copy the entry information into the inspection table.
> > +At a later point, any interested driver can call the traverse function to
> > +find out all entries in the table.
> > +A specific driver will then note into a specific table the address of the
> > +banner and the size of it.
> > +The specific table is then written to a shared memory area that can be
> > +read by upper level firmware.
> > +When the kernel freezes (hypothetically), the kernel will no longer feed
> > +the watchdog. The watchdog will trigger a higher exception level interrupt
> > +which will be handled by the upper level firmware. This firmware will then
> > +read the shared memory table and find an entry with the start and size of
> > +the banner. It will then copy it for debugging purpose. The upper level
> > +firmware will then be able to provide useful debugging information,
> > +like in this example, the banner.
> > +
> > +As seen here, meminspect facilitates the interaction between the kernel
> > +and a specific firmware.
Thanks for your time and review, I have applied the changes to both doc. and
Kconfig for next version.
>
>
> --
> ~Randy
>
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 20/25] printk: Register information into meminspect
2026-03-10 20:16 ` [PATCH v2 20/25] printk: " Mukesh Ojha
@ 2026-03-16 9:39 ` John Ogness
2026-03-16 10:24 ` Eugen Hristev
0 siblings, 1 reply; 42+ messages in thread
From: John Ogness @ 2026-03-16 9:39 UTC (permalink / raw)
To: Mukesh Ojha, Jonathan Corbet, Shuah Khan, Eugen Hristev,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Mukesh Ojha, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On 2026-03-11, Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> wrote:
> Annotate vital static, dynamic information into meminspect for debugging
>
> Static:
> - prb_descs
> - prb_infos
> - prb
> - prb_data
> - printk_rb_static
> - printk_rb_dynamic
FYI: vmcore also exports the symbol "clear_seq". It is not required if
you are interested in reading _everything_ in the buffer. But it may be
interesting if you want to mirror vmcore tool features.
> Dynamic:
> - new_descs
> - new_infos
> - new_log_buf
>
> meminspect uses a different API to annotate variables for inspection,
> and information about these variables is stored in the inspection table.
>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
> Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
> Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 20/25] printk: Register information into meminspect
2026-03-16 9:39 ` John Ogness
@ 2026-03-16 10:24 ` Eugen Hristev
0 siblings, 0 replies; 42+ messages in thread
From: Eugen Hristev @ 2026-03-16 10:24 UTC (permalink / raw)
To: John Ogness, Mukesh Ojha, Jonathan Corbet, Shuah Khan,
Arnd Bergmann, Dennis Zhou, Tejun Heo, Christoph Lameter,
Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Anna-Maria Behnsen, Frederic Weisbecker, Ingo Molnar, Juri Lelli,
Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
Mel Gorman, Valentin Schneider, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan
Cc: workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On 3/16/26 11:39, John Ogness wrote:
> On 2026-03-11, Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> wrote:
>> Annotate vital static, dynamic information into meminspect for debugging
>>
>> Static:
>> - prb_descs
>> - prb_infos
>> - prb
>> - prb_data
>> - printk_rb_static
>> - printk_rb_dynamic
>
> FYI: vmcore also exports the symbol "clear_seq". It is not required if
> you are interested in reading _everything_ in the buffer. But it may be
> interesting if you want to mirror vmcore tool features.
Thank you for your review and suggestion. One of the key points of
meminspect is to be easy to use by the kernel developer. E.g. to be easy
to add another symbol, like `clear_seq` for a particular use case.
So, someone wanting to make use of it, can easily add it.
The purpose of the initial submission would be to have a basic use case
working, and show it as an example for everyone.
If you would like to detail about the features you mention, it could be
interesting to try them and see if it would work with a meminspect dump.
Eugen
>
>> Dynamic:
>> - new_descs
>> - new_infos
>> - new_log_buf
>>
>> meminspect uses a different API to annotate variables for inspection,
>> and information about these variables is stored in the inspection table.
>>
>> Reviewed-by: Petr Mladek <pmladek@suse.com>
>> Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
>> Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
>> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
>
> Reviewed-by: John Ogness <john.ogness@linutronix.de>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
2026-03-11 9:05 ` Krzysztof Kozlowski
@ 2026-03-16 11:12 ` Mukesh Ojha
0 siblings, 0 replies; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-16 11:12 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Bjorn Andersson, Mathieu Poirier,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Saravana Kannan, workflows, linux-doc, linux-kernel, linux-arch,
linux-mm, linux-arm-msm, linux-remoteproc, devicetree
On Wed, Mar 11, 2026 at 10:05:55AM +0100, Krzysztof Kozlowski wrote:
> On Wed, Mar 11, 2026 at 01:46:08AM +0530, Mukesh Ojha wrote:
> > Add documentation for Google Kinfo Pixel reserved memory area.
> >
> > Co-developed-by: Eugen Hristev <eugen.hristev@linaro.org>
> > Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
> > Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> > ---
> > .../bindings/reserved-memory/google,kinfo.yaml | 46 ++++++++++++++++++++++
> > MAINTAINERS | 6 +++
> > 2 files changed, 52 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
> > new file mode 100644
> > index 000000000000..2f964151f0c0
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/reserved-memory/google,kinfo.yaml
>
> Nothing improved, read previous feedback.
Missed it, will need to fix this as per compatible name..
>
> > @@ -0,0 +1,46 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/reserved-memory/google,kinfo.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Google Pixel Kinfo reserved memory
> > +
> > +maintainers:
> > + - Eugen Hristev <eugen.hristev@linaro.org>
> > + - Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> > +
> > +description: |
>
> Do not need '|' unless you need to preserve formatting.
>
> > + This binding represents reserved-memory used to store data for firmware/bootloader
>
> Nothing improved.
Will reword it.
>
> > + on the Pixel platform. The stored data is debugging information of the running
> > + kernel.
> > +
> > +allOf:
> > + - $ref: reserved-memory.yaml
> > +
> > +properties:
> > + compatible:
> > + const: google,debug-kinfo
> > +
> > + reg:
> > + description: page-aligned region of memory containing debugging data of running kernel
>
> Missing constraints.
>
> Please wrap code according to the preferred limit expressed in Kernel
> coding style (checkpatch is not a coding style description, but only a
> tool). However don't wrap blindly (see Kernel coding style).
Sure., will fix this as well.
>
> Best regards,
> Krzysztof
>
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/25] Introduce meminspect
2026-03-16 2:24 ` [PATCH v2 00/25] Introduce meminspect Bjorn Andersson
@ 2026-03-16 18:16 ` Mukesh Ojha
2026-03-19 2:55 ` Bjorn Andersson
0 siblings, 1 reply; 42+ messages in thread
From: Mukesh Ojha @ 2026-03-16 18:16 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Mathieu Poirier, Konrad Dybcio,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On Sun, Mar 15, 2026 at 09:24:39PM -0500, Bjorn Andersson wrote:
> On Wed, Mar 11, 2026 at 01:45:44AM +0530, Mukesh Ojha wrote:
> > First of all, I want to thank Eugene for his excellent work on this
> > series. What began as the Qualcomm Minidump driver from me has now
> > evolved into meminspect. He also presented meminspect a few months ago
> > at Linux Plumbers 2025.
> >
> > Video of the recording is available here for anyone interested:
> > https://www.youtube.com/watch?v=aDZv4-kOLSc
> >
> > Introduction:
> >
> > meminspect is a mechanism which allows the kernel to mark specific
> > memory areas for memory dumping or specific inspection, statistics,
> > usage. Once regions are marked, meminspect keeps an internal list with
> > the regions in a dedicated table. Further, these regions can be
> > accessed using specific API by any interested driver. Regions being
> > marked beforehand, when the system is up and running, there is no need
> > nor dependency on a panic handler, or a working kernel that can dump the
> > debug information. meminspect can be primarily used for debugging. The
> > approach is feasible to work when pstore, kdump, or another mechanism do
> > not. Pstore relies on persistent storage, a dedicated RAM area or
> > flash, which has the disadvantage of having the memory reserved all the
> > time, or another specific non volatile memory. Some devices cannot keep
> > the RAM contents on reboot so ramoops does not work. Some devices do not
> > allow kexec to run another kernel to debug the crashed one. For such
> > devices, that have another mechanism to help debugging, like firmware,
> > kmemdump is a viable solution.
> >
> > meminspect can create a core image, similar with /proc/vmcore, with only
> > the registered regions included. This can be loaded into crash tool/gdb
> > and analyzed. This happens if CRASH_DUMP=y. To have this working,
> > specific information from the kernel is registered, and this is done at
> > meminspect init time, no need for the meminspect users to do anything.
> >
> > This version of the meminspect patch series includes two drivers that
> > make use of it: one is the Qualcomm Minidump, and the other one is the
> > Debug Kinfo backend for Android devices, reworked from this source here:
> > https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/android/debug_kinfo.c
> > written originally by Jone Chou <jonechou@google.com>
> >
> > *** History, motivation and available online resources ***
> >
> > The patch series is based on both minidump and kmemdump previous implementations.
> >
> > After the three RFC kmemdump versions, considering the ML discussions, it was decided to
> > move this into kernel/ directory and rework it into naming it meminspect, as Thomas Gleixner
> > suggested.
> >
> > Initial version of kmemdump and discussion is available here:
> > https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
> >
> > Kmemdump has been presented and discussed at Linaro Connect 2025,
> > including motivation, scope, usability and feasability.
> > Video of the recording is available here for anyone interested:
> > https://www.youtube.com/watch?v=r4gII7MX9zQ&list=PLKZSArYQptsODycGiE0XZdVovzAwYNwtK&index=14
> >
> > Linaro blog on kmemdump can be found here:
> > https://www.linaro.org/blog/introduction-to-kmemdump/
> >
> > Linaro blog on kmemdump step by stem using minidump backend is available here:
> > https://www.linaro.org/blog/kmemdump-step-by-step-on-qualcomm-automotive-platform/
> >
> > The implementation is based on the initial Pstore/directly mapped zones
> > published as an RFC here:
> > https://lore.kernel.org/all/20250217101706.2104498-1-eugen.hristev@linaro.org/
> >
> > The back-end implementation for qcom_minidump is based on the minidump
> > patch series and driver written by Mukesh Ojha, thanks:
> > https://lore.kernel.org/lkml/20240131110837.14218-1-quic_mojha@quicinc.com/
> >
> > The RFC v2 version with .section creation and macro annotation kmemdump
> > is available here:
> > https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
> >
> > The RFC v3 version with making everything static, which was pretty much rejected due to
> > all reasons discussed on the public ML:
> > https://lore.kernel.org/all/20250912150855.2901211-1-eugen.hristev@linaro.org/
> >
> > *** How to use meminspect with minidump backend on Qualcomm platform guide ***
> >
> > Prerequisites:
> > Crash tool compiled with target=ARM64 and minor changes required for
> > usual crash mode (minimal mode works without the patch) **A patch can be
> > applied from here https://p.calebs.dev/1687bc ** This patch will be
> > eventually sent in a reworked way to crash tool.
> >
>
> That patch was written 8 months ago, what's the timeline for landing
> this?
>
> It's not feasible to have every users rebuild crash from source and
> maintain this copy in order to use the tool.
Right, Let me see what I can do to make it acceptable..
>
> > Target kernel must be built with : CONFIG_DEBUG_INFO_REDUCED=n ; this
> > will have vmlinux include all the debugging information needed for crash
> > tool.
> >
> > Also, the kernel requires these as well: CONFIG_MEMINSPECT,
> > CONFIG_CRASH_DUMP and the driver CONFIG_QCOM_MINIDUMP
> >
> > Kernel arguments: Kernel firmware must be set to mode 'mini' by kernel
> > module parameter like this : qcom_scm.download_mode=mini
> >
> > After the kernel boots, and minidump module is loaded, everything is
> > ready for a possible crash.
> >
> > Once the crash happens, the firmware will kick in and you will see on
> > the console the message saying Sahara init, etc, that the firmware is
> > waiting in download mode. (this is subject to firmware supporting this
> > mode, I am using sa8775p-ride board)
> >
> > Example of log on the console:
> > "
> > [...]
> > B - 1096414 - usb: init start
> > B - 1100287 - usb: qusb_dci_platform , 0x19
> > B - 1105686 - usb: usb3phy: PRIM success: lane_A , 0x60
> > B - 1107455 - usb: usb2phy: PRIM success , 0x4
> > B - 1112670 - usb: dci, chgr_type_det_err
> > B - 1117154 - usb: ID:0x260, value: 0x4
> > B - 1121942 - usb: ID:0x108, value: 0x1d90
> > B - 1124992 - usb: timer_start , 0x4c4b40
> > B - 1129140 - usb: vbus_det_pm_unavail
> > B - 1133136 - usb: ID:0x252, value: 0x4
> > B - 1148874 - usb: SUPER , 0x900e
> > B - 1275510 - usb: SUPER , 0x900e
> > B - 1388970 - usb: ID:0x20d, value: 0x0
> > B - 1411113 - usb: ENUM success
> > B - 1411113 - Sahara Init
> > B - 1414285 - Sahara Open
> > "
>
> This doesn't add any specific value, it's just "Device entered ramdump
> mode".
Sure, will remove it.
>
> >
> > Once the board is in download mode, you can use the qdl tool (I
> > personally use edl , have not tried qdl yet)
>
> Is this your or Eugen's comment? Why haven't you tested qdl yet?
It was Eugene's comment, but I get it, I can try QDL and check, if it
works.
>
> >, to get all the regions as
> > separate files. The tool from the host computer will list the regions
> > in the order they were downloaded.
> >
> > Once you have all the files simply use `cat` to put them all together,
> > in the order of the indexes. For my kernel config and setup, here is my
> > cat command : (you can use a script or something, I haven't done that so
> > far):
>
> So these need to be sorted in numerical order, by that number at the end
> of the file name?
>
> Do you manually punch these in? How do we make this user friendly?
Yes, manually.. but I think we can do better. We could make
this more user‑friendly by using the section header and string table in
the md_KELF binary both of which existed in the earlier implementation.
Then, we can write an upstream‑friendly script that reads this KELF
metadata file, checks whether a binary with the registered name is
present, and stitches everything together to form a complete ELF that
the crash tool can consume. Let me know if you have any suggestion..
>
> Regards,
> Bjorn
>
> >
> > `cat md_KELF1.BIN md_Kvmcorein2.BIN md_Kconfig3.BIN \
> > md_Ktotalram4.BIN md_Kcpu_poss5.BIN md_Kcpu_pres6.BIN \
> > md_Kcpu_onli7.BIN md_Kcpu_acti8.BIN md_Kmem_sect9.BIN \
> > md_Kjiffies10.BIN md_Klinux_ba11.BIN md_Knr_threa12.BIN \
> > md_Knr_irqs13.BIN md_Ktainted_14.BIN md_Ktaint_fl15.BIN \
> > md_Knode_sta16.BIN md_K__per_cp17.BIN md_Knr_swapf18.BIN \
> > md_Kinit_uts19.BIN md_Kprintk_r20.BIN md_Kprintk_r21.BIN \
> > md_Kprb22.BIN md_Kprb_desc23.BIN md_Kprb_info24.BIN \
> > md_Kprb_data25.BIN md_Khigh_mem26.BIN md_Kinit_mm27.BIN \
> > md_Kunknown29.BIN md_Kunknown30.BIN md_Kunknown31.BIN \
> > md_Kunknown32.BIN md_Kunknown33.BIN md_Kunknown34.BIN \
> > md_Kunknown35.BIN md_Kunknown37.BIN \
> > md_Kunknown38.BIN md_Kunknown39.BIN md_Kunknown40.BIN \
> > md_Kunknown41.BIN md_Kunknown42.BIN md_Kunknown43.BIN \
> > md_Kunknown44.BIN md_Kunknown45.BIN md_Kunknown46.BIN \
> > md_Kunknown47.BIN md_Kunknown48.BIN md_Kunknown49.BIN \
> > md_Kunknown50.BIN md_Kunknown51.BIN md_Kunknown52.BIN \
> > md_Kunknown53.BIN md_Kunknown54.BIN > ./minidump_image`
> >
> > Once you have the resulted file, use `crash` tool to load it, like this:
> > `./crash --no_modules --no_panic --no_kmem_cache --zero_excluded vmlinux minidump_image`
> >
> > There is also a --minimal mode for ./crash that would work without any patch applied
> > to crash tool, but you can't inspect symbols, etc.
> >
> > Once you load crash you will see something like this :
> > KERNEL: minidump/20260310-235110/vmlinux [TAINTED]
> > DUMPFILE: ./minidump/20260310-235110/minidump_image
> > CPUS: 8 [OFFLINE: 7]
> > DATE: Thu Jan 1 05:30:00 +0530 1970
> > UPTIME: 00:00:27
> > TASKS: 0
> > NODENAME: qemuarm64
> > RELEASE: 7.0.0-rc3-next-20260309-00028-g528b3c656121
> > VERSION: #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
> > MACHINE: aarch64 (unknown Mhz)
> > MEMORY: 0
> > PANIC: "Kernel panic - not syncing: sysrq triggered crash"
> >
> > crash> log
> > [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x514f0014]
> > [ 0.000000] Linux version 7.0.0-rc3-next-20260309-00028-g528b3c656121 (@21e3bca4168f) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #5 SMP PREEMPT Tue Mar 10 18:18:41 UTC 2026
> >
> > *** Debug Kinfo backend driver ***
> > I need help with the testing of this driver, Anyone who actually wants
> > to test this, feel free to reply to the patch. we have also written a
> > simple DT binding for the driver.
> >
> > Thanks in advance for the review, and apologies if I missed addressing any comment.
> >
> > -Mukesh
> >
> > Changes in v2: https://lore.kernel.org/lkml/20251119154427.1033475-1-eugen.hristev@linaro.org/
> > - Fixed doc warnings
> > - Fixed kernel-test robot warnings.
> > - Took Mike suggestion to remove mark inspect flag for dynamic memory.
> > - Added R-b for printk patch.
> > - Modified some commit messages for clarity.
> > - corrected binding change for debug-kinfo as per Rob suggestion.
> >
> > Changelog for meminspect v1:
> > - rename to meminspect
> > - start on top of v2 actually, with the section and all.
> > - remove the backend thing, change the API to access the table
> > - move everything to kernel/
> > - add dependency to CRASH_DUMP instead of a separate knob
> > - move the minidump driver to soc/qcom
> > - integrate the meminspect better into memblock by using a new memblock flag
> > - minor fixes : use dev_err_probe everywhere, rearrange variable declarations,
> > remove some useless code, etc.
> >
> > Changelog for RFC v3:
> > - V2 available here : https://lore.kernel.org/all/20250724135512.518487-1-eugen.hristev@linaro.org/
> > - Removed the .section as requested by David Hildenbrand.
> > - Moved all kmemdump registration(when possible) to vmcoreinfo.
> > - Because of this, some of the variables that I was registering had to be non-static
> > so I had to modify this as per David Hildenbrand suggestion.
> > - Fixed minor things in the Kinfo driver: one field was broken, fixed some
> > compiler warnings, fixed the copyright and remove some useless includes.
> > - Moved the whole kmemdump from drivers/debug into mm/ and Kconfigs into mm/Kconfig.debug
> > and it's now available in kernel hacking, as per Randy Dunlap review
> > - Reworked some of the Documentation as per review from Jon Corbet
> >
> > Changelog for RFC v2:
> > - V1 available here: https://lore.kernel.org/lkml/20250422113156.575971-1-eugen.hristev@linaro.org/
> > - Reworked the whole minidump implementation based on suggestions from Thomas Gleixner.
> > This means new API, macros, new way to store the regions inside kmemdump
> > (ditched the IDR, moved to static allocation, have a static default backend, etc)
> > - Reworked qcom_minidump driver based on review from Bjorn Andersson
> > - Reworked printk log buffer registration based on review from Petr Mladek
> >
> > I appologize if I missed any review comments.
> > Patches are sent on top on next-20260309 tag
> >
> > ---
> > Eugen Hristev (21):
> > kernel: Introduce meminspect
> > init/version: Annotate static information into meminspect
> > mm/percpu: Annotate static information into meminspect
> > cpu: Annotate static information into meminspect
> > genirq/irqdesc: Annotate static information into meminspect
> > timers: Annotate static information into meminspect
> > kernel/fork: Annotate static information into meminspect
> > mm/page_alloc: Annotate static information into meminspect
> > mm/show_mem: Annotate static information into meminspect
> > mm/swapfile: Annotate static information into meminspect
> > kernel/vmcore_info: Register dynamic information into meminspect
> > kernel/configs: Register dynamic information into meminspect
> > mm/init-mm: Annotate static information into meminspect
> > panic: Annotate static information into meminspect
> > kallsyms: Annotate static information into meminspect
> > mm/mm_init: Annotate static information into meminspect
> > sched/core: Annotate runqueues into meminspect
> > remoteproc: qcom: Move minidump data structures into its own header
> > soc: qcom: Add minidump backend driver
> > soc: qcom: smem: Add minidump platform device
> > meminspect: Add debug kinfo compatible driver
> >
> > Mukesh Ojha (4):
> > mm/numa: Register node data information into meminspect
> > mm/sparse: Register information into meminspect
> > printk: Register information into meminspect
> > dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory
> >
> > Documentation/dev-tools/index.rst | 1 +
> > Documentation/dev-tools/meminspect.rst | 144 +++++++
> > .../bindings/reserved-memory/google,kinfo.yaml | 46 ++
> > MAINTAINERS | 14 +
> > drivers/of/platform.c | 1 +
> > drivers/remoteproc/qcom_common.c | 56 +--
> > drivers/soc/qcom/Kconfig | 13 +
> > drivers/soc/qcom/Makefile | 1 +
> > drivers/soc/qcom/minidump.c | 272 ++++++++++++
> > drivers/soc/qcom/smem.c | 10 +
> > include/asm-generic/vmlinux.lds.h | 13 +
> > include/linux/meminspect.h | 263 ++++++++++++
> > include/linux/soc/qcom/minidump.h | 72 ++++
> > init/Kconfig | 1 +
> > init/version-timestamp.c | 3 +
> > init/version.c | 3 +
> > kernel/Makefile | 1 +
> > kernel/configs.c | 6 +
> > kernel/cpu.c | 5 +
> > kernel/fork.c | 3 +
> > kernel/irq/irqdesc.c | 2 +
> > kernel/kallsyms.c | 9 +
> > kernel/meminspect/Kconfig | 30 ++
> > kernel/meminspect/Makefile | 4 +
> > kernel/meminspect/kinfo.c | 284 +++++++++++++
> > kernel/meminspect/meminspect.c | 471 +++++++++++++++++++++
> > kernel/panic.c | 4 +
> > kernel/printk/printk.c | 11 +
> > kernel/sched/core.c | 2 +
> > kernel/time/timer.c | 2 +
> > kernel/vmcore_info.c | 4 +
> > mm/init-mm.c | 11 +
> > mm/mm_init.c | 2 +
> > mm/numa.c | 2 +
> > mm/page_alloc.c | 2 +
> > mm/percpu.c | 2 +
> > mm/show_mem.c | 2 +
> > mm/sparse.c | 6 +
> > mm/swapfile.c | 2 +
> > 39 files changed, 1725 insertions(+), 55 deletions(-)
> > ---
> > base-commit: 343f51842f4ed7143872f3aa116a214a5619a4b9
> > change-id: 20260311-minidump-v2-eed8da647ce5
> >
> > Best regards,
> > --
> > -Mukesh Ojha
> >
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/25] Introduce meminspect
2026-03-16 18:16 ` Mukesh Ojha
@ 2026-03-19 2:55 ` Bjorn Andersson
2026-03-19 7:33 ` Eugen Hristev
0 siblings, 1 reply; 42+ messages in thread
From: Bjorn Andersson @ 2026-03-19 2:55 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Jonathan Corbet, Shuah Khan, Eugen Hristev, Arnd Bergmann,
Dennis Zhou, Tejun Heo, Christoph Lameter, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Anna-Maria Behnsen,
Frederic Weisbecker, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Kees Cook, Brendan Jackman,
Johannes Weiner, Zi Yan, Chris Li, Kairui Song, Kemeng Shi,
Nhat Pham, Baoquan He, Barry Song, Youngjun Park, Petr Mladek,
John Ogness, Sergey Senozhatsky, Mathieu Poirier, Konrad Dybcio,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
workflows, linux-doc, linux-kernel, linux-arch, linux-mm,
linux-arm-msm, linux-remoteproc, devicetree
On Mon, Mar 16, 2026 at 11:46:47PM +0530, Mukesh Ojha wrote:
> On Sun, Mar 15, 2026 at 09:24:39PM -0500, Bjorn Andersson wrote:
> > On Wed, Mar 11, 2026 at 01:45:44AM +0530, Mukesh Ojha wrote:
[..]
> > >, to get all the regions as
> > > separate files. The tool from the host computer will list the regions
> > > in the order they were downloaded.
> > >
> > > Once you have all the files simply use `cat` to put them all together,
> > > in the order of the indexes. For my kernel config and setup, here is my
> > > cat command : (you can use a script or something, I haven't done that so
> > > far):
> >
> > So these need to be sorted in numerical order, by that number at the end
> > of the file name?
> >
> > Do you manually punch these in? How do we make this user friendly?
>
> Yes, manually.. but I think we can do better. We could make
> this more user‑friendly by using the section header and string table in
> the md_KELF binary both of which existed in the earlier implementation.
> Then, we can write an upstream‑friendly script that reads this KELF
> metadata file, checks whether a binary with the registered name is
> present, and stitches everything together to form a complete ELF that
> the crash tool can consume. Let me know if you have any suggestion..
>
Can we somehow identify that these regions belong to the minidump and
teach QDL to build the ELF for us?
Regards,
Bjorn
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 00/25] Introduce meminspect
2026-03-19 2:55 ` Bjorn Andersson
@ 2026-03-19 7:33 ` Eugen Hristev
0 siblings, 0 replies; 42+ messages in thread
From: Eugen Hristev @ 2026-03-19 7:33 UTC (permalink / raw)
To: Bjorn Andersson, Mukesh Ojha
Cc: Jonathan Corbet, Shuah Khan, Arnd Bergmann, Dennis Zhou,
Tejun Heo, Christoph Lameter, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Anna-Maria Behnsen, Frederic Weisbecker,
Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider,
David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Kees Cook, Brendan Jackman, Johannes Weiner, Zi Yan, Chris Li,
Kairui Song, Kemeng Shi, Nhat Pham, Baoquan He, Barry Song,
Youngjun Park, Petr Mladek, John Ogness, Sergey Senozhatsky,
Mathieu Poirier, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Saravana Kannan, workflows, linux-doc, linux-kernel,
linux-arch, linux-mm, linux-arm-msm, linux-remoteproc, devicetree
On 3/19/26 04:55, Bjorn Andersson wrote:
> On Mon, Mar 16, 2026 at 11:46:47PM +0530, Mukesh Ojha wrote:
>> On Sun, Mar 15, 2026 at 09:24:39PM -0500, Bjorn Andersson wrote:
>>> On Wed, Mar 11, 2026 at 01:45:44AM +0530, Mukesh Ojha wrote:
> [..]
>>>> , to get all the regions as
>>>> separate files. The tool from the host computer will list the regions
>>>> in the order they were downloaded.
>>>>
>>>> Once you have all the files simply use `cat` to put them all together,
>>>> in the order of the indexes. For my kernel config and setup, here is my
>>>> cat command : (you can use a script or something, I haven't done that so
>>>> far):
>>>
>>> So these need to be sorted in numerical order, by that number at the end
>>> of the file name?
>>>
>>> Do you manually punch these in? How do we make this user friendly?
>>
>> Yes, manually.. but I think we can do better. We could make
>> this more user‑friendly by using the section header and string table in
>> the md_KELF binary both of which existed in the earlier implementation.
>> Then, we can write an upstream‑friendly script that reads this KELF
>> metadata file, checks whether a binary with the registered name is
>> present, and stitches everything together to form a complete ELF that
>> the crash tool can consume. Let me know if you have any suggestion..
>>
>
> Can we somehow identify that these regions belong to the minidump and
> teach QDL to build the ELF for us?
We could integrate the feature that Mukesh suggests directly into QDL as
a separate command
e.g. qdl download-and-build-minidump
The first region (the ELF header) is mandatory, because all the regions
themselves contain only data. To be able to use any of the regions, one
needs to know at least the physical and virtual address of that memory.
And this information is saved in the ELF header.
So QDL could join together all the regions into a single crashdump-like
file.
>
> Regards,
> Bjorn
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2026-03-19 7:34 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 20:15 [PATCH v2 00/25] Introduce meminspect Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 01/25] kernel: " Mukesh Ojha
2026-03-12 4:33 ` Randy Dunlap
2026-03-12 4:46 ` Randy Dunlap
2026-03-16 8:31 ` Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 02/25] init/version: Annotate static information into meminspect Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 03/25] mm/percpu: " Mukesh Ojha
2026-03-12 20:18 ` kernel test robot
2026-03-13 8:06 ` kernel test robot
2026-03-10 20:15 ` [PATCH v2 04/25] cpu: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 05/25] genirq/irqdesc: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 06/25] timers: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 07/25] kernel/fork: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 08/25] mm/page_alloc: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 09/25] mm/show_mem: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 10/25] mm/swapfile: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 11/25] kernel/vmcore_info: Register dynamic " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 12/25] kernel/configs: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 13/25] mm/init-mm: Annotate static " Mukesh Ojha
2026-03-12 14:28 ` kernel test robot
2026-03-10 20:15 ` [PATCH v2 14/25] panic: " Mukesh Ojha
2026-03-10 20:15 ` [PATCH v2 15/25] kallsyms: " Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 16/25] mm/mm_init: " Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 17/25] sched/core: Annotate runqueues " Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 18/25] mm/numa: Register node data information " Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 19/25] mm/sparse: Register " Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 20/25] printk: " Mukesh Ojha
2026-03-16 9:39 ` John Ogness
2026-03-16 10:24 ` Eugen Hristev
2026-03-10 20:16 ` [PATCH v2 21/25] remoteproc: qcom: Move minidump data structures into its own header Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 22/25] soc: qcom: Add minidump backend driver Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 23/25] soc: qcom: smem: Add minidump platform device Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 24/25] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Mukesh Ojha
2026-03-11 9:05 ` Krzysztof Kozlowski
2026-03-16 11:12 ` Mukesh Ojha
2026-03-10 20:16 ` [PATCH v2 25/25] meminspect: Add debug kinfo compatible driver Mukesh Ojha
2026-03-11 9:09 ` Krzysztof Kozlowski
2026-03-11 22:07 ` Randy Dunlap
2026-03-16 2:24 ` [PATCH v2 00/25] Introduce meminspect Bjorn Andersson
2026-03-16 18:16 ` Mukesh Ojha
2026-03-19 2:55 ` Bjorn Andersson
2026-03-19 7:33 ` Eugen Hristev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox