From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7565C433E0 for ; Tue, 2 Jun 2020 04:42:59 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61F7D206C3 for ; Tue, 2 Jun 2020 04:42:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61F7D206C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 224EA85E0B; Tue, 2 Jun 2020 04:42:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id czm8yWIA9OQR; Tue, 2 Jun 2020 04:42:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 77D6A85E06; Tue, 2 Jun 2020 04:42:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 69AB4C0178; Tue, 2 Jun 2020 04:42:58 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id B4BD8C0176 for ; Tue, 2 Jun 2020 04:42:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9AF0685E0B for ; Tue, 2 Jun 2020 04:42:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BZ6kHNsD0txQ for ; Tue, 2 Jun 2020 04:42:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from huawei.com (szxga02-in.huawei.com [45.249.212.188]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 105D285E06 for ; Tue, 2 Jun 2020 04:42:54 +0000 (UTC) Received: from dggemi406-hub.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id B531CB564B3EBAAFC3AC; Tue, 2 Jun 2020 12:42:50 +0800 (CST) Received: from DGGEMI525-MBS.china.huawei.com ([169.254.6.10]) by dggemi406-hub.china.huawei.com ([10.3.17.144]) with mapi id 14.03.0487.000; Tue, 2 Jun 2020 12:42:43 +0800 From: "Song Bao Hua (Barry Song)" To: Greg KH Subject: RE: [PATCH] driver core: platform: expose numa_node to users in sysfs Thread-Topic: [PATCH] driver core: platform: expose numa_node to users in sysfs Thread-Index: AQHWOIpUwdvGGcJ/+UCxidEm0PhHvqjEM/4AgACJWmA= Date: Tue, 2 Jun 2020 04:42:42 +0000 Message-ID: References: <20200602030139.73012-1-song.bao.hua@hisilicon.com> <20200602042340.GA2130884@kroah.com> In-Reply-To: <20200602042340.GA2130884@kroah.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.203.56] MIME-Version: 1.0 X-CFilter-Loop: Reflected Cc: "rafael@kernel.org" , Linuxarm , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "Zengtao \(B\)" , Robin Murphy , "linux-arm-kernel@lists.infradead.org" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Tuesday, June 2, 2020 4:24 PM > To: Song Bao Hua (Barry Song) > Cc: rafael@kernel.org; iommu@lists.linux-foundation.org; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Linuxarm > ; Zengtao (B) ; Robin > Murphy > Subject: Re: [PATCH] driver core: platform: expose numa_node to users in sysfs > > On Tue, Jun 02, 2020 at 03:01:39PM +1200, Barry Song wrote: > > For some platform devices like iommu, particually ARM smmu, users may > > care about the numa locality. for example, if threads and drivers run > > near iommu, they may get much better performance on dma_unmap_sg. > > For other platform devices, users may still want to know the hardware > > topology. > > > > Cc: Prime Zeng > > Cc: Robin Murphy > > Signed-off-by: Barry Song > > --- > > drivers/base/platform.c | 26 +++++++++++++++++++++++++- > > 1 file changed, 25 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > > index b27d0f6c18c9..7794b9a38d82 100644 > > --- a/drivers/base/platform.c > > +++ b/drivers/base/platform.c > > @@ -1062,13 +1062,37 @@ static ssize_t driver_override_show(struct > device *dev, > > } > > static DEVICE_ATTR_RW(driver_override); > > > > +static ssize_t numa_node_show(struct device *dev, > > + struct device_attribute *attr, char *buf) > > +{ > > + return sprintf(buf, "%d\n", dev_to_node(dev)); > > +} > > +static DEVICE_ATTR_RO(numa_node); > > + > > +static umode_t platform_dev_attrs_visible(struct kobject *kobj, struct > attribute *a, > > + int n) > > +{ > > + struct device *dev = container_of(kobj, typeof(*dev), kobj); > > + > > + if (a == &dev_attr_numa_node.attr && > > + dev_to_node(dev) == NUMA_NO_NODE) > > + return 0; > > + > > + return a->mode; > > +} > > > > static struct attribute *platform_dev_attrs[] = { > > &dev_attr_modalias.attr, > > + &dev_attr_numa_node.attr, > > &dev_attr_driver_override.attr, > > NULL, > > }; > > -ATTRIBUTE_GROUPS(platform_dev); > > + > > +static struct attribute_group platform_dev_group = { > > + .attrs = platform_dev_attrs, > > + .is_visible = platform_dev_attrs_visible, > > +}; > > +__ATTRIBUTE_GROUPS(platform_dev); > > > > static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) > > { > > Platform devices are NUMA? That's crazy, and feels like a total abuse > of platform devices and drivers that really should belong on a "real" > bus. I am not sure if it is an abuse of platform device. But smmu is a platform device, drivers/iommu/arm-smmu-v3.c is a platform driver. In a typical ARM server, there are maybe multiple SMMU devices which can support IO virtual address and page tables for other devices on PCI-like busses. Each different SMMU device might be close to different NUMA node. There is really a hardware topology. If you have multiple CPU packages in a NUMA server, some platform devices might Belong to CPU0, some other might belong to CPU1. -barry > > What drivers in the kernel today have this issue? > > thanks, > > greg k-h _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu