LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
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 v3 4/4] powerpc/fadump: sysfs for fadump memory reservation
Date: Sat,  9 Nov 2019 17:53:39 +0530
Message-ID: <20191109122339.20484-5-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20191109122339.20484-1-sourabhjain@linux.ibm.com>

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: Sourabh Jain <sourabhjain@linux.ibm.com>
---
 Documentation/ABI/testing/sysfs-kernel-fadump    |  7 +++++++
 Documentation/powerpc/firmware-assisted-dump.rst |  5 +++++
 arch/powerpc/kernel/fadump.c                     | 15 +++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump
index a77f1a5ba389..c1d87c787b9a 100644
--- a/Documentation/ABI/testing/sysfs-kernel-fadump
+++ b/Documentation/ABI/testing/sysfs-kernel-fadump
@@ -39,3 +39,10 @@ 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.
+
+What:		/sys/kernel/fadump/mem_reserved
+Date:		Nov 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.
diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst
index fc7b06408cea..01c3c9461cd5 100644
--- a/Documentation/powerpc/firmware-assisted-dump.rst
+++ b/Documentation/powerpc/firmware-assisted-dump.rst
@@ -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
     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
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index a9591def0c84..2ed80f7b2652 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1357,6 +1357,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)
@@ -1440,6 +1447,10 @@ static struct kobj_attribute enable_attr = __ATTR(enabled,
 static struct kobj_attribute register_attr = __ATTR(registered,
 						0644, fadump_register_show,
 						fadump_register_store);
+static struct kobj_attribute mem_reserved_attr = __ATTR(mem_reserved,
+						0444, fadump_mem_reserved_show,
+						NULL);
+
 
 DEFINE_SHOW_ATTRIBUTE(fadump_region);
 
@@ -1496,6 +1507,10 @@ static void fadump_init_files(void)
 			pr_err("unable to create release_mem sysfs file (%d)\n",
 			       rc);
 	}
+	rc = sysfs_create_file(fadump_kobj, &mem_reserved_attr.attr);
+	if (rc)
+		pr_err("unable to create mem_reserved sysfs file (%d)\n",
+		       rc);
 	return;
 }
 
-- 
2.17.2


      parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09 12:23 [PATCH v3 0/4] reorganize and add FADump sysfs files Sourabh Jain
2019-11-09 12:23 ` [PATCH v3 1/4] Documentation/ABI: add ABI documentation for /sys/kernel/fadump_* Sourabh Jain
2019-11-09 12:23 ` [PATCH v3 2/4] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files Sourabh Jain
2019-11-09 12:59   ` Michal Suchánek
2019-11-16 14:37     ` Sourabh Jain
2019-11-24 18:40       ` Michal Suchánek
2019-11-27  4:54         ` Sourabh Jain
2019-12-03 11:20         ` Sourabh Jain
2019-11-23 11:21   ` kbuild test robot
2019-11-09 12:23 ` [PATCH v3 3/4] Documentation/ABI: mark /sys/kernel/fadump_* sysfs files deprecated Sourabh Jain
2019-11-09 12:23 ` Sourabh Jain [this message]

Reply instructions:

You may reply publically 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=20191109122339.20484-5-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

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git