kdump: Initialize vmcoreinfo note at startup
Subsystems (4)
cover kdump: Initialize vmcoreinfo note at startup
Hello Vivek,
Another patch that we would like to have upstream is the vmcoreinfo note intitialization. This is independent from the s390 kdump port. We need that for our traditional stand-alone and hypervisor dump tools. You already have agreed that the patch looks ok:
https://lkml.org/lkml/2011/7/20/296
So could we get an ACK from you for the patch?
[1] kdump: Initialize vmcoreinfo note at startup
[2] s390: Export vmcoreinfo note
Thanks!
Michael
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
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.
--- 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 5 lines · 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).
Both of these will be invoked through panic notifiers because kdump kernel is not loaded?
Quoted 2 lines
For those dumps it
would also be desirable to include the vmcoreinfo data.
Curious that how these two dump schemes make use vmcoreinfo data?
Quoted 5 lines
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.
Instead of this, why don't you initialize the notes in your arch specific call. IOW, why don't you give a call to crash_save_vmcoreinfo() in stand alone dump path to prepare the note and then continue with stand alone dump.
Thanks
Vivek
Quoted 42 lines
Signed-off-by Michael Holzheu <[email protected]>--- kernel/kexec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)kernel/kexec.c +8
-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;
kernel/kexec.c static int __init crash_save_vmcoreinfo_ · line 1500
Quoted 7 lines
kernel/kexec.c +1
-0@@ -1495,6 +1494,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_NUMBER (PG_swapcache);arch_crash_save_vmcoreinfo (); +update_vmcoreinfo_note ();return 0 ; }
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hello Vivek,
Quoted 9 lines · Vivek Goyal
Quoted 5 lines · 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).
Both of these will be invoked through panic notifiers because kdump kernel is not loaded?
This is only one possibility. The other is that they are invoked manually or by hypervisor watchdog without any Linux kernel involvement.
Quoted 5 lines
Quoted 3 lines
For those dumps it
would also be desirable to include the vmcoreinfo data.Curious that how these two dump schemes make use vmcoreinfo data?
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 our 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
Quoted 11 lines
Quoted 6 lines
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.Instead of this, why don't you initialize the notes in your arch specific call. IOW, why don't you give a call to
crash_save_vmcoreinfo()in stand alone dump path to prepare the note and then continue with stand alone dump.
We can't do that because stand-alone and hypervisor dump can be triggered completely without Linux. So no Linux kernel function can/will be called.
Michael
Quoted 22 lines · Michael Holzheu
Hello Vivek,
Quoted 9 lines · Vivek Goyal
Quoted 5 lines · 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).
Both of these will be invoked through panic notifiers because kdump kernel is not loaded?
This is only one possibility. The other is that they are invoked manually or by hypervisor watchdog without any Linux kernel involvement.
Quoted 5 lines
Quoted 3 lines
For those dumps it
would also be desirable to include the vmcoreinfo data.Curious that how these two dump schemes make use vmcoreinfo data?
Quoted 7 lines
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 our 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.
Ok, so you basically need it so that makedumpfile can do filtering without debug info.
Well, if zgetdump is doing everything and you are stashing away an arch specific pointer, I guss you could have saved pointer directly to vmcoreinfo_data and then zgetdump could have made an ELF note out of it for use of makedumpfile.
But anyway, having kernel exported the note does not harm.
Quoted 9 lines
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
If you can do this easily, then you really did not need kdump in kernel? Just use stand alone dump to take dump and then do this to filter dump.
But what happens to ELF headers which map kernel virtual address to physical addresses? kexec-tools prepares those. So in this case when you are capturing the dump, who prepares those? IOW, how does zgetdump creates a mapping between kernel virtual and physical addresses?
Thanks
Vivek
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hello Vivek,
Quoted 11 lines · Vivek Goyal
Quoted 9 lines · Michael Holzheu
Quoted 1 line
Curious that how these two dump schemes make use vmcoreinfo data?
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 our 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.
Quoted 7 lines
Ok, so you basically need it so that makedumpfile can do filtering without debug info.
Well, if zgetdump is doing everything and you are stashing away an arch specific pointer, I guss you could have saved pointer directly to
vmcoreinfo_dataand then zgetdump could have made an ELF note out of it for use of makedumpfile.
Yes that would also be an option. But still you have to initialize the data at startup.
Quoted 1 line
But anyway, having kernel exported the note does not harm.
Correct.
Quoted 10 lines
Quoted 9 lines
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
Quoted 2 lines
If you can do this easily, then you really did not need kdump in kernel? Just use stand alone dump to take dump and then do this to filter dump.
For large systems we still need kdump to do the the filtering while dumping. Currently with stand-alone dump tools we first have to dump all the memory (which takes a long time) and afterwards do the filtering.
And with kdump we just can reuse all the installer stuff that is already available.
Quoted 4 lines
But what happens to ELF headers which map kernel virtual address to physical addresses? kexec-tools prepares those. So in this case when you are capturing the dump, who prepares those? IOW, how does zgetdump creates a mapping between kernel virtual and physical addresses?
On s390 we have a 1:1 mapping for the kernel. For the ELF header loads created by zgetdump virtual=real.
I hope this answers your questions.
So do you agree now with the patch and give us your ACK?
Thanks
Michael
Quoted 11 lines · 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.
Quoted 1 line
Signed-off-by Michael Holzheu <[email protected]>
Looks good to me.
Quoted 40 lines
--- kernel/kexec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)kernel/kexec.c +8
-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;
kernel/kexec.c static int __init crash_save_vmcoreinfo_ · line 1500
Quoted 7 lines
kernel/kexec.c +1
-0@@ -1495,6 +1494,7 @@ static int __init crash_save_vmcoreinfo_VMCOREINFO_NUMBER (PG_swapcache);arch_crash_save_vmcoreinfo (); +update_vmcoreinfo_note ();return 0 ; }
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
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 ();
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec