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 <pizhenwei@bytedance.com>
Link: https://lore.kernel.org/r/20200102023513.318836-3-pizhenwei@bytedance.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
zhenwei pi 2020-01-02 10:35:13 +08:00 committed by Greg Kroah-Hartman
parent e0b9a42735
commit 191941692a
2 changed files with 9 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kexec.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
@ -33,7 +34,13 @@ static int
pvpanic_panic_notify(struct notifier_block *nb, unsigned long code, pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
void *unused) 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; return NOTIFY_DONE;
} }

View File

@ -4,5 +4,6 @@
#define __PVPANIC_H__ #define __PVPANIC_H__
#define PVPANIC_PANICKED (1 << 0) #define PVPANIC_PANICKED (1 << 0)
#define PVPANIC_CRASH_LOADED (1 << 1)
#endif /* __PVPANIC_H__ */ #endif /* __PVPANIC_H__ */