linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Drivers: hv: vmbus: Miscellaneous fixes/enhancements
@ 2018-07-28 21:56 kys
  2018-07-28 21:58 ` [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer kys
  0 siblings, 1 reply; 5+ messages in thread
From: kys @ 2018-07-28 21:56 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: K. Y. Srinivasan

From: "K. Y. Srinivasan" <kys@microsoft.com>

Miscellaneous fixes/enhancements

Stephen Hemminger (1):
  Drivers: hv: vmbus: add numa_node to sysfs

Sunil Muthuswamy (3):
  Drivers: hv: vmus: Fix the check for return value from kmsg get dump
    buffer
  Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr
  Drivers: hv: vmbus: Get rid of MSR access from vmbus_drv.c

 Documentation/ABI/stable/sysfs-bus-vmbus |  7 ++++
 arch/x86/include/asm/mshyperv.h          |  3 ++
 drivers/hv/vmbus_drv.c                   | 44 ++++++++++++++----------
 3 files changed, 36 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer
  2018-07-28 21:56 [PATCH 0/4] Drivers: hv: vmbus: Miscellaneous fixes/enhancements kys
@ 2018-07-28 21:58 ` kys
  2018-07-28 21:58   ` [PATCH 2/4] Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr kys
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: kys @ 2018-07-28 21:58 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: Sunil Muthuswamy, K . Y . Srinivasan

From: Sunil Muthuswamy <sunilmut@microsoft.com>

The code to support panic control message was checking the return was
checking the return value from kmsg_dump_get_buffer as error value, which
is not what the routine returns. This fixes it.

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

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/vmbus_drv.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 05e37283d7c3..a7f33c1f42c5 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1047,13 +1047,10 @@ 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;
-	}
-
-	hyperv_report_panic_msg(panic_pa, bytes_written);
+	kmsg_dump_get_buffer(dumper, true, hv_panic_page, PAGE_SIZE,
+			     &bytes_written);
+	if (bytes_written)
+		hyperv_report_panic_msg(panic_pa, bytes_written);
 }
 
 static struct kmsg_dumper hv_kmsg_dumper = {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr
  2018-07-28 21:58 ` [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer kys
@ 2018-07-28 21:58   ` kys
  2018-07-28 21:58   ` [PATCH 3/4] Drivers: hv: vmbus: Get rid of MSR access from vmbus_drv.c kys
  2018-07-28 21:58   ` [PATCH 4/4] Drivers: hv: vmbus: add numa_node to sysfs kys
  2 siblings, 0 replies; 5+ messages in thread
From: kys @ 2018-07-28 21:58 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: Sunil Muthuswamy, K . Y . Srinivasan

From: Sunil Muthuswamy <sunilmut@microsoft.com>

The check to free the Hyper-V control table header was reversed. This
fixes it.

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

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/vmbus_drv.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index a7f33c1f42c5..5e946b1be54c 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1176,11 +1176,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;
 }
 
@@ -1891,11 +1888,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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] Drivers: hv: vmbus: Get rid of MSR access from vmbus_drv.c
  2018-07-28 21:58 ` [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer kys
  2018-07-28 21:58   ` [PATCH 2/4] Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr kys
@ 2018-07-28 21:58   ` kys
  2018-07-28 21:58   ` [PATCH 4/4] Drivers: hv: vmbus: add numa_node to sysfs kys
  2 siblings, 0 replies; 5+ messages in thread
From: kys @ 2018-07-28 21:58 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: Sunil Muthuswamy, K . Y . Srinivasan

From: Sunil Muthuswamy <sunilmut@microsoft.com>

Get rid of ISA specific code from vmus_drv.c which is common code.

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

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 arch/x86/include/asm/mshyperv.h | 3 +++
 drivers/hv/vmbus_drv.c          | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 156a2e5a97a9..b731c4bf70ed 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -96,6 +96,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 5e946b1be54c..db145e1a7049 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1146,7 +1146,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) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] Drivers: hv: vmbus: add numa_node to sysfs
  2018-07-28 21:58 ` [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer kys
  2018-07-28 21:58   ` [PATCH 2/4] Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr kys
  2018-07-28 21:58   ` [PATCH 3/4] Drivers: hv: vmbus: Get rid of MSR access from vmbus_drv.c kys
@ 2018-07-28 21:58   ` kys
  2 siblings, 0 replies; 5+ messages in thread
From: kys @ 2018-07-28 21:58 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
	Michael.H.Kelley, vkuznets
  Cc: Stephen Hemminger, K . Y . Srinivasan

From: Stephen Hemminger <stephen@networkplumber.org>

Being able to find the numa_node for a device is useful for userspace
drivers (DPDK) and also for diagnosing performance issues.  This makes
vmbus similar to pci.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 Documentation/ABI/stable/sysfs-bus-vmbus |  7 +++++++
 drivers/hv/vmbus_drv.c                   | 17 +++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus b/Documentation/ABI/stable/sysfs-bus-vmbus
index 3eaffbb2d468..3fed8fdb873d 100644
--- a/Documentation/ABI/stable/sysfs-bus-vmbus
+++ b/Documentation/ABI/stable/sysfs-bus-vmbus
@@ -42,6 +42,13 @@ Contact:	K. Y. Srinivasan <kys@microsoft.com>
 Description:	The 16 bit vendor ID of the device
 Users:		tools/hv/lsvmbus and user level RDMA libraries
 
+What:		/sys/bus/vmbus/devices/<UUID>/numa_node
+Date:		Jul 2018
+KernelVersion:	4.19
+Contact:	Stephen Hemminger <sthemmin@microsoft.com>
+Description:	This NUMA node to which the VMBUS device is
+		attached, or -1 if the node is unknown.
+
 What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>
 Date:		September. 2017
 KernelVersion:	4.14
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index db145e1a7049..b1b548a21f91 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -210,6 +210,20 @@ static ssize_t modalias_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(modalias);
 
+#ifdef CONFIG_NUMA
+static ssize_t numa_node_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	struct hv_device *hv_dev = device_to_hv_device(dev);
+
+	if (!hv_dev->channel)
+		return -ENODEV;
+
+	return sprintf(buf, "%d\n", hv_dev->channel->numa_node);
+}
+static DEVICE_ATTR_RO(numa_node);
+#endif
+
 static ssize_t server_monitor_pending_show(struct device *dev,
 					   struct device_attribute *dev_attr,
 					   char *buf)
@@ -492,6 +506,9 @@ static struct attribute *vmbus_dev_attrs[] = {
 	&dev_attr_class_id.attr,
 	&dev_attr_device_id.attr,
 	&dev_attr_modalias.attr,
+#ifdef CONFIG_NUMA
+	&dev_attr_numa_node.attr,
+#endif
 	&dev_attr_server_monitor_pending.attr,
 	&dev_attr_client_monitor_pending.attr,
 	&dev_attr_server_monitor_latency.attr,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-28 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-28 21:56 [PATCH 0/4] Drivers: hv: vmbus: Miscellaneous fixes/enhancements kys
2018-07-28 21:58 ` [PATCH 1/4] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer kys
2018-07-28 21:58   ` [PATCH 2/4] Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr kys
2018-07-28 21:58   ` [PATCH 3/4] Drivers: hv: vmbus: Get rid of MSR access from vmbus_drv.c kys
2018-07-28 21:58   ` [PATCH 4/4] Drivers: hv: vmbus: add numa_node to sysfs kys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).