Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp137846pxk; Sat, 29 Aug 2020 19:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7QCSIooDhSYkIHIw9/5oIT/0fUuqu7PwkznCkvHecxvKvk2CJDDWiTf1OOtIfKFlzob3D X-Received: by 2002:a17:906:7c82:: with SMTP id w2mr5708885ejo.87.1598756168138; Sat, 29 Aug 2020 19:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598756168; cv=none; d=google.com; s=arc-20160816; b=fsAy/iavDRIA22kb8+iPfPUNk1I9wmRN2tSrvmA9hVCYPtRbsjprx8BMcky2LQKZFO mrhBn9M4dqYG6P7d8ffGNp9EQtswK5VCY1PjyD8cNFMGfL1g/vMv2YmlefIemeGWMzDs AEtH2D1dDAf8BlNJj1pi811bCyTxLPM1hcd9vsTp6aConWMZdBoG5eJMwuadSJ77i+mW fd2xDDiTLwr/jQLQRYHwbKMVAiyU1vN4CZbi2y9yWZ6mG2zoqSffpNDSKwuJhdobCiZf O2iVfFZ1fuAgFchtSug5peYOcaiVbs2UOp4QyoyD2Wmp1WuRCtXh+cVW+bBHZQLagUVf U80A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=Ve7ai4dc1SOIm7fl9oUrHWzIpnx9R+51vC87vMvtCO4=; b=rjpOKdBptI1Q0U3f48EUJJLa8TvRSgwkviOU8qrY1JByfmbRvOBCzLV1qoTQlWsSpE +wX/tKlhlyK91mkM1qquu+xS1HLQ30uV4lxqhEdFJv33J0gDt+KRDUq1EpBgxGpOXgTs IVvW44zXA8XYnezxbh0qtOgywuQi/TutTnrxERL/lsmRVEiozyHPbCYIQPd7vliUMkVQ dS5LOBtCbY+iiAuo+DNIiihWXYSR4Vbl2Y8YK2fLi/9e5brU2WAdR44UCeciG0Z80CaH yM7m18wZVw72KJRotNTC0RkqjUma3QoMQBh74TWRoP3KR889CV5zrmlijSLIvQvH6pb9 47YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jtwZ/v6p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si2660901edq.331.2020.08.29.19.55.30; Sat, 29 Aug 2020 19:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jtwZ/v6p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbgH3Cyn (ORCPT + 99 others); Sat, 29 Aug 2020 22:54:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:56956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728613AbgH3Cym (ORCPT ); Sat, 29 Aug 2020 22:54:42 -0400 Received: from localhost (113.sub-72-107-119.myvzw.com [72.107.119.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9897D2075B; Sun, 30 Aug 2020 02:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598756081; bh=Z3utoNDrOsl5rBfHIimSAKozg7AYBP8nGpqxszM//w0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jtwZ/v6p2sVfweeOXgXlYs5Vnq9wMh10kTQjajvH7IdOshWMhSKCj27bkwKMpHy+J Qk7+qfwS1qADtdTbFQaqgVtbf2ylygBfMX7uq6EJiNYEWaOw9HbZh5aCjfBoUbi0/f nZknlBe/Q7GsLWKnLGQJ0kDtulxaxEznfsmvVgm8= Date: Sat, 29 Aug 2020 21:54:38 -0500 From: Bjorn Helgaas To: Atish Patra Cc: Jonathan Cameron , "Rafael J. Wysocki" , Catalin Marinas , Atish Patra , Zong Li , linux-riscv , Will Deacon , linux-arch@vger.kernel.org, Rob Herring , Lorenzo Pieralisi , Ganapatrao Kulkarni , Steven Price , linux-pci@vger.kernel.org, Greentime Hu , Albert Ou , Arnd Bergmann , Anshuman Khandual , Paul Walmsley , Bjorn Helgaas , "linux-arm-kernel@lists.infradead.org" , Nick Hu , Greg Kroah-Hartman , Anup Patel , "linux-kernel@vger.kernel.org List" , Palmer Dabbelt , Andrew Morton , Mike Rapoport Subject: Re: [RFC/RFT PATCH 3/6] arm64, numa: Move pcibus_to_node definition to generic numa code Message-ID: <20200830025438.GA9624@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 06:11:50PM -0700, Atish Patra wrote: > On Fri, Aug 28, 2020 at 9:15 AM Bjorn Helgaas wrote: > > On Fri, Aug 28, 2020 at 10:48:30AM +0100, Jonathan Cameron wrote: > > > On Fri, 14 Aug 2020 14:47:22 -0700 > > > Atish Patra wrote: > > > > > > > pcibus_to_node is used only when numa is enabled and does not depend > > > > on ISA. Thus, it can be moved the generic numa implementation. > > > > > > > > Signed-off-by: Atish Patra > > > > > > From a more general unification point of view, there seem to > > > be two ways architectures implement this. > > > Either > > > > > > bus->sysdata.node > > > > > > Or as here. > > > There are weird other options, but let us ignore those :) > > > > > > That is going to take a bit of unwinding should we > > > want to take this unification further and perhaps we want to think > > > about doing this in pci generic code rather than here? > > > > > > Perhaps this is one we are better keeping architecture specific for > > > now? > > > > > > +CC Bjorn and Linux-pci > > > > > > > > > > --- > > > > arch/arm64/kernel/pci.c | 10 ---------- > > > > drivers/base/arch_numa.c | 11 +++++++++++ > > > > 2 files changed, 11 insertions(+), 10 deletions(-) > > > > > > > > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c > > > > index 1006ed2d7c60..07c122946c11 100644 > > > > --- a/arch/arm64/kernel/pci.c > > > > +++ b/arch/arm64/kernel/pci.c > > > > @@ -54,16 +54,6 @@ int raw_pci_write(unsigned int domain, unsigned int bus, > > > > return b->ops->write(b, devfn, reg, len, val); > > > > } > > > > > > > > -#ifdef CONFIG_NUMA > > > > - > > > > -int pcibus_to_node(struct pci_bus *bus) > > > > -{ > > > > - return dev_to_node(&bus->dev); > > > > -} > > > > -EXPORT_SYMBOL(pcibus_to_node); > > > > - > > > > -#endif > > > > - > > > > #ifdef CONFIG_ACPI > > > > > > > > struct acpi_pci_generic_root_info { > > > > diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c > > > > index 83341c807240..4ab1b20a615d 100644 > > > > --- a/drivers/base/arch_numa.c > > > > +++ b/drivers/base/arch_numa.c > > > > @@ -11,6 +11,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > > > > > #ifdef CONFIG_ARM64 > > > > @@ -60,6 +61,16 @@ EXPORT_SYMBOL(cpumask_of_node); > > > > > > > > #endif > > > > > > > > +#ifdef CONFIG_PCI > > > > + > > > > +int pcibus_to_node(struct pci_bus *bus) > > > > +{ > > > > + return dev_to_node(&bus->dev); > > > > +} > > > > +EXPORT_SYMBOL(pcibus_to_node); > > > > + > > > > +#endif > > > > I certainly agree that this should not be arch-specific, but I'm not > > really in favor of adding this PCI gunk in drivers/base. > > > > I think we can do better (eventually) by getting rid of > > pcibus_to_node() completely. It's not used very much except by > > cpumask_of_pcibus(), which itself is hardly used at all. > > > I am a bit confused here. A quick grep suggested that pcibus_to_node() > is also called from generic pci probe, > controller and few drivers(block, infiniband) as well. Maybe I am > missing something here ? I didn't say it was *only* used by cpumask_of_pcibus(). 13 of the 29 calls are from cpumask_of_pcibus(). As you point out, there are a few drivers that use it. They typically have a pci_dev, so they do the equivalent of pcibus_to_node(pdev->bus). That seems silly; they should just do dev_to_node(&pdev->dev) instead. I looked at this once, and it seems like there might have been a wrinkle like the pdev->dev node not being set correctly or something. If that's the case, I think it should be fixed. > We can move the pcibus_to_node to arch specific code for now if that's > what is preferred. Now I'm the one who's confused :) Most arches, including arm64, already have arch-specific implementations of pcibus_to_node(). I didn't look at the rest of the series to see if there's a reason you need to move pcibus_to_node() from arch/arm64/kernel/pci.c to drivers//base/arch_numa.c. If you don't need to, I would just leave it where it is. > > > > static void numa_update_cpu(unsigned int cpu, bool remove) > > > > { > > > > int nid = cpu_to_node(cpu);