* [PATCH 0/2] Export kdump crashkernel CMA ranges
@ 2025-11-03 3:58 Sourabh Jain
2025-11-03 3:58 ` [PATCH 1/2] Documentation/ABI: add kexec and kdump sysfs interface Sourabh Jain
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Sourabh Jain @ 2025-11-03 3:58 UTC (permalink / raw)
To: linux-kernel
Cc: Sourabh Jain, Andrew Morton, Baoquan he, Jiri Bohac,
Shivang Upadhyay, linuxppc-dev, kexec
/sys/kernel/kexec_crash_cma_ranges to export all CMA regions reserved
for the crashkernel to user-space. This enables user-space tools
configuring kdump to determine the amount of memory reserved for the
crashkernel. When CMA is used for crashkernel allocation, tools can use
this information to warn users that attempting to capture user pages
while CMA reservation is active may lead to unreliable or incomplete
dump capture.
While adding documentation for the new sysfs interface, I realized that
there was no ABI document for the existing kexec and kdump sysfs
interfaces, so I added one.
The first patch adds the ABI documentation for the existing kexec and
kdump sysfs interfaces, and the second patch adds the
/sys/kernel/kexec_crash_cma_ranges sysfs interface along with its
corresponding ABI documentation.
*Seeking opinions*
There are already four kexec/kdump sysfs entries under /sys/kernel/,
and this patch series adds one more. Should we consider moving them to
a separate directory, such as /sys/kernel/kexec, to avoid polluting
/sys/kernel/? For backward compatibility, we can create symlinks at
the old locations for sometime and remove them in the future.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan he <bhe@redhat.com>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: kexec@lists.infradead.org
Sourabh Jain (2):
Documentation/ABI: add kexec and kdump sysfs interface
crash: export crashkernel CMA reservation to userspace
.../ABI/testing/sysfs-kernel-kexec-kdump | 53 +++++++++++++++++++
kernel/ksysfs.c | 17 ++++++
2 files changed, 70 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-kexec-kdump
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Documentation/ABI: add kexec and kdump sysfs interface
2025-11-03 3:58 [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
@ 2025-11-03 3:58 ` Sourabh Jain
2025-11-03 3:58 ` [PATCH 2/2] crash: export crashkernel CMA reservation to userspace Sourabh Jain
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Sourabh Jain @ 2025-11-03 3:58 UTC (permalink / raw)
To: linux-kernel
Cc: Sourabh Jain, Andrew Morton, Baoquan he, Jiri Bohac,
Shivang Upadhyay, linuxppc-dev, kexec
Add an ABI document for following kexec and kdump sysfs interface:
- /sys/kernel/kexec_loaded
- /sys/kernel/kexec_crash_loaded
- /sys/kernel/kexec_crash_size
- /sys/kernel/crash_elfcorehdr_size
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan he <bhe@redhat.com>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: kexec@lists.infradead.org
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
.../ABI/testing/sysfs-kernel-kexec-kdump | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-kexec-kdump
diff --git a/Documentation/ABI/testing/sysfs-kernel-kexec-kdump b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump
new file mode 100644
index 000000000000..96b24565b68e
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump
@@ -0,0 +1,43 @@
+What: /sys/kernel/kexec_loaded
+Date: Jun 2006
+Contact: kexec@lists.infradead.org
+Description: read only
+ Indicates whether a new kernel image has been loaded
+ into memory using the kexec system call. It shows 1 if
+ a kexec image is present and ready to boot, or 0 if none
+ is loaded.
+User: kexec tools, kdump service
+
+What: /sys/kernel/kexec_crash_loaded
+Date: Jun 2006
+Contact: kexec@lists.infradead.org
+Description: read only
+ Indicates whether a crash (kdump) kernel is currently
+ loaded into memory. It shows 1 if a crash kernel has been
+ successfully loaded for panic handling, or 0 if no crash
+ kernel is present.
+User: Kexec tools, Kdump service
+
+What: /sys/kernel/kexec_crash_size
+Date: Dec 2009
+Contact: kexec@lists.infradead.org
+Description: read/write
+ Shows the amount of memory reserved for loading the crash
+ (kdump) kernel. It reports the size, in bytes, of the
+ crash kernel area defined by the crashkernel= parameter.
+ This interface also allows reducing the crashkernel
+ reservation by writing a smaller value, and the reclaimed
+ space is added back to the system RAM.
+User: Kdump service
+
+What: /sys/kernel/crash_elfcorehdr_size
+Date: Aug 2023
+Contact: kexec@lists.infradead.org
+Description: read only
+ Indicates the preferred size of the memory buffer for the
+ ELF core header used by the crash (kdump) kernel. It defines
+ how much space is needed to hold metadata about the crashed
+ system, including CPU and memory information. This information
+ is used by the user space utility kexec to support updating the
+ in-kernel kdump image during hotplug operations.
+User: Kexec tools
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] crash: export crashkernel CMA reservation to userspace
2025-11-03 3:58 [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
2025-11-03 3:58 ` [PATCH 1/2] Documentation/ABI: add kexec and kdump sysfs interface Sourabh Jain
@ 2025-11-03 3:58 ` Sourabh Jain
2025-11-04 6:26 ` [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
2025-11-05 3:15 ` Baoquan he
3 siblings, 0 replies; 6+ messages in thread
From: Sourabh Jain @ 2025-11-03 3:58 UTC (permalink / raw)
To: linux-kernel
Cc: Sourabh Jain, Andrew Morton, Baoquan he, Jiri Bohac,
Shivang Upadhyay, linuxppc-dev, kexec
Add a sysfs entry /sys/kernel/kexec_crash_cma_ranges to expose all
CMA crashkernel ranges.
This allows userspace tools configuring kdump to determine how much
memory is reserved for crashkernel. If CMA is used, tools can warn
users when attempting to capture user pages with CMA reservation.
The new sysfs hold the CMA ranges in below format:
cat /sys/kernel/kexec_crash_cma_ranges
100000000-10c7fffff
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Baoquan he <bhe@redhat.com>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: kexec@lists.infradead.org
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
.../ABI/testing/sysfs-kernel-kexec-kdump | 10 ++++++++++
kernel/ksysfs.c | 17 +++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-kernel-kexec-kdump b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump
index 96b24565b68e..f6089e38de5f 100644
--- a/Documentation/ABI/testing/sysfs-kernel-kexec-kdump
+++ b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump
@@ -41,3 +41,13 @@ Description: read only
is used by the user space utility kexec to support updating the
in-kernel kdump image during hotplug operations.
User: Kexec tools
+
+What: /sys/kernel/kexec_crash_cma_ranges
+Date: Nov 2025
+Contact: kexec@lists.infradead.org
+Description: read only
+ Provides information about the memory ranges reserved from
+ the Contiguous Memory Allocator (CMA) area that are allocated
+ to the crash (kdump) kernel. It lists the start and end physical
+ addresses of CMA regions assigned for crashkernel use.
+User: kdump service
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index eefb67d9883c..3855937aa923 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -135,6 +135,22 @@ static ssize_t kexec_crash_loaded_show(struct kobject *kobj,
}
KERNEL_ATTR_RO(kexec_crash_loaded);
+static ssize_t kexec_crash_cma_ranges_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+
+ ssize_t len = 0;
+ int i;
+
+ for (i = 0; i < crashk_cma_cnt; ++i) {
+ len += sysfs_emit_at(buf, len, "%08llx-%08llx\n",
+ crashk_cma_ranges[i].start,
+ crashk_cma_ranges[i].end);
+ }
+ return len;
+}
+KERNEL_ATTR_RO(kexec_crash_cma_ranges);
+
static ssize_t kexec_crash_size_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
@@ -260,6 +276,7 @@ static struct attribute * kernel_attrs[] = {
#ifdef CONFIG_CRASH_DUMP
&kexec_crash_loaded_attr.attr,
&kexec_crash_size_attr.attr,
+ &kexec_crash_cma_ranges_attr.attr,
#endif
#endif
#ifdef CONFIG_VMCORE_INFO
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Export kdump crashkernel CMA ranges
2025-11-03 3:58 [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
2025-11-03 3:58 ` [PATCH 1/2] Documentation/ABI: add kexec and kdump sysfs interface Sourabh Jain
2025-11-03 3:58 ` [PATCH 2/2] crash: export crashkernel CMA reservation to userspace Sourabh Jain
@ 2025-11-04 6:26 ` Sourabh Jain
2025-11-05 3:15 ` Baoquan he
3 siblings, 0 replies; 6+ messages in thread
From: Sourabh Jain @ 2025-11-04 6:26 UTC (permalink / raw)
To: linux-kernel
Cc: Andrew Morton, Baoquan he, Jiri Bohac, Shivang Upadhyay,
linuxppc-dev, kexec, Vivek Goyal, Dave Young, Pingfan Liu,
Ritesh Harjani (IBM), Madhavan Srinivasan, Aditya Gupta,
Mahesh J Salgaonkar, Hari Bathini
Cc others who can provide input.
On 03/11/25 09:28, Sourabh Jain wrote:
> /sys/kernel/kexec_crash_cma_ranges to export all CMA regions reserved
> for the crashkernel to user-space. This enables user-space tools
> configuring kdump to determine the amount of memory reserved for the
> crashkernel. When CMA is used for crashkernel allocation, tools can use
> this information to warn users that attempting to capture user pages
> while CMA reservation is active may lead to unreliable or incomplete
> dump capture.
>
> While adding documentation for the new sysfs interface, I realized that
> there was no ABI document for the existing kexec and kdump sysfs
> interfaces, so I added one.
>
> The first patch adds the ABI documentation for the existing kexec and
> kdump sysfs interfaces, and the second patch adds the
> /sys/kernel/kexec_crash_cma_ranges sysfs interface along with its
> corresponding ABI documentation.
>
> *Seeking opinions*
> There are already four kexec/kdump sysfs entries under /sys/kernel/,
> and this patch series adds one more. Should we consider moving them to
> a separate directory, such as /sys/kernel/kexec, to avoid polluting
> /sys/kernel/? For backward compatibility, we can create symlinks at
> the old locations for sometime and remove them in the future.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan he <bhe@redhat.com>
> Cc: Jiri Bohac <jbohac@suse.cz>
> Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: kexec@lists.infradead.org
>
> Sourabh Jain (2):
> Documentation/ABI: add kexec and kdump sysfs interface
> crash: export crashkernel CMA reservation to userspace
>
> .../ABI/testing/sysfs-kernel-kexec-kdump | 53 +++++++++++++++++++
> kernel/ksysfs.c | 17 ++++++
> 2 files changed, 70 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-kernel-kexec-kdump
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Export kdump crashkernel CMA ranges
2025-11-03 3:58 [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
` (2 preceding siblings ...)
2025-11-04 6:26 ` [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
@ 2025-11-05 3:15 ` Baoquan he
2025-11-05 3:33 ` Sourabh Jain
3 siblings, 1 reply; 6+ messages in thread
From: Baoquan he @ 2025-11-05 3:15 UTC (permalink / raw)
To: Sourabh Jain
Cc: linux-kernel, Andrew Morton, Jiri Bohac, Shivang Upadhyay,
linuxppc-dev, kexec
On 11/03/25 at 09:28am, Sourabh Jain wrote:
> /sys/kernel/kexec_crash_cma_ranges to export all CMA regions reserved
> for the crashkernel to user-space. This enables user-space tools
> configuring kdump to determine the amount of memory reserved for the
> crashkernel. When CMA is used for crashkernel allocation, tools can use
> this information to warn users that attempting to capture user pages
> while CMA reservation is active may lead to unreliable or incomplete
> dump capture.
>
> While adding documentation for the new sysfs interface, I realized that
> there was no ABI document for the existing kexec and kdump sysfs
> interfaces, so I added one.
>
> The first patch adds the ABI documentation for the existing kexec and
> kdump sysfs interfaces, and the second patch adds the
> /sys/kernel/kexec_crash_cma_ranges sysfs interface along with its
> corresponding ABI documentation.
>
> *Seeking opinions*
> There are already four kexec/kdump sysfs entries under /sys/kernel/,
> and this patch series adds one more. Should we consider moving them to
> a separate directory, such as /sys/kernel/kexec, to avoid polluting
> /sys/kernel/? For backward compatibility, we can create symlinks at
> the old locations for sometime and remove them in the future.
That sounds a good idea, will you do it in v2? Because otherwise the
kexec_crash_cma_ranges need be moved too.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Baoquan he <bhe@redhat.com>
> Cc: Jiri Bohac <jbohac@suse.cz>
> Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: kexec@lists.infradead.org
>
> Sourabh Jain (2):
> Documentation/ABI: add kexec and kdump sysfs interface
> crash: export crashkernel CMA reservation to userspace
>
> .../ABI/testing/sysfs-kernel-kexec-kdump | 53 +++++++++++++++++++
> kernel/ksysfs.c | 17 ++++++
> 2 files changed, 70 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-kernel-kexec-kdump
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Export kdump crashkernel CMA ranges
2025-11-05 3:15 ` Baoquan he
@ 2025-11-05 3:33 ` Sourabh Jain
0 siblings, 0 replies; 6+ messages in thread
From: Sourabh Jain @ 2025-11-05 3:33 UTC (permalink / raw)
To: Baoquan he
Cc: linux-kernel, Andrew Morton, Jiri Bohac, Shivang Upadhyay,
linuxppc-dev, kexec
On 05/11/25 08:45, Baoquan he wrote:
> On 11/03/25 at 09:28am, Sourabh Jain wrote:
>> /sys/kernel/kexec_crash_cma_ranges to export all CMA regions reserved
>> for the crashkernel to user-space. This enables user-space tools
>> configuring kdump to determine the amount of memory reserved for the
>> crashkernel. When CMA is used for crashkernel allocation, tools can use
>> this information to warn users that attempting to capture user pages
>> while CMA reservation is active may lead to unreliable or incomplete
>> dump capture.
>>
>> While adding documentation for the new sysfs interface, I realized that
>> there was no ABI document for the existing kexec and kdump sysfs
>> interfaces, so I added one.
>>
>> The first patch adds the ABI documentation for the existing kexec and
>> kdump sysfs interfaces, and the second patch adds the
>> /sys/kernel/kexec_crash_cma_ranges sysfs interface along with its
>> corresponding ABI documentation.
>>
>> *Seeking opinions*
>> There are already four kexec/kdump sysfs entries under /sys/kernel/,
>> and this patch series adds one more. Should we consider moving them to
>> a separate directory, such as /sys/kernel/kexec, to avoid polluting
>> /sys/kernel/? For backward compatibility, we can create symlinks at
>> the old locations for sometime and remove them in the future.
> That sounds a good idea, will you do it in v2? Because otherwise the
> kexec_crash_cma_ranges need be moved too.
Yes I will include it in v2.
Thanks,
Sourabh Jain
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-05 3:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 3:58 [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
2025-11-03 3:58 ` [PATCH 1/2] Documentation/ABI: add kexec and kdump sysfs interface Sourabh Jain
2025-11-03 3:58 ` [PATCH 2/2] crash: export crashkernel CMA reservation to userspace Sourabh Jain
2025-11-04 6:26 ` [PATCH 0/2] Export kdump crashkernel CMA ranges Sourabh Jain
2025-11-05 3:15 ` Baoquan he
2025-11-05 3:33 ` Sourabh Jain
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).