[PATCH] powerpc/fadump: register for fadump as early as possible

Hari Bathini hbathini at linux.ibm.com
Mon May 31 23:03:31 AEST 2021

Crash recovery (fadump) is setup in the userspace by some service.
This service rebuilds initrd with dump capture capability, if it is
not already dump capture capable and then initiates registration for
firmware assisted dump (echo 1 > /sys/kernel/fadump/registered). But
registration for fadump can be done as early as initial kernel boot
process itself, providing crash recovery support for scenarios where
kernel crashes before the userspace service could start up. So, try
registering for fadump while setting it up in the kernel itself. Also,
have setup_fadump() called by subsys_init_sync() to make sure
crash_save_vmcoreinfo_init() is done before registering for fadump.

Commit 0823c68b054b ("powerpc/fadump: re-register firmware-assisted
dump if already registered") would ensure this change does not lead to
error while the userspace service tries to re-register fadump.

Also, this change, in rare scenario, can lead to a case where the
initrd is not dump capture capable, to offload the vmcore after a
crash. But that does not make the case any worse than it already is.

Signed-off-by: Hari Bathini <hbathini at linux.ibm.com>
 arch/powerpc/kernel/fadump.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index b990075285f5..0f5ecff6210d 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1638,12 +1638,14 @@ int __init setup_fadump(void)
 	/* Initialize the kernel dump memory structure for FAD registration. */
-	else if (fw_dump.reserve_dump_area_size)
+	else if (fw_dump.reserve_dump_area_size) {
+		register_fadump();
+	}
 	return 1;
 /* Scan the Firmware Assisted dump configuration details. */

More information about the Linuxppc-dev mailing list