Skip to content

Commit 96dda42

Browse files
shemmingermerwick
authored andcommitted
Drivers: hv: vmbus: add numa_node to sysfs
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 <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 7ceb1c3) Orabug: 28671425 Signed-off-by: Liam Merwick <[email protected]> Reviewed-by: Darren Kenny <[email protected]> Reviewed-by: Alejandro Jimenez <[email protected]> Tested-by: Vijay Balakrishna <[email protected]>
1 parent 1cfd0cb commit 96dda42

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Documentation/ABI/stable/sysfs-bus-vmbus

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ Contact: K. Y. Srinivasan <[email protected]>
4242
Description: The 16 bit vendor ID of the device
4343
Users: tools/hv/lsvmbus and user level RDMA libraries
4444

45+
What: /sys/bus/vmbus/devices/<UUID>/numa_node
46+
Date: Jul 2018
47+
KernelVersion: 4.19
48+
Contact: Stephen Hemminger <[email protected]>
49+
Description: This NUMA node to which the VMBUS device is
50+
attached, or -1 if the node is unknown.
51+
4552
What: /sys/bus/vmbus/devices/<UUID>/channels/<N>
4653
Date: September. 2017
4754
KernelVersion: 4.14

drivers/hv/vmbus_drv.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ static ssize_t modalias_show(struct device *dev,
210210
}
211211
static DEVICE_ATTR_RO(modalias);
212212

213+
#ifdef CONFIG_NUMA
214+
static ssize_t numa_node_show(struct device *dev,
215+
struct device_attribute *attr, char *buf)
216+
{
217+
struct hv_device *hv_dev = device_to_hv_device(dev);
218+
219+
if (!hv_dev->channel)
220+
return -ENODEV;
221+
222+
return sprintf(buf, "%d\n", hv_dev->channel->numa_node);
223+
}
224+
static DEVICE_ATTR_RO(numa_node);
225+
#endif
226+
213227
static ssize_t server_monitor_pending_show(struct device *dev,
214228
struct device_attribute *dev_attr,
215229
char *buf)
@@ -492,6 +506,9 @@ static struct attribute *vmbus_dev_attrs[] = {
492506
&dev_attr_class_id.attr,
493507
&dev_attr_device_id.attr,
494508
&dev_attr_modalias.attr,
509+
#ifdef CONFIG_NUMA
510+
&dev_attr_numa_node.attr,
511+
#endif
495512
&dev_attr_server_monitor_pending.attr,
496513
&dev_attr_client_monitor_pending.attr,
497514
&dev_attr_server_monitor_latency.attr,

0 commit comments

Comments
 (0)