]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Drivers: hv: vmbus: add numa_node to sysfs
authorStephen Hemminger <stephen@networkplumber.org>
Sat, 28 Jul 2018 21:58:48 +0000 (21:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Jul 2018 06:09:56 +0000 (08:09 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/stable/sysfs-bus-vmbus
drivers/hv/vmbus_drv.c

index 3eaffbb2d468933233c576cd9f4796b393c67620..3fed8fdb873d723e3bc25e155dee3be2d797d352 100644 (file)
@@ -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
index db145e1a70499db7c79644976d6970b5cc58863f..b1b548a21f919b31f8e5d7f670352ee6f7d25f56 100644 (file)
@@ -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,