Skip to content

Commit 040026d

Browse files
Tianyu Lanliuw
authored andcommitted
x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set
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(). Fixes: 81b18bc ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic") Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Tianyu Lan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent a115895 commit 040026d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

drivers/hv/vmbus_drv.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ static int hyperv_cpuhp_online;
4848

4949
static void *hv_panic_page;
5050

51+
/*
52+
* Boolean to control whether to report panic messages over Hyper-V.
53+
*
54+
* It can be set via /proc/sys/kernel/hyperv/record_panic_msg
55+
*/
56+
static int sysctl_record_panic_msg = 1;
57+
58+
static int hyperv_report_reg(void)
59+
{
60+
return !sysctl_record_panic_msg || !hv_panic_page;
61+
}
62+
5163
static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
5264
void *args)
5365
{
@@ -61,7 +73,7 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
6173
* the notification here.
6274
*/
6375
if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE
64-
&& !hv_panic_page) {
76+
&& hyperv_report_reg()) {
6577
regs = current_pt_regs();
6678
hyperv_report_panic(regs, val);
6779
}
@@ -79,7 +91,7 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
7991
* doing hyperv_report_panic_msg() later with kmsg data, don't do
8092
* the notification here.
8193
*/
82-
if (!hv_panic_page)
94+
if (hyperv_report_reg())
8395
hyperv_report_panic(regs, val);
8496
return NOTIFY_DONE;
8597
}
@@ -1267,13 +1279,6 @@ static void vmbus_isr(void)
12671279
add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0);
12681280
}
12691281

1270-
/*
1271-
* Boolean to control whether to report panic messages over Hyper-V.
1272-
*
1273-
* It can be set via /proc/sys/kernel/hyperv/record_panic_msg
1274-
*/
1275-
static int sysctl_record_panic_msg = 1;
1276-
12771282
/*
12781283
* Callback from kmsg_dump. Grab as much as possible from the end of the kmsg
12791284
* buffer and call into Hyper-V to transfer the data.

0 commit comments

Comments
 (0)