Skip to content

Commit bc446c5

Browse files
sourabhjainsmpe
authored andcommitted
powerpc/fadump: add hotplug_ready sysfs interface
The elfcorehdr describes the CPUs and memory of the crashed kernel to the kernel that captures the dump, known as the second or fadump kernel. The elfcorehdr needs to be updated if the system's memory changes due to memory hotplug or online/offline events. Currently, memory hotplug events are monitored in userspace by udev rules, and fadump is re-registered, which recreates the elfcorehdr with the latest available memory in the system. However, the previous patch ("powerpc: make fadump resilient with memory add/remove events") moved the creation of elfcorehdr to the second or fadump kernel. This eliminates the need to regenerate the elfcorehdr during memory hotplug or online/offline events. Create a sysfs entry at /sys/kernel/fadump/hotplug_ready to let userspace know that fadump re-registration is not required for memory add/remove events. Signed-off-by: Sourabh Jain <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent c6c5b14 commit bc446c5

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Documentation/ABI/testing/sysfs-kernel-fadump

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,14 @@ Contact: [email protected]
3838
Description: read only
3939
Provide information about the amount of memory reserved by
4040
FADump to save the crash dump in bytes.
41+
42+
What: /sys/kernel/fadump/hotplug_ready
43+
Date: Apr 2024
44+
45+
Description: read only
46+
Kdump udev rule re-registers fadump on memory add/remove events,
47+
primarily to update the elfcorehdr. This sysfs indicates the
48+
kdump udev rule that fadump re-registration is not required on
49+
memory add/remove events because elfcorehdr is now prepared in
50+
the second/fadump kernel.
51+
User: kexec-tools

arch/powerpc/kernel/fadump.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,18 @@ static ssize_t enabled_show(struct kobject *kobj,
14261426
return sprintf(buf, "%d\n", fw_dump.fadump_enabled);
14271427
}
14281428

1429+
/*
1430+
* /sys/kernel/fadump/hotplug_ready sysfs node returns 1, which inidcates
1431+
* to usersapce that fadump re-registration is not required on memory
1432+
* hotplug events.
1433+
*/
1434+
static ssize_t hotplug_ready_show(struct kobject *kobj,
1435+
struct kobj_attribute *attr,
1436+
char *buf)
1437+
{
1438+
return sprintf(buf, "%d\n", 1);
1439+
}
1440+
14291441
static ssize_t mem_reserved_show(struct kobject *kobj,
14301442
struct kobj_attribute *attr,
14311443
char *buf)
@@ -1498,11 +1510,13 @@ static struct kobj_attribute release_attr = __ATTR_WO(release_mem);
14981510
static struct kobj_attribute enable_attr = __ATTR_RO(enabled);
14991511
static struct kobj_attribute register_attr = __ATTR_RW(registered);
15001512
static struct kobj_attribute mem_reserved_attr = __ATTR_RO(mem_reserved);
1513+
static struct kobj_attribute hotplug_ready_attr = __ATTR_RO(hotplug_ready);
15011514

15021515
static struct attribute *fadump_attrs[] = {
15031516
&enable_attr.attr,
15041517
&register_attr.attr,
15051518
&mem_reserved_attr.attr,
1519+
&hotplug_ready_attr.attr,
15061520
NULL,
15071521
};
15081522

0 commit comments

Comments
 (0)