Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] 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.

Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Vivek Goyal and committed by
Linus Torvalds
625f1c82 cf13f0ea

+23 -5
-2
arch/i386/kernel/crash.c
··· 26 26 #include <asm/apic.h> 27 27 #include <mach_ipi.h> 28 28 29 - #define MAX_NOTE_BYTES 1024 30 - typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 31 29 32 30 note_buf_t crash_notes[NR_CPUS]; 33 31
-3
arch/x86_64/kernel/crash.c
··· 20 20 #include <asm/nmi.h> 21 21 #include <asm/hw_irq.h> 22 22 23 - #define MAX_NOTE_BYTES 1024 24 - typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 25 - 26 23 note_buf_t crash_notes[NR_CPUS]; 27 24 28 25 void machine_crash_shutdown(void)
+5
include/asm-i386/kexec.h
··· 25 25 /* The native architecture */ 26 26 #define KEXEC_ARCH KEXEC_ARCH_386 27 27 28 + #define MAX_NOTE_BYTES 1024 29 + typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 30 + 31 + extern note_buf_t crash_notes[]; 32 + 28 33 #endif /* _I386_KEXEC_H */
+5
include/asm-x86_64/kexec.h
··· 25 25 /* The native architecture */ 26 26 #define KEXEC_ARCH KEXEC_ARCH_X86_64 27 27 28 + #define MAX_NOTE_BYTES 1024 29 + typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 30 + 31 + extern note_buf_t crash_notes[]; 32 + 28 33 #endif /* _X86_64_KEXEC_H */
+13
kernel/ksysfs.c
··· 30 30 KERNEL_ATTR_RO(hotplug_seqnum); 31 31 #endif 32 32 33 + #ifdef CONFIG_KEXEC 34 + #include <asm/kexec.h> 35 + 36 + static ssize_t crash_notes_show(struct subsystem *subsys, char *page) 37 + { 38 + return sprintf(page, "%p\n", (void *)crash_notes); 39 + } 40 + KERNEL_ATTR_RO(crash_notes); 41 + #endif 42 + 33 43 decl_subsys(kernel, NULL, NULL); 34 44 EXPORT_SYMBOL_GPL(kernel_subsys); 35 45 36 46 static struct attribute * kernel_attrs[] = { 37 47 #ifdef CONFIG_HOTPLUG 38 48 &hotplug_seqnum_attr.attr, 49 + #endif 50 + #ifdef CONFIG_KEXEC 51 + &crash_notes_attr.attr, 39 52 #endif 40 53 NULL 41 54 };