diff options
-rw-r--r-- | drivers/base/cpu.c | 32 | ||||
-rw-r--r-- | kernel/ksysfs.c | 13 |
2 files changed, 32 insertions, 13 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 | |||
89 | static 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 | } | ||
110 | static 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 | ||
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 99af8b05eeaa..d5eeae0fa5bc 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -51,16 +51,6 @@ static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, s | |||
51 | KERNEL_ATTR_RW(uevent_helper); | 51 | KERNEL_ATTR_RW(uevent_helper); |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef CONFIG_KEXEC | ||
55 | #include <asm/kexec.h> | ||
56 | |||
57 | static ssize_t crash_notes_show(struct subsystem *subsys, char *page) | ||
58 | { | ||
59 | return sprintf(page, "%p\n", (void *)crash_notes); | ||
60 | } | ||
61 | KERNEL_ATTR_RO(crash_notes); | ||
62 | #endif | ||
63 | |||
64 | decl_subsys(kernel, NULL, NULL); | 54 | decl_subsys(kernel, NULL, NULL); |
65 | EXPORT_SYMBOL_GPL(kernel_subsys); | 55 | EXPORT_SYMBOL_GPL(kernel_subsys); |
66 | 56 | ||
@@ -69,9 +59,6 @@ static struct attribute * kernel_attrs[] = { | |||
69 | &uevent_seqnum_attr.attr, | 59 | &uevent_seqnum_attr.attr, |
70 | &uevent_helper_attr.attr, | 60 | &uevent_helper_attr.attr, |
71 | #endif | 61 | #endif |
72 | #ifdef CONFIG_KEXEC | ||
73 | &crash_notes_attr.attr, | ||
74 | #endif | ||
75 | NULL | 62 | NULL |
76 | }; | 63 | }; |
77 | 64 | ||