Skip to contentSkip to conversation

powerpc/fadump: sysfs for fadump memory reservation

PATCH Superseded Sourabh Jain 2 participants 2 messages Aug 8, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/fadump: sysfs for fadump memory reservation

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

Add an ABI doc entry for new sysfs interface.
- /sys/kernel/fadump_mem_reserved

---
v1 -> v2:
- Added ABI doc for new sysfs interface.
---

 Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
 Documentation/powerpc/firmware-assisted-dump.rst |  5 +++++
 arch/powerpc/kernel/fadump.c                     | 14 ++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-fadump
Documentation/ABI/testing/sysfs-kernel-fadump new file +6 -0
new file mode 100644
index 000000000000..003e2f025dcb
@@ -0,0 +1,6 @@
+What:		/sys/kernel/fadump_mem_reserved
+Date:		August 2019
+Contact:	[email protected]
+Description:	read only
+		Provide information about the amount of memory
+		reserved by fadump to saving the crash dump.
Documentation/powerpc/firmware-assisted-dump.rst +5 -0
index 9ca12830a48e..a5dfb20d4dc3 100644
@@ -222,6 +222,11 @@ Here is the list of files under kernel sysfs:
     be handled and vmcore will not be captured. This interface can be
     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
     This file is available only when fadump is active during
     second kernel. This is used to release the reserved memory
arch/powerpc/kernel/fadump.c +14 -0
index 4eab97292cc2..cd373d1d4b82 100644
@@ -1514,6 +1514,13 @@ static ssize_t fadump_enabled_show(struct kobject *kobj,
 	return sprintf(buf, "%d\n", fw_dump.fadump_enabled);
 }
 
+static ssize_t fadump_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 fadump_register_show(struct kobject *kobj,
 					struct kobj_attribute *attr,
 					char *buf)
@@ -1632,6 +1639,9 @@ static struct kobj_attribute fadump_attr = __ATTR(fadump_enabled,
 static struct kobj_attribute fadump_register_attr = __ATTR(fadump_registered,
 						0644, fadump_register_show,
 						fadump_register_store);
+static struct kobj_attribute fadump_mem_reserved_attr =
+			__ATTR(fadump_mem_reserved, 0444,
+			       fadump_mem_reserved_show, NULL);
 
 DEFINE_SHOW_ATTRIBUTE(fadump_region);
 
@@ -1663,6 +1673,10 @@ static void fadump_init_files(void)
 			printk(KERN_ERR "fadump: unable to create sysfs file"
 				" fadump_release_mem (%d)\n", rc);
 	}
+	rc = sysfs_create_file(kernel_kobj, &fadump_mem_reserved_attr.attr);
+	if (rc)
+		pr_err("unable to create sysfs file fadump_mem_reserved (%d)\n",
+		       rc);
 	return;
 }
 
Signature · 1 line
2.17.2
#1 lore raw
Quoted 24 lines · Sourabh Jain

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

Add an ABI doc entry for new sysfs interface.
- /sys/kernel/fadump_mem_reserved

---
v1 -> v2:
- Added ABI doc for new sysfs interface.
---

 Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
 Documentation/powerpc/firmware-assisted-dump.rst |  5 +++++
 arch/powerpc/kernel/fadump.c                     | 14 ++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-fadump
Documentation/ABI/testing/sysfs-kernel-fadump new file +0 -0
new file mode 100644
index 000000000000..003e2f025dcb

Documentation/ABI/testing/sysfs-kernel-fadump line 6

Quoted 6 lines
Documentation/ABI/testing/sysfs-kernel-fadump new file +6 -0
@@ -0,0 +1,6 @@
+What:		/sys/kernel/fadump_mem_reserved
+Date:		August 2019
+Contact:	[email protected]
+Description:	read only
+		Provide information about the amount of memory
+		reserved by fadump to saving the crash dump.

s/to saving/to save/

Rest looks good..

Thanks
Hari