lkml.org 
[lkml]   [2019]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] powerpc/fadump: replicate /sys/kernel/fadump_* sysfs into /sys/kernel/fadump/
Date
As the number of FADump sysfs files increases it is hard to manage all of
them inside /sys/kernel directory. It's better to have all the FADump
related sysfs files in a dedicated directory /sys/kernel/fadump. But to
maintain the backward compatibility all the /sys/kernel/fadump_* sysfs
files are replicated inside /sys/kernel/fadump/ and eventually get removed
in future.

Added ABI documentation for all the replicated FADump sysfs file in
Documentation/ABI/testing/sysfs-kernel-fadump.

Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
Documentation/ABI/testing/sysfs-kernel-fadump | 41 +++++++++++++++++++
arch/powerpc/kernel/fadump.c | 29 +++++++++++++
arch/powerpc/platforms/powernv/opal-core.c | 7 ++++
3 files changed, 77 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-fadump

diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump
new file mode 100644
index 000000000000..ed8eec3d759c
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-fadump
@@ -0,0 +1,41 @@
+What: /sys/kernel/fadump/fadump_*
+Date: Sep 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description:
+ The /sys/kernel/fadump/fadump_* is a collection of FADump
+ sysfs file provide information about the configuration status
+ of Firmware Assisted Dump (FADump).
+
+What: /sys/kernel/fadump/enabled
+Date: Sep 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description: read only
+ Primarily used to identify whether the FADump is enabled in
+ the kernel or not.
+User: Kdump service
+
+What: /sys/kernel/fadump/registered
+Date: Sep 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description: read/write
+ Helps to control the dump collect feature from userspace.
+ Setting 1 to this file enables the system to collect the
+ dump and 0 to disable it.
+User: Kdump service
+
+What: /sys/kernel/fadump/release_mem
+Date: Sep 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description: write only
+ This is a special sysfs file and only available when
+ the system is booted to capture the vmcore using FADump.
+ It is used to release the memory reserved by FADump to
+ save the crash dump.
+
+What: /sys/kernel/fadump/release_opalcore
+Date: Sep 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description: write only
+ The sysfs file is available when the system is booted to
+ collect the dump on OPAL based machine. It used to release
+ the memory used to collect the opalcore.
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index ed59855430b9..bb70fa208a86 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1418,6 +1418,9 @@ static int fadump_region_show(struct seq_file *m, void *private)
return 0;
}

+struct kobject *fadump_kobj;
+EXPORT_SYMBOL_GPL(fadump_kobj);
+
static struct kobj_attribute fadump_release_attr = __ATTR(fadump_release_mem,
0200, NULL,
fadump_release_memory_store);
@@ -1435,6 +1438,11 @@ static void fadump_init_files(void)
struct dentry *debugfs_file;
int rc = 0;

+ fadump_kobj = kobject_create_and_add("fadump", kernel_kobj);
+ if (!fadump_kobj) {
+ pr_err("failed to create fadump kobject\n");
+ return;
+ }
rc = sysfs_create_file(kernel_kobj, &fadump_attr.attr);
if (rc)
printk(KERN_ERR "fadump: unable to create sysfs file"
@@ -1458,6 +1466,27 @@ static void fadump_init_files(void)
printk(KERN_ERR "fadump: unable to create sysfs file"
" fadump_release_mem (%d)\n", rc);
}
+ /* Replicating the following sysfs attributes in a new directory
+ * named fadump.
+ *
+ * - fadump_enabled
+ * - fadump_registered
+ * - fadump_release_mem
+ */
+ rc = sysfs_create_file(fadump_kobj, &fadump_attr.attr);
+ if (rc)
+ pr_err("unable to create fadump/fadump_enabled sysfs file (%d)\n",
+ rc);
+ rc = sysfs_create_file(fadump_kobj, &fadump_register_attr.attr);
+ if (rc)
+ pr_err("unable to create fadump/fadump_registered sysfs file (%d)\n",
+ rc);
+ if (fw_dump.dump_active) {
+ rc = sysfs_create_file(fadump_kobj, &fadump_release_attr.attr);
+ if (rc)
+ pr_err("unable to create fadump/fadump_release_mem sysfs file (%d)\n",
+ rc);
+ }
return;
}

diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
index ed895d82c048..8c31aefe8814 100644
--- a/arch/powerpc/platforms/powernv/opal-core.c
+++ b/arch/powerpc/platforms/powernv/opal-core.c
@@ -631,6 +631,13 @@ static int __init opalcore_init(void)
rc);
}

+ /* Replicating the fadump_release_opalcore sysfs file */
+ rc = sysfs_create_file(fadump_kobj, &opalcore_rel_attr.attr);
+ if (rc) {
+ pr_warn("unable to create fadump/fadump_release_opalcore sysfs file (%d)\n",
+ rc)
+ }
+
return 0;
}
fs_initcall(opalcore_init);
--
2.17.2
\
 
 \ /
  Last update: 2019-09-15 15:24    [W:0.042 / U:12.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site