[RFC PATCH 2/4] panic: run the pre kdump list before crash kexec

Bradley Morgan <[email protected]>
Newsgroups org.infradead.lists.kexec,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Call the new list unconditionally in vpanic, right before the
early crash kexec. The legacy list, crash_kexec_post_notifiers
and the cpu shutdown sequence are untouched. Also note in the
kernel parameters entry that the option has no effect on the
pre kdump list.

Signed-off-by: Bradley Morgan <[email protected]>
---
 Documentation/admin-guide/kernel-parameters.txt | 3 +++
 kernel/panic.c                                  | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b5493a7f8f22..a77ecf3bd564 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1042,6 +1042,9 @@ Kernel parameters
 			or extra data dumped by panic_print. Note that some
 			configurations enable this option unconditionally,
 			like Hyper-V, PowerPC (fadump) and AMD SEV-SNP.
+			This option does not affect the pre kdump notifier
+			list (see include/linux/panic_notifier.h), which
+			always runs before the jump to the kdump kernel.
 
 	crashkernel=size[KMG][@offset[KMG]]
 			[KNL,EARLY] Using kexec, Linux can switch to a 'crash kernel'
diff --git a/kernel/panic.c b/kernel/panic.c
index 94ce7a94f118..f9ad0250da67 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -664,6 +664,13 @@ void vpanic(const char *fmt, va_list args)
 	 */
 	kgdb_panic(buf);
 
+	/*
+	 * Tell the hypervisor or firmware about the panic. This runs on
+	 * every panic, before a potential crash kexec, so the upcall is
+	 * not lost when a crash kernel is loaded.
+	 */
+	panic_pre_kdump_notify(buf);
+
 	/*
 	 * If we have crashed and we have a crash kernel loaded let it handle
 	 * everything else.
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.