Skip to content

Commit

Permalink
[PATCH] Kdump: Export crash notes section address through sysfs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Vivek Goyal authored and Linus Torvalds committed Jun 25, 2005
1 parent cf13f0e commit 625f1c8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 0 additions & 2 deletions arch/i386/kernel/crash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
3 changes: 0 additions & 3 deletions arch/x86_64/kernel/crash.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,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)
Expand Down
5 changes: 5 additions & 0 deletions include/asm-i386/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
5 changes: 5 additions & 0 deletions include/asm-x86_64/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
13 changes: 13 additions & 0 deletions kernel/ksysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,25 @@ static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page)
KERNEL_ATTR_RO(hotplug_seqnum);
#endif

#ifdef CONFIG_KEXEC
#include <asm/kexec.h>

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);

static struct attribute * kernel_attrs[] = {
#ifdef CONFIG_HOTPLUG
&hotplug_seqnum_attr.attr,
#endif
#ifdef CONFIG_KEXEC
&crash_notes_attr.attr,
#endif
NULL
};
Expand Down

0 comments on commit 625f1c8

Please sign in to comment.