Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2342007imm; Sat, 28 Jul 2018 15:01:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeTyPQSfk4Z7ZCmjMx4x5jiTuZ2Ag5+nDDpe/TresrsSuH0gYklwkBmq9tkgb1jEElstZoN X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr10747891pll.119.1532815290387; Sat, 28 Jul 2018 15:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532815290; cv=none; d=google.com; s=arc-20160816; b=zM+X2+zfQRkXzxLDIWDtWQRZmnH2KpS00y+0Uvz00pQQkotJpzfTS3NFKdfoOQFT0S yt8QWoYRTApY5Db/9XycOlHP/3iETw0ILd0+dBTenh2Dj/kZ/w5hYCe2SXrV67hAU2Gd H4wUnx7yEPKW5asGeEBVgTtJdScrraw0zj8BDr/6O83n72PxVRP0LvijsaQNmwlvjVSL YoVNH6g1aU6WV66aa1VnEmU+Gq0UzxiESZJtBVOQQSXd60xFrz0XnHedf00KOYQNXzYq zuu6Y3XoFtLw2R1PBwq9smgozZVgT7Qm5VswybEbg8kCJaErP5CaG5YwKOVEvKb0tSkW S3xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=kGtJxFL5mtoROAmcrojaF4tSeHi0oVRV8AdgZCYrbTw=; b=z+fSrqrHxgRKO9QURGhMGfxRVVaLUNWGFAuj0KzXUPpDmxCWvlzhErwPvrNo8lylzL aqEmHgL+AJRJUbAftGkPvUiyuaoROa0kIlCk2t3n5pZN4SddHoukYSFxOExJ8TtNd/QF gNOF65Q1iP8PbmVbxGFp4SGei7AZXN+yu0B6oNOdywPv5PhGl2Oeue7HWpul556jJlG8 9Av3itwLzqFtD+IDAeehkxeifHw4kh99j98LOT8maLhZM3D+8UvNgEwpU33ZCTGRyeWz 5okF74UdSeGNosrwEACJKzq03/WoYrFScT8gxE2iWtclMipDx5USB1x+67u4Ykr3qTHU 8yTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26-v6si7251800pfj.188.2018.07.28.15.01.16; Sat, 28 Jul 2018 15:01:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731380AbeG1X1t (ORCPT + 99 others); Sat, 28 Jul 2018 19:27:49 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:39950 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731330AbeG1X1s (ORCPT ); Sat, 28 Jul 2018 19:27:48 -0400 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id jXEgfoPyRVktnjXEgf9FrL; Sat, 28 Jul 2018 14:58:50 -0700 x-originating-ip: 107.180.71.197 Received: from kys by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.91) (envelope-from ) id 1fjXEg-0003bp-H3; Sat, 28 Jul 2018 14:58:50 -0700 From: kys@linuxonhyperv.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, sthemmin@microsoft.com, Michael.H.Kelley@microsoft.com, vkuznets@redhat.com Cc: Stephen Hemminger , "K . Y . Srinivasan" Subject: [PATCH 4/4] Drivers: hv: vmbus: add numa_node to sysfs Date: Sat, 28 Jul 2018 21:58:48 +0000 Message-Id: <20180728215848.13814-4-kys@linuxonhyperv.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180728215848.13814-1-kys@linuxonhyperv.com> References: <20180728215630.13712-1-kys@linuxonhyperv.com> <20180728215848.13814-1-kys@linuxonhyperv.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfKmyjAN23z8Xx5yeTVnmWB6u/GLJ+CvcavpxuMCPoDhMib1e4KzELlxTg5fmcEfGvC7XFYrCgUXThHOMn4pYs8uv9f0T3H5s7JUR4noFlXRUHd+5af4Z x0w3OxDmlmow0HmSPlY92l5bPSjyx0/otVu+vacnFkzz9p9nFMjUpI+UurNBBrr0BrvkraxUBGlWzXB0xhOBHCu5KRMoypJevm3DxwzlBqOMsQOSWqOZhQBI UDURTf3WULeQzAiecH9loF9oBjlc33GCtIg7m1FGXkFFTuUEL6Sx9orYeYFNt7WrX90sRIEw+u2L9Alk+mh7SkakP2n+JoiT7LL55tLCrdFYAFBmLDUS6Ja8 /cO3nuvKTOcJGEB/qg/vO0AA3p9VV0vOM8drlA0CxmZ0XpUmeMS1rRiZpUzzaRcp0xR+nSJKGtHlP/FhX1is/WGARpkY2Q1aMoyMSYJph3OLo5SxMsTdP9qU q0SGZkJfjDc2Q2nGsCQTamOUO6GGDVgrQ+804yYGu2jKLzFO4ycm05Fw5z6wjPIqLpdvB5D/i/s/UpzAtSPyqbIenJropy2mYBDS3Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Hemminger 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 Signed-off-by: K. Y. Srinivasan --- 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 Description: The 16 bit vendor ID of the device Users: tools/hv/lsvmbus and user level RDMA libraries +What: /sys/bus/vmbus/devices//numa_node +Date: Jul 2018 +KernelVersion: 4.19 +Contact: Stephen Hemminger +Description: This NUMA node to which the VMBUS device is + attached, or -1 if the node is unknown. + What: /sys/bus/vmbus/devices//channels/ 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