[PATCH] Drivers: HV: panic kmsg dump, move MSR access to arch specific

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moves the MSR access from arch independent code to arch
dependent code. Also includes minor bug fixes.

Fixes: 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

Signed-off-by: Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>
---
Have added a "Fixes" line to associate this with the original commit, which
it fixes.

---
 arch/x86/include/asm/mshyperv.h |  3 +++
 drivers/hv/vmbus_drv.c          | 26 +++++++++-----------------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 406da8d159e3..4d82ad347b75 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -97,6 +97,9 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type)
 #define hv_set_synint_state(int_num, val) \
 	wrmsrl(HV_X64_MSR_SINT0 + int_num, val)
 
+#define hv_get_crash_ctl(val) \
+	rdmsrl(HV_X64_MSR_CRASH_CTL, val)
+
 void hyperv_callback_vector(void);
 void hyperv_reenlightenment_vector(void);
 #ifdef CONFIG_TRACING
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 05e37283d7c3..ec131a26530e 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1047,13 +1047,11 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
 	 * Write dump contents to the page. No need to synchronize; panic should
 	 * be single-threaded.
 	 */
-	if (!kmsg_dump_get_buffer(dumper, true, hv_panic_page,
-				  PAGE_SIZE, &bytes_written)) {
-		pr_err("Hyper-V: Unable to get kmsg data for panic\n");
-		return;
-	}
+	kmsg_dump_get_buffer(dumper, true, hv_panic_page, PAGE_SIZE,
+			     &bytes_written);
 
-	hyperv_report_panic_msg(panic_pa, bytes_written);
+	if (bytes_written)
+		hyperv_report_panic_msg(panic_pa, bytes_written);
 }
 
 static struct kmsg_dumper hv_kmsg_dumper = {
@@ -1149,7 +1147,7 @@ static int vmbus_bus_init(void)
 		 * Register for panic kmsg callback only if the right
 		 * capability is supported by the hypervisor.
 		 */
-		rdmsrl(HV_X64_MSR_CRASH_CTL, hyperv_crash_ctl);
+		hv_get_crash_ctl(hyperv_crash_ctl);
 		if (hyperv_crash_ctl & HV_CRASH_CTL_CRASH_NOTIFY_MSG) {
 			hv_panic_page = (void *)get_zeroed_page(GFP_KERNEL);
 			if (hv_panic_page) {
@@ -1179,11 +1177,8 @@ static int vmbus_bus_init(void)
 
 	bus_unregister(&hv_bus);
 	free_page((unsigned long)hv_panic_page);
-	if (!hv_ctl_table_hdr) {
-		unregister_sysctl_table(hv_ctl_table_hdr);
-		hv_ctl_table_hdr = NULL;
-	}
-
+	unregister_sysctl_table(hv_ctl_table_hdr);
+	hv_ctl_table_hdr = NULL;
 	return ret;
 }
 
@@ -1894,11 +1889,8 @@ static void __exit vmbus_exit(void)
 	}
 
 	free_page((unsigned long)hv_panic_page);
-	if (!hv_ctl_table_hdr) {
-		unregister_sysctl_table(hv_ctl_table_hdr);
-		hv_ctl_table_hdr = NULL;
-	}
-
+	unregister_sysctl_table(hv_ctl_table_hdr);
+	hv_ctl_table_hdr = NULL;
 	bus_unregister(&hv_bus);
 
 	cpuhp_remove_state(hyperv_cpuhp_online);
-- 
2.17.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux