From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbdJ2Seo (ORCPT ); Sun, 29 Oct 2017 14:34:44 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:53748 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751743AbdJ2Sen (ORCPT ); Sun, 29 Oct 2017 14:34:43 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: "K. Y. Srinivasan" Subject: [PATCH 2/2] Drivers: hv: vmbus: Make pannic reporting to be more useful Date: Sun, 29 Oct 2017 11:33:41 -0700 Message-Id: <20171029183341.9857-2-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171029183341.9857-1-kys@exchange.microsoft.com> References: <20171029183151.9786-1-kys@exchange.microsoft.com> <20171029183341.9857-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfArqrPbwH0cB48GgeHoDX3lBPlh0LarcTHpracReoewEp3ofgyVzp0ak8xVfPF+KyPwHYxwpPW0nvRPiVVnwZDK8d6lv7SFwykp/dYqB8bnJXLKKH2S9 3As1FRtwy/kH0j4OwbL/9Gr+cl41+byCnqo7R/nm0g4B+MxrcjkPX96rxMeTb5wR4KQ1zkQziwmO5LR2KVgv/VUbx/fa6jba/ZhjUk10vH2ZTewuHRsYx26J YohNi3qc57n0A9ZqIU5dOTK8EHRmpgAzBVmvrVkSyX7O2I7P7y3/hm7ALPiq7142t3XGIJBgbcZDlhJpK1a80Ud3X5VfekffkSc5AssVWlfSw2RZ8EYgSt2u ICxB1dR401N8gvTLRu7ZeNTjH6o2D7P7fPiSRGrmb4faoDk9ajpDE46eGikFeeLvctVszwBoEKIfeGjPWZUVmg7bkFV3R+8rEbIBBv9NwHLfU0kDjPYXMTyq JIO1oJC6oc89EONpjtKKLIu+otBW9cCpTgox5XtVwyYzE1q7eCVRubS/T0UxIENiXTvnu7K7D0TzY6mr Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "K. Y. Srinivasan" 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 --- arch/x86/hyperv/hv_init.c | 15 +++++++++------ arch/x86/include/asm/mshyperv.h | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index a5db63f728a2..aeb8edf32e2b 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -210,9 +210,10 @@ void hyperv_cleanup(void) } EXPORT_SYMBOL_GPL(hyperv_cleanup); -void hyperv_report_panic(struct pt_regs *regs) +void hyperv_report_panic(struct pt_regs *regs, long err) { static bool panic_reported; + u64 guest_id; /* * We prefer to report panic on 'die' chain as we have proper @@ -223,11 +224,13 @@ void hyperv_report_panic(struct pt_regs *regs) return; panic_reported = true; - wrmsrl(HV_X64_MSR_CRASH_P0, regs->ip); - wrmsrl(HV_X64_MSR_CRASH_P1, regs->ax); - wrmsrl(HV_X64_MSR_CRASH_P2, regs->bx); - wrmsrl(HV_X64_MSR_CRASH_P3, regs->cx); - wrmsrl(HV_X64_MSR_CRASH_P4, regs->dx); + rdmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id); + + wrmsrl(HV_X64_MSR_CRASH_P0, err); + wrmsrl(HV_X64_MSR_CRASH_P1, guest_id); + wrmsrl(HV_X64_MSR_CRASH_P2, regs->ip); + wrmsrl(HV_X64_MSR_CRASH_P3, regs->ax); + wrmsrl(HV_X64_MSR_CRASH_P4, regs->sp); /* * Let Hyper-V know there is crash data available diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 530f448fddaf..bd89104a5533 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -310,7 +310,7 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number) void hyperv_init(void); void hyperv_setup_mmu_ops(void); void hyper_alloc_mmu(void); -void hyperv_report_panic(struct pt_regs *regs); +void hyperv_report_panic(struct pt_regs *regs, long err); bool hv_is_hypercall_page_setup(void); void hyperv_cleanup(void); #else /* CONFIG_HYPERV */ diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index bca8188f3c8c..8fe13cd76acf 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -65,7 +65,7 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, regs = current_pt_regs(); - hyperv_report_panic(regs); + hyperv_report_panic(regs, val); return NOTIFY_DONE; } @@ -75,7 +75,7 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val, struct die_args *die = (struct die_args *)args; struct pt_regs *regs = die->regs; - hyperv_report_panic(regs); + hyperv_report_panic(regs, val); return NOTIFY_DONE; } -- 2.14.1