]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
misc: pvpanic: add crash loaded event
authorzhenwei pi <pizhenwei@bytedance.com>
Thu, 2 Jan 2020 02:35:13 +0000 (10:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jan 2020 14:07:37 +0000 (15:07 +0100)
Some users prefer kdump tools to generate guest kernel dumpfile,
at the same time, need a out-of-band kernel panic event.

Currently if booting guest kernel with 'crash_kexec_post_notifiers',
QEMU will receive PVPANIC_PANICKED event and stop VM. If booting
guest kernel without 'crash_kexec_post_notifiers', guest will not
call notifier chain.

Add PVPANIC_CRASH_LOADED bit for pvpanic event, it means that guest
kernel actually hit a kernel panic, but the guest kernel wants to
handle by itself.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Link: https://lore.kernel.org/r/20200102023513.318836-3-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/pvpanic.c
include/uapi/misc/pvpanic.h

index 3f0de3be0a1958686ada3bf097c66714e1d3a987..a6e1a8983e1fcc6201f50140672babe34a9613c7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/acpi.h>
 #include <linux/kernel.h>
+#include <linux/kexec.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -33,7 +34,13 @@ static int
 pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
                     void *unused)
 {
-       pvpanic_send_event(PVPANIC_PANICKED);
+       unsigned int event = PVPANIC_PANICKED;
+
+       if (kexec_crash_loaded())
+               event = PVPANIC_CRASH_LOADED;
+
+       pvpanic_send_event(event);
+
        return NOTIFY_DONE;
 }
 
index cae69a822b25d743fc7e0b10870bf8de9340f0f9..54b7485390d3149b7180242f5810a810a89c0a20 100644 (file)
@@ -4,5 +4,6 @@
 #define __PVPANIC_H__
 
 #define PVPANIC_PANICKED       (1 << 0)
+#define PVPANIC_CRASH_LOADED   (1 << 1)
 
 #endif /* __PVPANIC_H__ */