Skip to content

Commit 7ed4325

Browse files
kattisrinivasangregkh
authored andcommitted
Drivers: hv: vmbus: Make panic reporting to be more useful
Hyper-V allows the guest to report panic and the guest can pass additional information. All this is logged on the host. Currently Linux is passing back information that is not particularly useful. Make the following changes: 1. Windows uses crash MSR P0 to report bugcheck code. Follow the same convention for Linux as well. 2. It will be useful to know the gust ID of the Linux guest that has paniced. Pass back this information. These changes will help in better supporting Linux on Hyper-V Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6981fbf commit 7ed4325

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

arch/x86/hyperv/hv_init.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,10 @@ void hyperv_cleanup(void)
210210
}
211211
EXPORT_SYMBOL_GPL(hyperv_cleanup);
212212

213-
void hyperv_report_panic(struct pt_regs *regs)
213+
void hyperv_report_panic(struct pt_regs *regs, long err)
214214
{
215215
static bool panic_reported;
216+
u64 guest_id;
216217

217218
/*
218219
* We prefer to report panic on 'die' chain as we have proper
@@ -223,11 +224,13 @@ void hyperv_report_panic(struct pt_regs *regs)
223224
return;
224225
panic_reported = true;
225226

226-
wrmsrl(HV_X64_MSR_CRASH_P0, regs->ip);
227-
wrmsrl(HV_X64_MSR_CRASH_P1, regs->ax);
228-
wrmsrl(HV_X64_MSR_CRASH_P2, regs->bx);
229-
wrmsrl(HV_X64_MSR_CRASH_P3, regs->cx);
230-
wrmsrl(HV_X64_MSR_CRASH_P4, regs->dx);
227+
rdmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id);
228+
229+
wrmsrl(HV_X64_MSR_CRASH_P0, err);
230+
wrmsrl(HV_X64_MSR_CRASH_P1, guest_id);
231+
wrmsrl(HV_X64_MSR_CRASH_P2, regs->ip);
232+
wrmsrl(HV_X64_MSR_CRASH_P3, regs->ax);
233+
wrmsrl(HV_X64_MSR_CRASH_P4, regs->sp);
231234

232235
/*
233236
* Let Hyper-V know there is crash data available

arch/x86/include/asm/mshyperv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
310310
void hyperv_init(void);
311311
void hyperv_setup_mmu_ops(void);
312312
void hyper_alloc_mmu(void);
313-
void hyperv_report_panic(struct pt_regs *regs);
313+
void hyperv_report_panic(struct pt_regs *regs, long err);
314314
bool hv_is_hypercall_page_setup(void);
315315
void hyperv_cleanup(void);
316316
#else /* CONFIG_HYPERV */

drivers/hv/vmbus_drv.c

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

6666
regs = current_pt_regs();
6767

68-
hyperv_report_panic(regs);
68+
hyperv_report_panic(regs, val);
6969
return NOTIFY_DONE;
7070
}
7171

@@ -75,7 +75,7 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
7575
struct die_args *die = (struct die_args *)args;
7676
struct pt_regs *regs = die->regs;
7777

78-
hyperv_report_panic(regs);
78+
hyperv_report_panic(regs, val);
7979
return NOTIFY_DONE;
8080
}
8181

0 commit comments

Comments
 (0)