All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] misc: pvpanic: add crash loaded event
@ 2020-01-02  2:35 zhenwei pi
  2020-01-02  2:35 ` [PATCH v2 1/2] misc: pvpanic: move bit definition to uapi header file zhenwei pi
  2020-01-02  2:35 ` [PATCH v2 2/2] misc: pvpanic: add crash loaded event zhenwei pi
  0 siblings, 2 replies; 5+ messages in thread
From: zhenwei pi @ 2020-01-02  2:35 UTC (permalink / raw)
  To: gregkh, arnd; +Cc: linux-kernel, pizhenwei

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.

Suggested by Greg KH, move the bit definition to uapi header file
for the programs outside of kernel.

zhenwei pi (2):
  misc: pvpanic: move bit definition to uapi header file
  misc: pvpanic: add crash loaded event

 drivers/misc/pvpanic.c      | 12 +++++++++---
 include/uapi/misc/pvpanic.h |  9 +++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 include/uapi/misc/pvpanic.h

-- 
2.11.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] misc: pvpanic: move bit definition to uapi header file
  2020-01-02  2:35 [PATCH v2 0/2] misc: pvpanic: add crash loaded event zhenwei pi
@ 2020-01-02  2:35 ` zhenwei pi
  2020-01-02  2:35 ` [PATCH v2 2/2] misc: pvpanic: add crash loaded event zhenwei pi
  1 sibling, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2020-01-02  2:35 UTC (permalink / raw)
  To: gregkh, arnd; +Cc: linux-kernel, pizhenwei

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 <gregkh@linuxfoundation.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
 drivers/misc/pvpanic.c      | 3 +--
 include/uapi/misc/pvpanic.h | 8 ++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 include/uapi/misc/pvpanic.h

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 <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
+#include <uapi/misc/pvpanic.h>
 
 static void __iomem *base;
 
-#define PVPANIC_PANICKED        (1 << 0)
-
 MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
 MODULE_DESCRIPTION("pvpanic device driver");
 MODULE_LICENSE("GPL");
diff --git a/include/uapi/misc/pvpanic.h b/include/uapi/misc/pvpanic.h
new file mode 100644
index 000000000000..cae69a822b25
--- /dev/null
+++ b/include/uapi/misc/pvpanic.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+
+#ifndef __PVPANIC_H__
+#define __PVPANIC_H__
+
+#define PVPANIC_PANICKED	(1 << 0)
+
+#endif /* __PVPANIC_H__ */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] misc: pvpanic: add crash loaded event
  2020-01-02  2:35 [PATCH v2 0/2] misc: pvpanic: add crash loaded event zhenwei pi
  2020-01-02  2:35 ` [PATCH v2 1/2] misc: pvpanic: move bit definition to uapi header file zhenwei pi
@ 2020-01-02  2:35 ` zhenwei pi
  1 sibling, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2020-01-02  2:35 UTC (permalink / raw)
  To: gregkh, arnd; +Cc: linux-kernel, pizhenwei

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>
---
 drivers/misc/pvpanic.c      | 9 ++++++++-
 include/uapi/misc/pvpanic.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

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 <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;
 }
 
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__ */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] misc: pvpanic: add crash loaded event
  2019-12-25  6:26 [PATCH v2 0/2] " zhenwei pi
@ 2019-12-25  6:26 ` zhenwei pi
  0 siblings, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2019-12-25  6:26 UTC (permalink / raw)
  To: arnd, gregkh; +Cc: linux-kernel, pizhenwei

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>
---
 drivers/misc/pvpanic.c      | 9 ++++++++-
 include/uapi/misc/pvpanic.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

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 <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;
 }
 
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__ */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] misc: pvpanic: add crash loaded event
  2019-12-15  3:48 [PATCH v2 0/2] " zhenwei pi
@ 2019-12-15  3:48 ` zhenwei pi
  0 siblings, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2019-12-15  3:48 UTC (permalink / raw)
  To: arnd, gregkh, peng.hao2; +Cc: hutao, linux-kernel, pizhenwei

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>
---
 drivers/misc/pvpanic.c      | 9 ++++++++-
 include/uapi/misc/pvpanic.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

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 <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;
 }
 
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__ */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-02  2:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02  2:35 [PATCH v2 0/2] misc: pvpanic: add crash loaded event zhenwei pi
2020-01-02  2:35 ` [PATCH v2 1/2] misc: pvpanic: move bit definition to uapi header file zhenwei pi
2020-01-02  2:35 ` [PATCH v2 2/2] misc: pvpanic: add crash loaded event zhenwei pi
  -- strict thread matches above, loose matches on Subject: below --
2019-12-25  6:26 [PATCH v2 0/2] " zhenwei pi
2019-12-25  6:26 ` [PATCH v2 2/2] " zhenwei pi
2019-12-15  3:48 [PATCH v2 0/2] " zhenwei pi
2019-12-15  3:48 ` [PATCH v2 2/2] " zhenwei pi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.