linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ltykernel@gmail.com
To: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, liuwe@microsoft.com,
	michael.h.kelley@microsoft.com
Cc: Tianyu Lan <Tianyu.Lan@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	vkuznets@redhat.com
Subject: [PATCH V3 5/6] x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set
Date: Tue, 24 Mar 2020 00:57:19 -0700	[thread overview]
Message-ID: <20200324075720.9462-6-Tianyu.Lan@microsoft.com> (raw)
In-Reply-To: <20200324075720.9462-1-Tianyu.Lan@microsoft.com>

From: Tianyu Lan <Tianyu.Lan@microsoft.com>

When sysctl_record_panic_msg is not set, the panic will
not be reported to Hyper-V via hyperv_report_panic_msg().
So the crash should be reported via hyperv_report_panic().

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
---
 drivers/hv/vmbus_drv.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 333dad39b1c1..172ceae69abb 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -48,6 +48,18 @@ static int hyperv_cpuhp_online;
 
 static void *hv_panic_page;
 
+/*
+ * Boolean to control whether to report panic messages over Hyper-V.
+ *
+ * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
+ */
+static int sysctl_record_panic_msg = 1;
+
+static int hyperv_report_reg(void)
+{
+	return !sysctl_record_panic_msg || !hv_panic_page;
+}
+
 static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
 			      void *args)
 {
@@ -61,7 +73,7 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
 	 * the notification here.
 	 */
 	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE
-	    && !hv_panic_page) {
+	    && hyperv_report_reg()) {
 		regs = current_pt_regs();
 		hyperv_report_panic(regs, val);
 	}
@@ -79,7 +91,7 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
 	 * doing hyperv_report_panic_msg() later with kmsg data, don't do
 	 * the notification here.
 	 */
-	if (!hv_panic_page)
+	if (hyperv_report_reg())
 		hyperv_report_panic(regs, val);
 	return NOTIFY_DONE;
 }
@@ -1267,13 +1279,6 @@ static void vmbus_isr(void)
 	add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0);
 }
 
-/*
- * Boolean to control whether to report panic messages over Hyper-V.
- *
- * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
- */
-static int sysctl_record_panic_msg = 1;
-
 /*
  * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg
  * buffer and call into Hyper-V to transfer the data.
-- 
2.14.5


  parent reply	other threads:[~2020-03-24  7:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  7:57 [PATCH V3 0/6] x86/Hyper-V: Panic code path fixes ltykernel
2020-03-24  7:57 ` [PATCH V3 1/6] x86/Hyper-V: Unload vmbus channel in hv panic callback ltykernel
2020-03-25 18:28   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 2/6] x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump ltykernel
2020-03-25 18:30   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 3/6] x86/Hyper-V: Trigger crash enlightenment only once during system crash ltykernel
2020-03-25 18:31   ` Michael Kelley
2020-03-24  7:57 ` [PATCH V3 4/6] x86/Hyper-V: Report crash register data or ksmg before running crash kernel ltykernel
2020-03-25 18:33   ` Michael Kelley
2020-03-24  7:57 ` ltykernel [this message]
2020-03-25 18:34   ` [PATCH V3 5/6] x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set Michael Kelley
2020-03-24  7:57 ` [PATCH V3 6/6] x86/Hyper-V: Report crash data in die() when panic_on_oops is set ltykernel
2020-03-25 18:36   ` Michael Kelley
2020-03-31  7:38   ` [PATCH V4 " ltykernel
2020-03-31 13:51     ` Michael Kelley
2020-03-31 14:26       ` Tianyu Lan
2020-04-01 18:53         ` Wei Liu
2020-04-02 12:51           ` Tianyu Lan
2020-03-30 10:13 ` [PATCH V3 0/6] x86/Hyper-V: Panic code path fixes Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200324075720.9462-6-Tianyu.Lan@microsoft.com \
    --to=ltykernel@gmail.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwe@microsoft.com \
    --cc=michael.h.kelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).