kdump: Initialize vmcoreinfo note at startup
Subsystems (4)
cover kdump: Initialize vmcoreinfo note at startup
Hello Andrew,
Another common code patch that we would like to have upstream is the vmcoreinfo note initialization at Linux startup time. We need that for our traditional stand-alone and hypervisor dump tools.
[1] kdump: Initialize vmcoreinfo note at startup
[2] s390: Export vmcoreinfo note
I already have discussed this with Vivek and he has acked the common code patch [1].
Do you agree that Martin sends these patches together with the kdump page table patches (see https://lkml.org/lkml/2011/9/15/55) in the next merge window?
Michael
PATCH 1/2 kdump: Initialize vmcoreinfo note at startup
From: Michael Holzheu <[email protected]>
Currently the vmcoreinfo note is only initialized in case of kdump. On s390 it is possible to create kernel dumps with other dump mechanisms than kdump (e.g. via hypervisor dump or stand-alone dump tools). For those dumps it would also be desirable to include the vmcoreinfo data. To accomplish this, with this patch the vmcoreinfo ELF note is always initialized, not only in case of a (kdump) crash. On s390 we will add an ABI defined pointer at a well known address to vmcoreinfo so that dump analysis tools are able to find this information.
In particular on s390 we have a tool named zgetdump. With this tool it is possible to convert dump formats on the fly using fuse. E.g. you can mount a s390 stand-alone dump as ELF dump. When this is done, the tool finds the vmcoreinfo in the stand-alone dump via the well known ABI defined address and it creates the respective VMCOREINFO ELF note in the output ELF dump. This then can be used e.g. by makedumpfile for dump filtering. No more need for a vmlinux file with debug information.
So this will look like the following:
$ zgetdump --mount standalone.dump -f elf /mnt $ ls /mnt dump.elf $ readelf -n /mnt/dump.elf $ ... VMCOREINFO 0x00000474 Unknown note type: (0x00000000) $ makedumpfile -c -d 31 /mnt/dump.elf dump.kdump
--- kernel/kexec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
kernel/kexec.c +9 -9
@@ -1392,24 +1392,23 @@ int __init parse_crashkernel(char *cm } - -void crash_save_vmcoreinfo (void ) +static void update_vmcoreinfo_note (void ) { -u32 *buf; +u32 *buf = (u32 *) vmcoreinfo_note;if (!vmcoreinfo_size)return ; - -vmcoreinfo_append_str ("CRASHTIME=%ld" ,get_seconds ()); - - buf = (u32 *)vmcoreinfo_note; - buf =append_elf_note (buf,VMCOREINFO_NOTE_NAME ,0 , vmcoreinfo_data, vmcoreinfo_size); -final_note (buf); } +void crash_save_vmcoreinfo (void ) +{ +vmcoreinfo_append_str ("CRASHTIME=%ld" ,get_seconds ()); +update_vmcoreinfo_note (); +} +void vmcoreinfo_append_str (const char *fmt, ...) {va_list args;
@@ -1495,6 +1494,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_NUMBER (PG_swapcache);arch_crash_save_vmcoreinfo (); +update_vmcoreinfo_note ();return 0 ; }
Quoted 30 lines · On Tue, 20 Sep 2011 16:34:01 +0200 Michael Holzheu…
From: Michael Holzheu <[email protected]>
Currently the vmcoreinfo note is only initialized in case of kdump. On s390 it is possible to create kernel dumps with other dump mechanisms than kdump (e.g. via hypervisor dump or stand-alone dump tools). For those dumps it would also be desirable to include the vmcoreinfo data. To accomplish this, with this patch the vmcoreinfo ELF note is always initialized, not only in case of a (kdump) crash. On s390 we will add an ABI defined pointer at a well known address to vmcoreinfo so that dump analysis tools are able to find this information.
In particular on s390 we have a tool named zgetdump. With this tool it is possible to convert dump formats on the fly using fuse. E.g. you can mount a s390 stand-alone dump as ELF dump. When this is done, the tool finds the vmcoreinfo in the stand-alone dump via the well known ABI defined address and it creates the respective VMCOREINFO ELF note in the output ELF dump. This then can be used e.g. by makedumpfile for dump filtering. No more need for a vmlinux file with debug information.
So this will look like the following:
$ zgetdump --mount standalone.dump -f elf /mnt $ ls /mnt dump.elf $ readelf -n /mnt/dump.elf $ ... VMCOREINFO 0x00000474 Unknown note type: (0x00000000) $ makedumpfile -c -d 31 /mnt/dump.elf dump.kdump...
kernel/kexec.c int __init parse_crashkernel(char *cm · line 1397
Quoted 5 lines
kernel/kexec.c +2
-2-void crash_save_vmcoreinfo (void ) +static void update_vmcoreinfo_note (void ) { -u32 *buf; +u32 *buf = (u32 *) vmcoreinfo_note;
The cast is unneeded?
kernel/kexec.c int __init parse_crashkernel(char *cm · line 1405
Quoted 6 lines
kernel/kexec.c +0
-4if (!vmcoreinfo_size)return ; - -vmcoreinfo_append_str ("CRASHTIME=%ld" ,get_seconds ()); - - buf = (u32 *)vmcoreinfo_note;
As was the space you added after it ;)
Quoted 5 lines
kernel/kexec.c +0
-1buf =append_elf_note (buf,VMCOREINFO_NOTE_NAME ,0 , vmcoreinfo_data, vmcoreinfo_size); -final_note (buf); }
Hello Andrew,
Quoted 1 line · Andrew Morton
On Tue, 20 Sep 2011 16:34:01 +0200
[snip]
Quoted 8 lines
kernel/kexec.c int __init parse_crashkernel(char *cm · line 1397
Quoted 5 lines · Michael Holzheu
kernel/kexec.c +2
-2-void crash_save_vmcoreinfo (void ) +static void update_vmcoreinfo_note (void ) { -u32 *buf; +u32 *buf = (u32 *) vmcoreinfo_note;The cast is unneeded?
Correct. I removed the cast (with the blank :), thanks!
Michael
PATCH 2/2 s390: Export vmcoreinfo note
In reply to Michael HolzheuFrom: Michael Holzheu <[email protected]>
This patch defines for s390 an ABI defined pointer to the vmcoreinfo note at a well known address. With this patch tools are able to find this information in dumps created by stand-alone or hypervisor dump tools.
--- arch/s390/include/asm/lowcore.h | 3 ++- arch/s390/kernel/setup.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
arch/s390/include/asm/lowcore.h +2 -1
@@ -287,7 +287,8 @@ struct _lowcore {*/ __u64 ipib;/* 0x0e00 */ __u32 ipib_checksum;/* 0x0e08 */ -__u8 pad_0x0e0c[0x0f00 -0x0e0c ];/* 0x0e0c */ +__u64 vmcore_info;/* 0x0e0c */ +__u8 pad_0x0e14[0x0f00 -0x0e14 ];/* 0x0e14 */ /* Extended facility list */ __u64 stfle_fac_list[32 ];/* 0x0f00 */
arch/s390/kernel/setup.c +8 -0
@@ -559,6 +559,13 @@ static void __init setup_restart_psw(voicopy_to_absolute_zero (&S390_lowcore.restart_psw, &psw,sizeof (psw)); } +static void __init setup_vmcoreinfo (void ) +{ +unsigned long ptr =paddr_vmcoreinfo_note (); + +copy_to_absolute_zero (&S390_lowcore.vmcore_info, &ptr,sizeof (ptr)); +} +#ifdef CONFIG_CRASH_DUMP /*
@@ -1019,6 +1026,7 @@ setup_arch(char **cmdline_p)reserve_crashkernel ();setup_memory ();setup_resources (); +setup_vmcoreinfo ();setup_restart_psw ();setup_lowcore ();
Quoted 9 lines · On Tue, 20 Sep 2011 16:34:00 +0200 Michael Holzheu…
Hello Andrew,
Another common code patch that we would like to have upstream is the vmcoreinfo note initialization at Linux startup time. We need that for our traditional stand-alone and hypervisor dump tools.
[1] kdump: Initialize vmcoreinfo note at startup
[2] s390: Export vmcoreinfo note
Quoted 6 lines
I already have discussed this with Vivek and he has acked the common code patch [1].
Do you agree that Martin sends these patches together with the kdump page table patches (see https://lkml.org/lkml/2011/9/15/55) in the next merge window?
Sounds good to me, thanks.