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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 BF6D3C433E7 for ; Sat, 29 Aug 2020 01:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99998207BB for ; Sat, 29 Aug 2020 01:12:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=atishpatra.org header.i=@atishpatra.org header.b="UgCNc6zV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbgH2BMQ (ORCPT ); Fri, 28 Aug 2020 21:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgH2BMN (ORCPT ); Fri, 28 Aug 2020 21:12:13 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D247C06121B for ; Fri, 28 Aug 2020 18:12:12 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id w13so721245wrk.5 for ; Fri, 28 Aug 2020 18:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=39XN9yo1hBG3Se1gfQYF3vziZZPdblGeQ4oQR1sH/O8=; b=UgCNc6zV3jHlrg/Fv8Pd/IrqWUk206ZSYfkd1Atuw6CbnwlSWhIo20Ev2bp0NzbxNE 5+Oqahty8CR5kwHAXEbFaKD1X/femDV4haD3dBHW5mwpqzOGgAoCxqHujgVFfx1UHLfQ DbN1P+h/aae5Xy6kl9NPJkMdJU0rMyidTucdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=39XN9yo1hBG3Se1gfQYF3vziZZPdblGeQ4oQR1sH/O8=; b=DSqxaO2O44AHDriQ3/u7DX1sCRqrdDW0URqZuWjlXiOvpCRrD3NHqcyXlXgv9vn0V8 OaQHivLKiaPGCQIoGQWLVYPi+Jjid3VMdD1VD8KViuXrlLCmUGK6OBaGmYAaHI2Udn38 qJmkJoexa/FDND8CB1A0M9VYPhsQNEENX4rYuJoc7VhLl+m9XrgelyRORZ9A7BH/SV57 1WhLa/KCNwUyKGXMyAMZFwaT3zt8fheNcM6jCq9NAOB/zkgfd3zlQge/oQlWncvSXToc O70/KWYuAQLLC5x/aUf0bPD2z6sYriG3EDButymiw40l752BuYymjRFumBYvAziGoo15 V7jA== X-Gm-Message-State: AOAM530Td5PGaB2aLdgqEWYkrnMMu56i75vjViDgPUiBX7CuhA/qtYnU Z4P4xqypDMmyRNf3U6knMk6plAaw2m2bb+8xwaiC X-Google-Smtp-Source: ABdhPJzw5EtgUVJ3RG403SG6FcBlDty/Ese8S3VaJefPy33FqMxh5pEHcZSuvxcoiYJMWxt5uOMYBnTEwf6FImhkxMA= X-Received: by 2002:adf:e411:: with SMTP id g17mr1444394wrm.77.1598663531166; Fri, 28 Aug 2020 18:12:11 -0700 (PDT) MIME-Version: 1.0 References: <20200828104830.000007bf@Huawei.com> <20200828161523.GA2158345@bjorn-Precision-5520> In-Reply-To: <20200828161523.GA2158345@bjorn-Precision-5520> From: Atish Patra Date: Fri, 28 Aug 2020 18:11:50 -0700 Message-ID: Subject: Re: [RFC/RFT PATCH 3/6] arm64, numa: Move pcibus_to_node definition to generic numa code To: Bjorn Helgaas 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 Content-Type: text/plain; charset="UTF-8" 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 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 ? We can move the pcibus_to_node to arch specific code for now if that's what is preferred. > > > static void numa_update_cpu(unsigned int cpu, bool remove) > > > { > > > int nid = cpu_to_node(cpu); > > > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv -- Regards, Atish