Re: [RFC/RFT PATCH 3/6] arm64, numa: Move pcibus_to_node definition to generic numa code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 28, 2020 at 10:48:30AM +0100, Jonathan Cameron wrote:
> On Fri, 14 Aug 2020 14:47:22 -0700
> Atish Patra <atish.patra@xxxxxxx> 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 <atish.patra@xxxxxxx>
> 
> 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 <linux/acpi.h>
> >  #include <linux/memblock.h>
> >  #include <linux/module.h>
> > +#include <linux/pci.h>
> >  #include <linux/of.h>
> >  
> >  #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.

> >  static void numa_update_cpu(unsigned int cpu, bool remove)
> >  {
> >  	int nid = cpu_to_node(cpu);
> 
> 



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux