Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash: export crashkernel CMA reservation to userspace

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

The reason for not including Crash CMA Ranges in /proc/iomem is to avoid
conflicts. It has been observed that contiguous memory ranges are
sometimes shown as two separate System RAM entries in /proc/iomem. If a
CMA range overlaps two System RAM ranges, adding crashk_res to /proc/iomem
can create a conflict. Reference [1] describes one such instance on the
PowerPC architecture.

Link: https://lkml.kernel.org/r/20251118071023.1673329-1-sourabhjain@linux.ibm.com
Link: https://lore.kernel.org/all/20251016142831.144515-1-sourabhjain@linux.ibm.com/ [1]
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
Cc: Pingfan Liu <piliu@redhat.com>
Cc: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: Shivang Upadhyay <shivangu@linux.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sourabh Jain and committed by
Andrew Morton
aa014556 fdd76c8d

+31
+10
Documentation/ABI/testing/sysfs-kernel-kexec-kdump
··· 41 41 is used by the user space utility kexec to support updating the 42 42 in-kernel kdump image during hotplug operations. 43 43 User: Kexec tools 44 + 45 + What: /sys/kernel/kexec_crash_cma_ranges 46 + Date: Nov 2025 47 + Contact: kexec@lists.infradead.org 48 + Description: read only 49 + Provides information about the memory ranges reserved from 50 + the Contiguous Memory Allocator (CMA) area that are allocated 51 + to the crash (kdump) kernel. It lists the start and end physical 52 + addresses of CMA regions assigned for crashkernel use. 53 + User: kdump service
+21
kernel/ksysfs.c
··· 135 135 } 136 136 KERNEL_ATTR_RO(kexec_crash_loaded); 137 137 138 + #ifdef CONFIG_CRASH_RESERVE 139 + static ssize_t kexec_crash_cma_ranges_show(struct kobject *kobj, 140 + struct kobj_attribute *attr, char *buf) 141 + { 142 + 143 + ssize_t len = 0; 144 + int i; 145 + 146 + for (i = 0; i < crashk_cma_cnt; ++i) { 147 + len += sysfs_emit_at(buf, len, "%08llx-%08llx\n", 148 + crashk_cma_ranges[i].start, 149 + crashk_cma_ranges[i].end); 150 + } 151 + return len; 152 + } 153 + KERNEL_ATTR_RO(kexec_crash_cma_ranges); 154 + #endif /* CONFIG_CRASH_RESERVE */ 155 + 138 156 static ssize_t kexec_crash_size_show(struct kobject *kobj, 139 157 struct kobj_attribute *attr, char *buf) 140 158 { ··· 278 260 #ifdef CONFIG_CRASH_DUMP 279 261 &kexec_crash_loaded_attr.attr, 280 262 &kexec_crash_size_attr.attr, 263 + #ifdef CONFIG_CRASH_RESERVE 264 + &kexec_crash_cma_ranges_attr.attr, 265 + #endif 281 266 #endif 282 267 #endif 283 268 #ifdef CONFIG_VMCORE_INFO