Kdump: Export crash notes section address through sysfs
RFC PATCH 3/3 Kdump: Export crash notes section address through sysfs
o Following patch exports kexec global variable "crash_notes" to user space through sysfs as kernel attribute in /sys/kernel.
---
linux-2.6.11-rc4-mm1-maneesh/arch/i386/kernel/crash.c | 2 -- linux-2.6.11-rc4-mm1-maneesh/include/asm-i386/kexec.h | 5 +++++ linux-2.6.11-rc4-mm1-maneesh/kernel/ksysfs.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
kernel/ksysfs.c renamed from kernel/ksysfs.c~kexec-exports-thru-sysfs +13 -0
@@ -15,6 +15,8 @@#include <linux/module.h> #include <linux/init.h> +#include <asm/kexec.h> +#define KERNEL_ATTR_RO (_name) \ static struct subsys_attribute _name##_attr = __ATTR_RO(_name)
@@ -30,6 +32,14 @@ static ssize_t hotplug_seqnum_show(strucKERNEL_ATTR_RO (hotplug_seqnum);#endif +#ifdef CONFIG_KEXEC +static ssize_t crash_notes_show (struct subsystem *subsys,char *page) +{ +return sprintf (page,"%p\n" , (void *)crash_notes); +} +KERNEL_ATTR_RO (crash_notes); +#endif +decl_subsys (kernel,NULL ,NULL );EXPORT_SYMBOL_GPL (kernel_subsys);
@@ -37,6 +47,9 @@ static struct attribute * kernel_attrs[]#ifdef CONFIG_HOTPLUG &hotplug_seqnum_attr.attr,#endif +#ifdef CONFIG_KEXEC + &crash_notes_attr.attr, +#endifNULL };
include/asm-i386/kexec.h renamed from include/asm-i386/kexec.h~kexec-exports-thru-sysfs +5 -0
@@ -25,4 +25,9 @@/* The native architecture */ #define KEXEC_ARCH KEXEC_ARCH_386 +#define MAX_NOTE_BYTES 1024 +typedef u32 note_buf_t [MAX_NOTE_BYTES /4 ]; + +extern note_buf_t crash_notes[]; +#endif /* _I386_KEXEC_H */
arch/i386/kernel/crash.c renamed from arch/i386/kernel/crash.c~kexec-exports-thru-sysfs +0 -2
@@ -26,8 +26,6 @@#include <asm/apic.h> #include <mach_ipi.h> -#define MAX_NOTE_BYTES 1024 -typedef u32 note_buf_t [MAX_NOTE_BYTES /4 ];note_buf_t crash_notes[NR_CPUS ];
_
Quoted 3 lines · Vivek Goyal
o Following patch exports kexec global variable "
crash_notes" to user space through sysfs as kernel attribute in/sys/kernel.
It breaks the x86_64 build. A fix for that is below.
Please test kexec/kdump patches on all three architectures, both with your config option enabled and with it disabled. There are cross-compilers at
http://developer.osdl.org/dev/plm/cross_compile/
It also breaks the ppc build:
kernel/ksysfs.c: In function `crash_notes_show':kernel/ksysfs.c:38: error: `crash_notes' undeclared (first use in this function) kernel/ksysfs.c:38: error: (Each undeclared identifier is reported only once kernel/ksysfs.c:38: error: for each function it appears in.)
but as ppc doesn't support crashdump, that is unfixable.
Why is the crashdump feature linked to CONFIG_KEXEC? It should have its own config option, which is dependent upon kexec.
kernel/ksysfs.c: In function `crash_notes_show':kernel/ksysfs.c:38: error: `crash_notes' undeclared (first use in this function) kernel/ksysfs.c:38: error: (Each undeclared identifier is reported only once kernel/ksysfs.c:38: error: for each function it appears in.)
---
25-akpm/arch/x86_64/kernel/crash.c | 3 --- 25-akpm/include/asm-x86_64/kexec.h | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-)
include/asm-x86_64/kexec.h renamed from include/asm-x86_64/kexec.h~kdump-export-crash-notes-section-address-through-x86_64-fix +5 -0
@@ -25,4 +25,9 @@/* The native architecture */ #define KEXEC_ARCH KEXEC_ARCH_X86_64 +#define MAX_NOTE_BYTES 1024 +typedef u32 note_buf_t [MAX_NOTE_BYTES /4 ]; + +extern note_buf_t crash_notes[]; +#endif /* _X86_64_KEXEC_H */
arch/x86_64/kernel/crash.c renamed from arch/x86_64/kernel/crash.c~kdump-export-crash-notes-section-address-through-x86_64-fix +0 -3
@@ -22,9 +22,6 @@#include <asm/nmi.h> #include <asm/hw_irq.h> -#define MAX_NOTE_BYTES 1024 -typedef u32 note_buf_t [MAX_NOTE_BYTES /4 ]; -note_buf_t crash_notes[NR_CPUS ];void machine_crash_shutdown (void )
_
Quoted 11 lines · Andrew Morton
Quoted 2 lines · Vivek Goyal
o Following patch exports kexec global variable "
crash_notes" to user space through sysfs as kernel attribute in/sys/kernel.It breaks the
x86_64build. A fix for that is below.Please test kexec/kdump patches on all three architectures, both with your config option enabled and with it disabled. There are cross-compilers at
http://developer.osdl.org/dev/plm/cross_compile/
BTW:
You can download the cross_compile tools and run them yourself or you can submit a patch to the PLM tool and it will run 8 arch. builds for you....
Signature · 1 line
~Randy