diff mbox series

powerpc/fadump: register for fadump as early as possible

Message ID 162246621134.46902.9619354353561918017.stgit@hbathini-workstation.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series powerpc/fadump: register for fadump as early as possible | expand
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (112f47a1484ddca610b70cbe4a99f0d0f1701daf)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Hari Bathini May 31, 2021, 1:03 p.m. UTC
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@linux.ibm.com>
---
 arch/powerpc/kernel/fadump.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

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)
 			fadump_invalidate_release_mem();
 	}
 	/* 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) {
 		fw_dump.ops->fadump_init_mem_struct(&fw_dump);
+		register_fadump();
+	}
 
 	return 1;
 }
-subsys_initcall(setup_fadump);
+subsys_initcall_sync(setup_fadump);
 #else /* !CONFIG_PRESERVE_FA_DUMP */
 
 /* Scan the Firmware Assisted dump configuration details. */