From fbb2f06ef0139ab038f7e79cd0968f4adadc5271 Mon Sep 17 00:00:00 2001 From: Shile Zhang Date: Mon, 15 Jun 2020 17:30:51 +0800 Subject: [PATCH 1446/2944] pvpanic: add crash loaded event to #28727280 commit 191941692a3d1b6a9614502b279be062926b70f5 upstream. 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 Link: https://lore.kernel.org/r/20200102023513.318836-3-pizhenwei@bytedance.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Shile Zhang Reviewed-by: Joseph Qi --- drivers/platform/x86/pvpanic.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/pvpanic.c b/drivers/platform/x86/pvpanic.c index fd86dab..84ed44a 100644 --- a/drivers/platform/x86/pvpanic.c +++ b/drivers/platform/x86/pvpanic.c @@ -25,6 +25,7 @@ #include #include #include +#include MODULE_AUTHOR("Hu Tao "); MODULE_DESCRIPTION("pvpanic device driver"); @@ -40,6 +41,7 @@ MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids); #define PVPANIC_PANICKED (1 << 0) +#define PVPANIC_CRASH_LOADED (1 << 1) static u16 port; @@ -64,7 +66,13 @@ 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; } -- 1.8.3.1