vmcore: report the release of the crashed kernel
Subsystems (5)
PATCH 1/1 vmcore: report the release of the crashed kernel
kdump runs in a very small environment and cut-down set of drivers, and it can die before the dump lands: it runs out of memory, a device hangs on reset, or a watchdog fires while the dump is still being written out. This happens about a single high digit percentage on most of big scale datacenters.
When that happens the only evidence left is what the capture kernel printed to the console, and that does not say which kernel crashed.
A fleet typically pins one kdump image and boots it after crashes from many different production kernels, and it is useful to understand what are the combination of crashed kernel panic and succesful kdump collection.
Whether the dump completes at all tends to depend on the kernel that
died: memory pinned, devices in flight, dump size.
The release is already recorded. crash_save_vmcoreinfo_init() puts OSRELEASE= in the VMCOREINFO note, and by the time vmcore_init() has run parse_crash_elf_headers() that note sits in elfnotes_buf. Walk the notes for it and print:
vmcore: dump is from kernel 7.3.0-rc3-next-20260917
Given this is cheap and useful, I think it is worth adding to vmcore, to improve kdump monitoring.
--- fs/proc/vmcore.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
fs/proc/vmcore.c +20 -0
@@ -1709,6 +1709,24 @@ static void vmcore_free_device_dumps(void)#endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */ } +#define VMCOREINFO_OSRELEASE_KEY "OSRELEASE=" + +static void __init vmcore_report_crashed_release (void ) +{ +const char *ver, *eol; + + ver =strnstr (elfnotes_buf,VMCOREINFO_OSRELEASE_KEY , elfnotes_sz); +if (!ver) +return ; + + ver +=sizeof (VMCOREINFO_OSRELEASE_KEY ) -1 ; + eol =memchr (ver,'\n' , elfnotes_buf + elfnotes_sz - ver); +if (!eol) +return ; + +pr_notice ("dump is from kernel %.*s\n" , (int )(eol - ver), ver); +} +/* Init function for vmcore module. */ static int __init vmcore_init (void ) {
@@ -1733,6 +1751,8 @@ static int __init vmcore_init(void)elfcorehdr_free (elfcorehdr_addr); elfcorehdr_addr =ELFCORE_ADDR_ERR ; +vmcore_report_crashed_release (); + proc_vmcore =proc_create ("vmcore" ,S_IRUSR ,NULL , &vmcore_proc_ops);if (proc_vmcore) proc_vmcore->size = vmcore_size;
---
base-commit: 3f2425f5b5bbbdd991ca9cdfd5502e68d8895998
change-id: 20260918-kdump_print-861a49b856ca
Best regards,
Signature · 1 line
Breno Leitao <[email protected]>
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 22 lines
kdump runs in a very small environment and cut-down set of drivers, and it can die before the dump lands: it runs out of memory, a device hangs on reset, or a watchdog fires while the dump is still being written out. This happens about a single high digit percentage on most of big scale datacenters.
When that happens the only evidence left is what the capture kernel printed to the console, and that does not say which kernel crashed.
A fleet typically pins one kdump image and boots it after crashes from many different production kernels, and it is useful to understand what are the combination of crashed kernel panic and succesful kdump collection.
Whether the dump completes at all tends to depend on the kernel that
died: memory pinned, devices in flight, dump size.The release is already recorded.
crash_save_vmcoreinfo_init()puts OSRELEASE= in the VMCOREINFO note, and by the timevmcore_init()has runparse_crash_elf_headers()that note sits inelfnotes_buf. Walk the notes for it and print:
Quoted 6 lines
vmcore: dump is from kernel 7.3.0-rc3-next-20260917
Given this is cheap and useful, I think it is worth adding to vmcore, to improve kdump monitoring.
Signed-off-by Breno Leitao <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 1 line · Breno Leitao
vmcore: report the release of the crashed kernel
Applied to the vfs-7.4.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.4.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.4.misc
[1/1] vmcore: report the release of the crashed kernel
https://git.kernel.org/vfs/vfs/c/9a82c64e133f