From: Greg KH <gregkh@linuxfoundation.org>
To: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: mpe@ellerman.id.au, mahesh@linux.vnet.ibm.com,
hbathini@linux.ibm.com, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org, corbet@lwn.net,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject
Date: Fri, 6 Dec 2019 13:48:01 +0100 [thread overview]
Message-ID: <20191206124801.GD1360047@kroah.com> (raw)
In-Reply-To: <20191206122434.29587-5-sourabhjain@linux.ibm.com>
On Fri, Dec 06, 2019 at 05:54:32PM +0530, Sourabh Jain wrote:
> The /sys/firmware/opal/core and /sys/kernel/fadump_release_opalcore sysfs
> files are used to export and release the OPAL memory on PowerNV platform.
> let's organize them into a new kobject under /sys/firmware/opal/mpipl/
> directory.
>
> A symlink is added to maintain the backward compatibility for
> /sys/firmware/opal/core sysfs file.
>
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> .../sysfs-kernel-fadump_release_opalcore | 2 ++
> .../powerpc/firmware-assisted-dump.rst | 15 +++++----
> arch/powerpc/platforms/powernv/opal-core.c | 31 ++++++++++++++-----
> 3 files changed, 34 insertions(+), 14 deletions(-)
> rename Documentation/ABI/{testing => removed}/sysfs-kernel-fadump_release_opalcore (82%)
>
> diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore b/Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore
> similarity index 82%
> rename from Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore
> rename to Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore
> index 53313c1d4e7a..a8d46cd0f4e6 100644
> --- a/Documentation/ABI/testing/sysfs-kernel-fadump_release_opalcore
> +++ b/Documentation/ABI/removed/sysfs-kernel-fadump_release_opalcore
> @@ -1,3 +1,5 @@
> +This ABI is moved to /sys/firmware/opal/mpipl/release_core.
> +
> What: /sys/kernel/fadump_release_opalcore
> Date: Sep 2019
> Contact: linuxppc-dev@lists.ozlabs.org
> diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst
> index 0455a78486d5..345a3405206e 100644
> --- a/Documentation/powerpc/firmware-assisted-dump.rst
> +++ b/Documentation/powerpc/firmware-assisted-dump.rst
> @@ -112,13 +112,13 @@ to ensure that crash data is preserved to process later.
>
> -- On OPAL based machines (PowerNV), if the kernel is build with
> CONFIG_OPAL_CORE=y, OPAL memory at the time of crash is also
> - exported as /sys/firmware/opal/core file. This procfs file is
> + exported as /sys/firmware/opal/mpipl/core file. This procfs file is
> helpful in debugging OPAL crashes with GDB. The kernel memory
> used for exporting this procfs file can be released by echo'ing
> - '1' to /sys/kernel/fadump_release_opalcore node.
> + '1' to /sys/firmware/opal/mpipl/release_core node.
>
> e.g.
> - # echo 1 > /sys/kernel/fadump_release_opalcore
> + # echo 1 > /sys/firmware/opal/mpipl/release_core
>
> Implementation details:
> -----------------------
> @@ -283,14 +283,17 @@ Here is the list of files under kernel sysfs:
> enhanced to use this interface to release the memory reserved for
> dump and continue without 2nd reboot.
>
> - /sys/kernel/fadump_release_opalcore
> +Note: /sys/kernel/fadump_release_opalcore sysfs has moved to
> + /sys/firmware/opal/mpipl/release_core
> +
> + /sys/firmware/opal/mpipl/release_core
>
> This file is available only on OPAL based machines when FADump is
> active during capture kernel. This is used to release the memory
> - used by the kernel to export /sys/firmware/opal/core file. To
> + used by the kernel to export /sys/firmware/opal/mpipl/core file. To
> release this memory, echo '1' to it:
>
> - echo 1 > /sys/kernel/fadump_release_opalcore
> + echo 1 > /sys/firmware/opal/mpipl/release_core
>
> Here is the list of files under powerpc debugfs:
> (Assuming debugfs is mounted on /sys/kernel/debug directory.)
> diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
> index ed895d82c048..7fcc092d065e 100644
> --- a/arch/powerpc/platforms/powernv/opal-core.c
> +++ b/arch/powerpc/platforms/powernv/opal-core.c
> @@ -589,7 +589,8 @@ static ssize_t fadump_release_opalcore_store(struct kobject *kobj,
> return count;
> }
>
> -static struct kobj_attribute opalcore_rel_attr = __ATTR(fadump_release_opalcore,
> +struct kobject *mpipl_kobj;
> +static struct kobj_attribute opalcore_rel_attr = __ATTR(release_core,
> 0200, NULL,
> fadump_release_opalcore_store);
__ATTR_WO()?
>
> @@ -609,7 +610,7 @@ static int __init opalcore_init(void)
> * then capture the dump.
> */
> if (!(is_opalcore_usable())) {
> - pr_err("Failed to export /sys/firmware/opal/core\n");
> + pr_err("Failed to export /sys/firmware/opal/mpipl/core\n");
> opalcore_cleanup();
> return rc;
> }
> @@ -617,18 +618,32 @@ static int __init opalcore_init(void)
> /* Set OPAL core file size */
> opal_core_attr.size = oc_conf->opalcore_size;
>
> + mpipl_kobj = kobject_create_and_add("mpipl", opal_kobj);
> + if (!mpipl_kobj) {
> + pr_err("unable to create mpipl kobject\n");
> + return -ENOMEM;
> + }
> +
> /* Export OPAL core sysfs file */
> - rc = sysfs_create_bin_file(opal_kobj, &opal_core_attr);
> + rc = sysfs_create_bin_file(mpipl_kobj, &opal_core_attr);
Again, create an attribute group and add everything all at once, makes
it much simpler and your error cleanup logic will actually work :)
thanks,
greg k-h
next prev parent reply other threads:[~2019-12-06 12:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 12:24 [PATCH v4 0/6] reorganize and add FADump sysfs files Sourabh Jain
2019-12-06 12:24 ` [PATCH v4 1/6] Documentation/ABI: add ABI documentation for /sys/kernel/fadump_* Sourabh Jain
2019-12-06 12:47 ` Greg KH
2019-12-06 12:24 ` [PATCH v4 2/6] sysfs: wrap __compat_only_sysfs_link_entry_to_kobj function to change the symlink name Sourabh Jain
2019-12-06 12:46 ` Greg KH
2019-12-06 18:27 ` Sourabh Jain
2019-12-06 19:14 ` Greg KH
2019-12-07 3:21 ` Sourabh Jain
2019-12-06 12:24 ` [PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files Sourabh Jain
2019-12-06 12:45 ` Greg KH
2019-12-06 19:13 ` Sourabh Jain
2019-12-06 12:24 ` [PATCH v4 4/6] powerpc/powernv: move core and fadump_release_opalcore under new kobject Sourabh Jain
2019-12-06 12:48 ` Greg KH [this message]
2019-12-06 19:16 ` Sourabh Jain
2019-12-06 12:24 ` [PATCH v4 5/6] Documentation/ABI: mark /sys/kernel/fadump_* sysfs files deprecated Sourabh Jain
2019-12-06 12:24 ` [PATCH v4 6/6] powerpc/fadump: sysfs for fadump memory reservation Sourabh Jain
2019-12-06 12:48 ` Greg KH
2019-12-06 19:19 ` 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=20191206124801.GD1360047@kroah.com \
--to=gregkh@linuxfoundation.org \
--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 \
--cc=sourabhjain@linux.ibm.com \
/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).