From e0b9a42735f2672ca2764cfbea6e55a81098d5ba Mon Sep 17 00:00:00 2001 From: zhenwei pi Date: Thu, 2 Jan 2020 10:35:12 +0800 Subject: misc: pvpanic: move bit definition to uapi header file Some processes outside of the kernel(Ex, QEMU) should know what the value really is for, so move the bit definition to a uapi file. Suggested-by: Greg KH Signed-off-by: zhenwei pi Link: https://lore.kernel.org/r/20200102023513.318836-2-pizhenwei@bytedance.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/pvpanic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/misc/pvpanic.c') diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index 95ff7c5a1dfb..3f0de3be0a19 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c @@ -15,11 +15,10 @@ #include #include #include +#include static void __iomem *base; -#define PVPANIC_PANICKED (1 << 0) - MODULE_AUTHOR("Hu Tao "); MODULE_DESCRIPTION("pvpanic device driver"); MODULE_LICENSE("GPL"); -- cgit From 191941692a3d1b6a9614502b279be062926b70f5 Mon Sep 17 00:00:00 2001 From: zhenwei pi Date: Thu, 2 Jan 2020 10:35:13 +0800 Subject: misc: pvpanic: add crash loaded event 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 --- drivers/misc/pvpanic.c | 9 ++++++++- include/uapi/misc/pvpanic.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/misc/pvpanic.c') diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index 3f0de3be0a19..a6e1a8983e1f 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -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; } diff --git a/include/uapi/misc/pvpanic.h b/include/uapi/misc/pvpanic.h index cae69a822b25..54b7485390d3 100644 --- a/include/uapi/misc/pvpanic.h +++ b/include/uapi/misc/pvpanic.h @@ -4,5 +4,6 @@ #define __PVPANIC_H__ #define PVPANIC_PANICKED (1 << 0) +#define PVPANIC_CRASH_LOADED (1 << 1) #endif /* __PVPANIC_H__ */ -- cgit