Skip to content

Commit 73f26e5

Browse files
Tianyu Lanliuw
authored andcommitted
x86/Hyper-V: Trigger crash enlightenment only once during system crash.
When a guest VM panics, Hyper-V should be notified only once via the crash synthetic MSRs. Current Linux code might write these crash MSRs twice during a system panic: 1) hyperv_panic/die_event() calling hyperv_report_panic() 2) hv_kmsg_dump() calling hyperv_report_panic_msg() Fix this by not calling hyperv_report_panic() if a kmsg dump has been successfully registered. The notification will happen later via hyperv_report_panic_msg(). Fixes: 7ed4325 ("Drivers: hv: vmbus: Make panic reporting to be more useful") 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 7f11a2c commit 73f26e5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/hv/vmbus_drv.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
5555

5656
vmbus_initiate_unload(true);
5757

58-
if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
58+
/*
59+
* Hyper-V should be notified only once about a panic. If we will be
60+
* doing hyperv_report_panic_msg() later with kmsg data, don't do
61+
* the notification here.
62+
*/
63+
if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE
64+
&& !hv_panic_page) {
5965
regs = current_pt_regs();
6066
hyperv_report_panic(regs, val);
6167
}
@@ -68,7 +74,13 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
6874
struct die_args *die = (struct die_args *)args;
6975
struct pt_regs *regs = die->regs;
7076

71-
hyperv_report_panic(regs, val);
77+
/*
78+
* Hyper-V should be notified only once about a panic. If we will be
79+
* doing hyperv_report_panic_msg() later with kmsg data, don't do
80+
* the notification here.
81+
*/
82+
if (!hv_panic_page)
83+
hyperv_report_panic(regs, val);
7284
return NOTIFY_DONE;
7385
}
7486

0 commit comments

Comments
 (0)