aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/cpu.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2006-01-09 23:51:42 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:26 -0500
commit51be5606d9ff9eb27ed6514f6172fbd7578a25d6 (patch)
tree8020841fc1eb4fa4603870913385eb9253de7d2e /drivers/base/cpu.c
parentcc57165874e938ef684d71ba7d36e7088b551489 (diff)
[PATCH] kdump: export per cpu crash notes pointer through sysfs
- Kexec on panic functionality allocates memory for saving cpu registers in case of system crash event. Address of this allocated memory needs to be exported to user space, which is used by kexec-tools. - Previously, a single /sys/kernel/crash_notes entry was being exported as memory allocated was a single continuous array. Now memory allocation being dyanmic and per cpu based, address of per cpu buffer is exported through "/sys/devices/system/cpu/cpuX/crash_notes" Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r--drivers/base/cpu.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 281d26784d25..982e6583cd63 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -83,6 +83,33 @@ static inline void register_cpu_control(struct cpu *cpu)
83} 83}
84#endif /* CONFIG_HOTPLUG_CPU */ 84#endif /* CONFIG_HOTPLUG_CPU */
85 85
86#ifdef CONFIG_KEXEC
87#include <linux/kexec.h>
88
89static ssize_t show_crash_notes(struct sys_device *dev, char *buf)
90{
91 struct cpu *cpu = container_of(dev, struct cpu, sysdev);
92 ssize_t rc;
93 unsigned long long addr;
94 int cpunum;
95
96 cpunum = cpu->sysdev.id;
97
98 /*
99 * Might be reading other cpu's data based on which cpu read thread
100 * has been scheduled. But cpu data (memory) is allocated once during
101 * boot up and this data does not change there after. Hence this
102 * operation should be safe. No locking required.
103 */
104 get_cpu();
105 addr = __pa(per_cpu_ptr(crash_notes, cpunum));
106 rc = sprintf(buf, "%Lx\n", addr);
107 put_cpu();
108 return rc;
109}
110static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
111#endif
112
86/* 113/*
87 * register_cpu - Setup a driverfs device for a CPU. 114 * register_cpu - Setup a driverfs device for a CPU.
88 * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to 115 * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to
@@ -108,6 +135,11 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root)
108 register_cpu_control(cpu); 135 register_cpu_control(cpu);
109 if (!error) 136 if (!error)
110 cpu_sys_devices[num] = &cpu->sysdev; 137 cpu_sys_devices[num] = &cpu->sysdev;
138
139#ifdef CONFIG_KEXEC
140 if (!error)
141 error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes);
142#endif
111 return error; 143 return error;
112} 144}
113 145