diff mbox series

[v3] powerpc/fadump: sysfs for fadump memory reservation

Message ID 20190810175905.7761-1-sourabhjain@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series [v3] powerpc/fadump: sysfs for fadump memory reservation | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (da206bd46848568e1aaf35f00e2d78bf9bc94f95)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked

Commit Message

Sourabh Jain Aug. 10, 2019, 5:59 p.m. UTC
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

Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
Changelog:
v1 -> v2:
  - Added ABI doc for new sysfs interface.

v2 -> v3:
  - Updated the ABI documentation.
---

 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

Comments

Hari Bathini Aug. 26, 2019, 9:59 a.m. UTC | #1
On 10/08/19 11:29 PM, Sourabh Jain wrote:
> 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
> 
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> Changelog:
> v1 -> v2:
>   - Added ABI doc for new sysfs interface.
> 
> v2 -> v3:
>   - Updated the ABI documentation.
> ---
> 
>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++

Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?

> +++ b/Documentation/ABI/testing/sysfs-kernel-fadump
> @@ -0,0 +1,6 @@
> +What:		/sys/kernel/fadump_mem_reserved
> +Date:		August 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.

Split this up into a separate patch and have ABI documentation for
fadump_reserved & fadump_registered as well..

Thanks
Hari
Sourabh Jain Aug. 26, 2019, 10:16 a.m. UTC | #2
On 8/26/19 3:29 PM, Hari Bathini wrote:
> 
> 
> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>> 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
>>
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> Changelog:
>> v1 -> v2:
>>   - Added ABI doc for new sysfs interface.
>>
>> v2 -> v3:
>>   - Updated the ABI documentation.
>> ---
>>
>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
> 
> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
> 
>> +++ b/Documentation/ABI/testing/sysfs-kernel-fadump
>> @@ -0,0 +1,6 @@
>> +What:		/sys/kernel/fadump_mem_reserved
>> +Date:		August 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.
> 
> Split this up into a separate patch and have ABI documentation for
> fadump_reserved & fadump_registered as well..


Sure. Thanks for review.


- Sourabh Jain
Sourabh Jain Aug. 26, 2019, 10:44 a.m. UTC | #3
On 8/26/19 3:46 PM, Sourabh Jain wrote:
> 
> 
> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>
>>
>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>> 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
>>>
>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>> ---
>>> Changelog:
>>> v1 -> v2:
>>>   - Added ABI doc for new sysfs interface.
>>>
>>> v2 -> v3:
>>>   - Updated the ABI documentation.
>>> ---
>>>
>>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
>>
>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?

How about documenting fadump_mem_reserved and other sysfs attributes suggested
by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?
 
>>
>>> +++ b/Documentation/ABI/testing/sysfs-kernel-fadump
>>> @@ -0,0 +1,6 @@
>>> +What:		/sys/kernel/fadump_mem_reserved
>>> +Date:		August 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.
>>
>> Split this up into a separate patch and have ABI documentation for
>> fadump_reserved & fadump_registered as well..

- Sourabh Jain
Hari Bathini Aug. 26, 2019, 11:16 a.m. UTC | #4
On 26/08/19 4:14 PM, Sourabh Jain wrote:
> 
> 
> On 8/26/19 3:46 PM, Sourabh Jain wrote:
>>
>>
>> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>>
>>>
>>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>>> 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
>>>>
>>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>>> ---
>>>> Changelog:
>>>> v1 -> v2:
>>>>   - Added ABI doc for new sysfs interface.
>>>>
>>>> v2 -> v3:
>>>>   - Updated the ABI documentation.
>>>> ---
>>>>
>>>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
>>>
>>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
> 
> How about documenting fadump_mem_reserved and other sysfs attributes suggested
> by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?

I wouldn't mind that but please do check if it is breaking a convention..

- Hari
Michael Ellerman Aug. 27, 2019, 3:19 a.m. UTC | #5
Hari Bathini <hbathini@linux.ibm.com> writes:
> On 26/08/19 4:14 PM, Sourabh Jain wrote:
>> On 8/26/19 3:46 PM, Sourabh Jain wrote:
>>> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>>>> 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
>>>>>
>>>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>>>> ---
>>>>> Changelog:
>>>>> v1 -> v2:
>>>>>   - Added ABI doc for new sysfs interface.
>>>>>
>>>>> v2 -> v3:
>>>>>   - Updated the ABI documentation.
>>>>> ---
>>>>>
>>>>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
>>>>
>>>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
>> 
>> How about documenting fadump_mem_reserved and other sysfs attributes suggested
>> by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?
>
> I wouldn't mind that but please do check if it is breaking a convention..

AIUI a file named like that would hold the documentation for the files
inside a directory called /sys/kernel/fadump.

And in fact that's probably where these files should live, rather than
just dropped directly into /sys/kernel.

cheers
Hari Bathini Aug. 27, 2019, 6:02 a.m. UTC | #6
On 27/08/19 8:49 AM, Michael Ellerman wrote:
> Hari Bathini <hbathini@linux.ibm.com> writes:
>> On 26/08/19 4:14 PM, Sourabh Jain wrote:
>>> On 8/26/19 3:46 PM, Sourabh Jain wrote:
>>>> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>>>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>>>>> 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
>>>>>>
>>>>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>>>>> ---
>>>>>> Changelog:
>>>>>> v1 -> v2:
>>>>>>   - Added ABI doc for new sysfs interface.
>>>>>>
>>>>>> v2 -> v3:
>>>>>>   - Updated the ABI documentation.
>>>>>> ---
>>>>>>
>>>>>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
>>>>>
>>>>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
>>>
>>> How about documenting fadump_mem_reserved and other sysfs attributes suggested
>>> by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?
>>
>> I wouldn't mind that but please do check if it is breaking a convention..
> 
> AIUI a file named like that would hold the documentation for the files
> inside a directory called /sys/kernel/fadump.
> 
> And in fact that's probably where these files should live, rather than
> just dropped directly into /sys/kernel.
Michael, could that be corrected now by introducing new sysfs files for FADump in
/sys/kernel/fadump/.

Also, duplicating current /sys/kernel/fadump_* files as /sys/kernel/fadump/* files
& eventually dropping /sys/kernel/fadump_* files sometime later..

- Hari
Sourabh Jain Sept. 18, 2019, 8:19 a.m. UTC | #7
On 8/27/19 11:32 AM, Hari Bathini wrote:
> 
> 
> On 27/08/19 8:49 AM, Michael Ellerman wrote:
>> Hari Bathini <hbathini@linux.ibm.com> writes:
>>> On 26/08/19 4:14 PM, Sourabh Jain wrote:
>>>> On 8/26/19 3:46 PM, Sourabh Jain wrote:
>>>>> On 8/26/19 3:29 PM, Hari Bathini wrote:
>>>>>> On 10/08/19 11:29 PM, Sourabh Jain wrote:
>>>>>>> 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
>>>>>>>
>>>>>>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>>>>>>> ---
>>>>>>> Changelog:
>>>>>>> v1 -> v2:
>>>>>>>   - Added ABI doc for new sysfs interface.
>>>>>>>
>>>>>>> v2 -> v3:
>>>>>>>   - Updated the ABI documentation.
>>>>>>> ---
>>>>>>>
>>>>>>>  Documentation/ABI/testing/sysfs-kernel-fadump    |  6 ++++++
>>>>>>
>>>>>> Shouldn't this be Documentation/ABI/testing/sysfs-kernel-fadump_mem_reserved?
>>>>
>>>> How about documenting fadump_mem_reserved and other sysfs attributes suggested
>>>> by you in a single file Documentation/ABI/testing/sysfs-kernel-fadump?
>>>
>>> I wouldn't mind that but please do check if it is breaking a convention..
>>
>> AIUI a file named like that would hold the documentation for the files
>> inside a directory called /sys/kernel/fadump.
>>
>> And in fact that's probably where these files should live, rather than
>> just dropped directly into /sys/kernel.
> Michael, could that be corrected now by introducing new sysfs files for FADump in
> /sys/kernel/fadump/.
> 
> Also, duplicating current /sys/kernel/fadump_* files as /sys/kernel/fadump/* files
> & eventually dropping /sys/kernel/fadump_* files sometime later..


Sent a patch series that adds fadump_mem_reserved sysfs file along with reorganizing
the existing fadump sysfs files.

Patch series available here:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-September/197100.html

- Sourabh Jain
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump
new file mode 100644
index 000000000000..ec034939475b
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-fadump
@@ -0,0 +1,6 @@ 
+What:		/sys/kernel/fadump_mem_reserved
+Date:		August 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.
diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst
index 9ca12830a48e..a5dfb20d4dc3 100644
--- a/Documentation/powerpc/firmware-assisted-dump.rst
+++ b/Documentation/powerpc/firmware-assisted-dump.rst
@@ -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
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 4eab97292cc2..cd373d1d4b82 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -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;
 }