diff options
author | Zhang Yanfei <zhangyanfei@cn.fujitsu.com> | 2013-03-28 04:15:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-29 12:17:22 -0400 |
commit | eca4549f57a19f8881dcd7b9cef719b3452003c0 (patch) | |
tree | e7b156e0d7c9344337263ed81d683d15203b08fa | |
parent | 6ae07f27ab202069bd567967a0099070eb7f77d5 (diff) |
sysfs: Add crash_notes_size to export percpu note size
For percpu notes, we are exporting only address and not size. So
the userspace tool kexec-tools is putting an upper limit of 1024
and putting the value in p_memsz and p_filesz fields. So the patch
add the new sysfile crash_notes_size to export the exact percpu
note size and let the kexec-tools parse it intead of using 1024.
The idea came from Vivek Goyal. And a later patch will be sent to
kexec-tools to let it parse the size.
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/base/cpu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index fb10728f6372..a55b5909176f 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -132,6 +132,17 @@ static ssize_t show_crash_notes(struct device *dev, struct device_attribute *att | |||
132 | return rc; | 132 | return rc; |
133 | } | 133 | } |
134 | static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL); | 134 | static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL); |
135 | |||
136 | static ssize_t show_crash_notes_size(struct device *dev, | ||
137 | struct device_attribute *attr, | ||
138 | char *buf) | ||
139 | { | ||
140 | ssize_t rc; | ||
141 | |||
142 | rc = sprintf(buf, "%lu\n", sizeof(note_buf_t)); | ||
143 | return rc; | ||
144 | } | ||
145 | static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL); | ||
135 | #endif | 146 | #endif |
136 | 147 | ||
137 | /* | 148 | /* |
@@ -259,6 +270,9 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) | |||
259 | #ifdef CONFIG_KEXEC | 270 | #ifdef CONFIG_KEXEC |
260 | if (!error) | 271 | if (!error) |
261 | error = device_create_file(&cpu->dev, &dev_attr_crash_notes); | 272 | error = device_create_file(&cpu->dev, &dev_attr_crash_notes); |
273 | if (!error) | ||
274 | error = device_create_file(&cpu->dev, | ||
275 | &dev_attr_crash_notes_size); | ||
262 | #endif | 276 | #endif |
263 | return error; | 277 | return error; |
264 | } | 278 | } |