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.

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 <sourabhjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240422195932.1583833-3-sourabhjain@linux.ibm.com

authored by

Sourabh Jain and committed by
Michael Ellerman
bc446c5a c6c5b14d

+25
+11
Documentation/ABI/testing/sysfs-kernel-fadump
··· 38 38 Description: read only 39 39 Provide information about the amount of memory reserved by 40 40 FADump to save the crash dump in bytes. 41 + 42 + What: /sys/kernel/fadump/hotplug_ready 43 + Date: Apr 2024 44 + Contact: linuxppc-dev@lists.ozlabs.org 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
+14
arch/powerpc/kernel/fadump.c
··· 1426 1426 return sprintf(buf, "%d\n", fw_dump.fadump_enabled); 1427 1427 } 1428 1428 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 + 1429 1441 static ssize_t mem_reserved_show(struct kobject *kobj, 1430 1442 struct kobj_attribute *attr, 1431 1443 char *buf) ··· 1510 1498 static struct kobj_attribute enable_attr = __ATTR_RO(enabled); 1511 1499 static struct kobj_attribute register_attr = __ATTR_RW(registered); 1512 1500 static struct kobj_attribute mem_reserved_attr = __ATTR_RO(mem_reserved); 1501 + static struct kobj_attribute hotplug_ready_attr = __ATTR_RO(hotplug_ready); 1513 1502 1514 1503 static struct attribute *fadump_attrs[] = { 1515 1504 &enable_attr.attr, 1516 1505 &register_attr.attr, 1517 1506 &mem_reserved_attr.attr, 1507 + &hotplug_ready_attr.attr, 1518 1508 NULL, 1519 1509 }; 1520 1510