From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: mpe@ellerman.id.au
Cc: corbet@lwn.net, mahesh@linux.vnet.ibm.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Sourabh Jain <sourabhjain@linux.ibm.com>,
linuxppc-dev@ozlabs.org, hbathini@linux.ibm.com
Subject: [PATCH v2 2/4] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files
Date: Fri, 18 Oct 2019 18:35:55 +0530 [thread overview]
Message-ID: <20191018130557.2217-3-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20191018130557.2217-1-sourabhjain@linux.ibm.com>
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 in
order to maintain the backward compatibility the /sys/kernel/fadump_*
sysfs files are replicated inside /sys/kernel/fadump/ and eventually get
removed in future.
Consolidate ABI documentation for all the FADump sysfs file in a single
file 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 | 28 +++++++++++++
arch/powerpc/platforms/powernv/opal-core.c | 6 ++-
3 files changed, 74 insertions(+), 1 deletion(-)
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..dbf0606ba917
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-fadump
@@ -0,0 +1,41 @@
+What: /sys/kernel/fadump/*
+Date: Oct 2019
+Contact: linuxppc-dev@lists.ozlabs.org
+Description:
+ The /sys/kernel/fadump/* is a collection of FADump sysfs
+ file provide information about the configuration status
+ of Firmware Assisted Dump (FADump).
+
+What: /sys/kernel/fadump/fadump_enabled
+Date: Oct 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/fadump_registered
+Date: Oct 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/fadump_release_mem
+Date: Oct 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/fadump_release_opalcore
+Date: Oct 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..866eddc279d8 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,26 @@ 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 under FADump kobject.
+ *
+ * - 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..2c7355768d3f 100644
--- a/arch/powerpc/platforms/powernv/opal-core.c
+++ b/arch/powerpc/platforms/powernv/opal-core.c
@@ -625,7 +625,11 @@ static int __init opalcore_init(void)
return rc;
}
- rc = sysfs_create_file(kernel_kobj, &opalcore_rel_attr.attr);
+ /*
+ * Originally fadump_release_opalcore sysfs was part of kernel_kobj
+ * later moved to fadump_kobj.
+ */
+ rc = sysfs_create_file(fadump_kobj, &opalcore_rel_attr.attr);
if (rc) {
pr_warn("unable to create sysfs file fadump_release_opalcore (%d)\n",
rc);
--
2.17.2
next prev parent reply other threads:[~2019-10-18 13:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 13:05 [PATCH v2 0/4] reorganize and add FADump sysfs files Sourabh Jain
2019-10-18 13:05 ` [PATCH v2 1/4] Documentation/ABI: add ABI documentation for /sys/kernel/fadump_* Sourabh Jain
2019-10-18 13:05 ` Sourabh Jain [this message]
2019-10-18 13:05 ` [PATCH v2 3/4] Documentation/ABI: mark /sys/kernel/fadump_* sysfs files deprecated Sourabh Jain
2019-10-21 7:41 ` Hari Bathini
2019-11-05 8:54 ` Sourabh Jain
2019-11-05 17:01 ` Hari Bathini
2019-11-06 5:29 ` Sourabh Jain
2019-10-18 13:05 ` [PATCH v2 4/4] powerpc/fadump: sysfs for fadump memory reservation Sourabh Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191018130557.2217-3-sourabhjain@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=corbet@lwn.net \
--cc=hbathini@linux.ibm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).