Commit eca4549f authored by Zhang Yanfei's avatar Zhang Yanfei Committed by Greg Kroah-Hartman

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: default avatarZhang Yanfei <zhangyanfei@cn.fujitsu.com>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ae07f27
...@@ -132,6 +132,17 @@ static ssize_t show_crash_notes(struct device *dev, struct device_attribute *att ...@@ -132,6 +132,17 @@ static ssize_t show_crash_notes(struct device *dev, struct device_attribute *att
return rc; return rc;
} }
static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL); static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL);
static ssize_t show_crash_notes_size(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t rc;
rc = sprintf(buf, "%lu\n", sizeof(note_buf_t));
return rc;
}
static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL);
#endif #endif
/* /*
...@@ -259,6 +270,9 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) ...@@ -259,6 +270,9 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
if (!error) if (!error)
error = device_create_file(&cpu->dev, &dev_attr_crash_notes); error = device_create_file(&cpu->dev, &dev_attr_crash_notes);
if (!error)
error = device_create_file(&cpu->dev,
&dev_attr_crash_notes_size);
#endif #endif
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment