Commit d8e73458 authored by Sourabh Jain's avatar Sourabh Jain Committed by Michael Ellerman

powerpc/fadump: sysfs for fadump memory reservation

Add a sys interface to allow querying the memory reserved by FADump for
saving the crash dump.

Also added Documentation/ABI for the new sysfs file.
Signed-off-by: default avatarSourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191211160910.21656-7-sourabhjain@linux.ibm.com
parent 3f5f1f22
...@@ -31,3 +31,10 @@ Description: write only ...@@ -31,3 +31,10 @@ Description: write only
the system is booted to capture the vmcore using FADump. the system is booted to capture the vmcore using FADump.
It is used to release the memory reserved by FADump to It is used to release the memory reserved by FADump to
save the crash dump. save the crash dump.
What: /sys/kernel/fadump/mem_reserved
Date: Dec 2019
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Provide information about the amount of memory reserved by
FADump to save the crash dump in bytes.
...@@ -268,6 +268,11 @@ Here is the list of files under kernel sysfs: ...@@ -268,6 +268,11 @@ Here is the list of files under kernel sysfs:
be handled and vmcore will not be captured. This interface can be be handled and vmcore will not be captured. This interface can be
easily integrated with kdump service start/stop. easily integrated with kdump service start/stop.
/sys/kernel/fadump/mem_reserved
This is used to display the memory reserved by FADump for saving the
crash dump.
/sys/kernel/fadump_release_mem /sys/kernel/fadump_release_mem
This file is available only when FADump is active during This file is available only when FADump is active during
second kernel. This is used to release the reserved memory second kernel. This is used to release the reserved memory
......
...@@ -1369,6 +1369,13 @@ static ssize_t enabled_show(struct kobject *kobj, ...@@ -1369,6 +1369,13 @@ static ssize_t enabled_show(struct kobject *kobj,
return sprintf(buf, "%d\n", fw_dump.fadump_enabled); return sprintf(buf, "%d\n", fw_dump.fadump_enabled);
} }
static ssize_t mem_reserved_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{
return sprintf(buf, "%ld\n", fw_dump.reserve_dump_area_size);
}
static ssize_t registered_show(struct kobject *kobj, static ssize_t registered_show(struct kobject *kobj,
struct kobj_attribute *attr, struct kobj_attribute *attr,
char *buf) char *buf)
...@@ -1433,10 +1440,12 @@ static int fadump_region_show(struct seq_file *m, void *private) ...@@ -1433,10 +1440,12 @@ static int fadump_region_show(struct seq_file *m, void *private)
static struct kobj_attribute release_attr = __ATTR_WO(release_mem); static struct kobj_attribute release_attr = __ATTR_WO(release_mem);
static struct kobj_attribute enable_attr = __ATTR_RO(enabled); static struct kobj_attribute enable_attr = __ATTR_RO(enabled);
static struct kobj_attribute register_attr = __ATTR_RW(registered); static struct kobj_attribute register_attr = __ATTR_RW(registered);
static struct kobj_attribute mem_reserved_attr = __ATTR_RO(mem_reserved);
static struct attribute *fadump_attrs[] = { static struct attribute *fadump_attrs[] = {
&enable_attr.attr, &enable_attr.attr,
&register_attr.attr, &register_attr.attr,
&mem_reserved_attr.attr,
NULL, NULL,
}; };
......
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