All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
@ 2017-04-26 10:06 Lorenzo Pieralisi
  2017-04-26 10:06 ` [RFC/RFT PATCH 2/3] PCI: Add call to set-up NUMA node for struct pci_bus devices Lorenzo Pieralisi
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-04-26 10:06 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-acpi, linux-kernel, Lorenzo Pieralisi, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

Create an empty stub, to be populated by firmware methods, to
retrieve the NUMA node for a given pci_bus. No functional change
introduced.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.c   | 6 ++++++
 include/linux/pci.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7904d02..2de9162 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
+#include <linux/numa.h>
 #include <linux/of.h>
 #include <linux/of_pci.h>
 #include <linux/pci.h>
@@ -5235,6 +5236,11 @@ int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent)
 #endif
 #endif
 
+int pci_bus_find_numa_node(struct pci_bus *bus)
+{
+	return NUMA_NO_NODE;
+}
+
 /**
  * pci_ext_cfg_avail - can we access extended PCI config space?
  *
diff --git a/include/linux/pci.h b/include/linux/pci.h
index eb3da1a..9e62462 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1481,6 +1481,7 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
 #endif
 int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
 #endif
+int pci_bus_find_numa_node(struct pci_bus *bus);
 
 /* some architectures require additional setup to direct VGA traffic */
 typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC/RFT PATCH 2/3] PCI: Add call to set-up NUMA node for struct pci_bus devices
  2017-04-26 10:06 [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Lorenzo Pieralisi
@ 2017-04-26 10:06 ` Lorenzo Pieralisi
  2017-04-26 10:06 ` [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation Lorenzo Pieralisi
  2017-05-12 12:44 ` [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Vadim Lomovtsev
  2 siblings, 0 replies; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-04-26 10:06 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-acpi, linux-kernel, Lorenzo Pieralisi, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

The member dev in struct pci_bus represents the kernel struct
device representation of a PCI bus, inclusive of its NUMA node.
When a PCI host bridge is registered, initialize the corresponding
struct pci_bus.dev member NUMA node and add code in
pci_alloc_child_bus() to propagate the NUMA node set-up through the PCI
bus hierarchy (ie child nodes are in the same NUMA node as the parent).

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dfc9a27..5739a993 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -770,6 +770,7 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
 	device_enable_async_suspend(bus->bridge);
 	pci_set_bus_of_node(bus);
 	pci_set_bus_msi_domain(bus);
+	set_dev_node(&bus->dev, pci_bus_find_numa_node(bus));
 
 	if (!parent)
 		set_dev_node(bus->bridge, pcibus_to_node(bus));
@@ -861,7 +862,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
 	 */
 	child->dev.class = &pcibus_class;
 	dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
-
+	set_dev_node(&child->dev, dev_to_node(&parent->dev));
 	/*
 	 * Set up the primary, secondary and subordinate
 	 * bus numbers.
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
  2017-04-26 10:06 [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Lorenzo Pieralisi
  2017-04-26 10:06 ` [RFC/RFT PATCH 2/3] PCI: Add call to set-up NUMA node for struct pci_bus devices Lorenzo Pieralisi
@ 2017-04-26 10:06 ` Lorenzo Pieralisi
  2017-05-15  6:13     ` Zhou Wang
  2017-05-12 12:44 ` [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Vadim Lomovtsev
  2 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-04-26 10:06 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-acpi, linux-kernel, Lorenzo Pieralisi, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
host bridge registration to detect the NUMA node for a given
struct pci_bus.dev. Implement an ACPI method that, through
the struct pci_bus.bridge ACPI companion, retrieve and return
the NUMA node corresponding to a given struct pci_bus.dev.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
 include/linux/pci.h    |  6 ++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 0018603..915da79 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/irqdomain.h>
+#include <linux/numa.h>
 #include <linux/pci.h>
 #include <linux/msi.h>
 #include <linux/pci_hotplug.h>
@@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
 	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
 }
 
+int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
+{
+	int node = NUMA_NO_NODE;
+	struct device *bridge = get_device(bus->bridge);
+
+	if (!bridge)
+		return node;
+
+	if (has_acpi_companion(bridge)) {
+		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
+
+		node = acpi_get_node(adev->handle);
+	}
+
+	put_device(bridge);
+
+	return node;
+}
+
 static int __init acpi_pci_init(void)
 {
 	int ret;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9e62462..b40d095 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
 #endif
 int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
 #endif
+#ifdef CONFIG_ACPI
+int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
+#else
+static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
+{ return NUMA_NO_NODE; }
+#endif
 int pci_bus_find_numa_node(struct pci_bus *bus);
 
 /* some architectures require additional setup to direct VGA traffic */
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
  2017-04-26 10:06 [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Lorenzo Pieralisi
  2017-04-26 10:06 ` [RFC/RFT PATCH 2/3] PCI: Add call to set-up NUMA node for struct pci_bus devices Lorenzo Pieralisi
  2017-04-26 10:06 ` [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation Lorenzo Pieralisi
@ 2017-05-12 12:44 ` Vadim Lomovtsev
  2017-05-12 15:50   ` Lorenzo Pieralisi
  2 siblings, 1 reply; 13+ messages in thread
From: Vadim Lomovtsev @ 2017-05-12 12:44 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Vadim Lomovtsev, linux-pci, linux-acpi, linux-kernel,
	Bjorn Helgaas, Sergey Temerkhanov, Sinan Kaya

Hi Lorenzo,

Are there any news related to these patches ?

WBR,
Vadim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
  2017-05-12 12:44 ` [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Vadim Lomovtsev
@ 2017-05-12 15:50   ` Lorenzo Pieralisi
  2017-05-12 17:18     ` Vadim Lomovtsev
  0 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-05-12 15:50 UTC (permalink / raw)
  To: Vadim Lomovtsev
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

Hi Vadim,

On Fri, May 12, 2017 at 05:44:05AM -0700, Vadim Lomovtsev wrote:
> Hi Lorenzo,
> 
> Are there any news related to these patches ?

Not really, I have not received any feedback but I was expecting some
to make progress here. Have you tested it ?

Please let me know, thanks !

Lorenzo

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
  2017-05-12 15:50   ` Lorenzo Pieralisi
@ 2017-05-12 17:18     ` Vadim Lomovtsev
  2017-05-15 12:57       ` Vadim Lomovtsev
  0 siblings, 1 reply; 13+ messages in thread
From: Vadim Lomovtsev @ 2017-05-12 17:18 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya, Vadim.Lomovtsev

Hi Lorenzo

On Fri, May 12, 2017 at 04:50:40PM +0100, Lorenzo Pieralisi wrote:
> Hi Vadim,
> 
> On Fri, May 12, 2017 at 05:44:05AM -0700, Vadim Lomovtsev wrote:
> > Hi Lorenzo,
> > 
> > Are there any news related to these patches ?
> 
> Not really, I have not received any feedback but I was expecting some
> to make progress here. Have you tested it ?
>
> Please let me know, thanks !

Not yet. Plan to test them after weekend and will get back to you.

> 
> Lorenzo

WBR,
Vadim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
  2017-04-26 10:06 ` [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation Lorenzo Pieralisi
@ 2017-05-15  6:13     ` Zhou Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhou Wang @ 2017-05-15  6:13 UTC (permalink / raw)
  To: Lorenzo Pieralisi, linux-pci
  Cc: linux-acpi, linux-kernel, Bjorn Helgaas, Sergey Temerkhanov, Sinan Kaya

On 2017/4/26 18:06, Lorenzo Pieralisi wrote:
> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
> host bridge registration to detect the NUMA node for a given
> struct pci_bus.dev. Implement an ACPI method that, through
> the struct pci_bus.bridge ACPI companion, retrieve and return
> the NUMA node corresponding to a given struct pci_bus.dev.
> 
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
>  include/linux/pci.h    |  6 ++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 0018603..915da79 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -10,6 +10,7 @@
>  #include <linux/delay.h>
>  #include <linux/init.h>
>  #include <linux/irqdomain.h>
> +#include <linux/numa.h>
>  #include <linux/pci.h>
>  #include <linux/msi.h>
>  #include <linux/pci_hotplug.h>
> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
>  	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
>  }
>  
> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> +{
> +	int node = NUMA_NO_NODE;
> +	struct device *bridge = get_device(bus->bridge);
> +
> +	if (!bridge)
> +		return node;
> +
> +	if (has_acpi_companion(bridge)) {
> +		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
> +
> +		node = acpi_get_node(adev->handle);
> +	}
> +
> +	put_device(bridge);
> +
> +	return node;
> +}
> +

It seems there is no function to call this, am I right?

Another question is that:
in the latest IORT revision C, "Proximity domain" has been added to the IORT spec.
So when we enable NUMA for a PCIe device, should we also consider this?

Thanks,
Zhou

>  static int __init acpi_pci_init(void)
>  {
>  	int ret;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 9e62462..b40d095 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
>  #endif
>  int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
>  #endif
> +#ifdef CONFIG_ACPI
> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
> +#else
> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> +{ return NUMA_NO_NODE; }
> +#endif
>  int pci_bus_find_numa_node(struct pci_bus *bus);
>  
>  /* some architectures require additional setup to direct VGA traffic */
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
@ 2017-05-15  6:13     ` Zhou Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhou Wang @ 2017-05-15  6:13 UTC (permalink / raw)
  To: Lorenzo Pieralisi, linux-pci
  Cc: linux-acpi, linux-kernel, Bjorn Helgaas, Sergey Temerkhanov, Sinan Kaya

On 2017/4/26 18:06, Lorenzo Pieralisi wrote:
> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
> host bridge registration to detect the NUMA node for a given
> struct pci_bus.dev. Implement an ACPI method that, through
> the struct pci_bus.bridge ACPI companion, retrieve and return
> the NUMA node corresponding to a given struct pci_bus.dev.
> 
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
>  include/linux/pci.h    |  6 ++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 0018603..915da79 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -10,6 +10,7 @@
>  #include <linux/delay.h>
>  #include <linux/init.h>
>  #include <linux/irqdomain.h>
> +#include <linux/numa.h>
>  #include <linux/pci.h>
>  #include <linux/msi.h>
>  #include <linux/pci_hotplug.h>
> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
>  	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
>  }
>  
> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> +{
> +	int node = NUMA_NO_NODE;
> +	struct device *bridge = get_device(bus->bridge);
> +
> +	if (!bridge)
> +		return node;
> +
> +	if (has_acpi_companion(bridge)) {
> +		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
> +
> +		node = acpi_get_node(adev->handle);
> +	}
> +
> +	put_device(bridge);
> +
> +	return node;
> +}
> +

It seems there is no function to call this, am I right?

Another question is that:
in the latest IORT revision C, "Proximity domain" has been added to the IORT spec.
So when we enable NUMA for a PCIe device, should we also consider this?

Thanks,
Zhou

>  static int __init acpi_pci_init(void)
>  {
>  	int ret;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 9e62462..b40d095 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
>  #endif
>  int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
>  #endif
> +#ifdef CONFIG_ACPI
> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
> +#else
> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> +{ return NUMA_NO_NODE; }
> +#endif
>  int pci_bus_find_numa_node(struct pci_bus *bus);
>  
>  /* some architectures require additional setup to direct VGA traffic */
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
  2017-05-15  6:13     ` Zhou Wang
  (?)
@ 2017-05-15  9:17     ` Lorenzo Pieralisi
  2017-05-16  3:22         ` Zhou Wang
  -1 siblings, 1 reply; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-05-15  9:17 UTC (permalink / raw)
  To: Zhou Wang
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

On Mon, May 15, 2017 at 02:13:47PM +0800, Zhou Wang wrote:
> On 2017/4/26 18:06, Lorenzo Pieralisi wrote:
> > The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
> > host bridge registration to detect the NUMA node for a given
> > struct pci_bus.dev. Implement an ACPI method that, through
> > the struct pci_bus.bridge ACPI companion, retrieve and return
> > the NUMA node corresponding to a given struct pci_bus.dev.
> > 
> > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > ---
> >  drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
> >  include/linux/pci.h    |  6 ++++++
> >  2 files changed, 26 insertions(+)
> > 
> > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> > index 0018603..915da79 100644
> > --- a/drivers/pci/pci-acpi.c
> > +++ b/drivers/pci/pci-acpi.c
> > @@ -10,6 +10,7 @@
> >  #include <linux/delay.h>
> >  #include <linux/init.h>
> >  #include <linux/irqdomain.h>
> > +#include <linux/numa.h>
> >  #include <linux/pci.h>
> >  #include <linux/msi.h>
> >  #include <linux/pci_hotplug.h>
> > @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
> >  	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
> >  }
> >  
> > +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> > +{
> > +	int node = NUMA_NO_NODE;
> > +	struct device *bridge = get_device(bus->bridge);
> > +
> > +	if (!bridge)
> > +		return node;
> > +
> > +	if (has_acpi_companion(bridge)) {
> > +		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
> > +
> > +		node = acpi_get_node(adev->handle);
> > +	}
> > +
> > +	put_device(bridge);
> > +
> > +	return node;
> > +}
> > +
> 
> It seems there is no function to call this, am I right?

Sorry, I missed updating pci_bus_find_numa_node() while reshuffling
the code, apologies.

I will repost shortly.

> Another question is that: in the latest IORT revision C, "Proximity
> domain" has been added to the IORT spec.  So when we enable NUMA for a
> PCIe device, should we also consider this?

That's for the SMMU device.

Lorenzo

> Thanks,
> Zhou
> 
> >  static int __init acpi_pci_init(void)
> >  {
> >  	int ret;
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 9e62462..b40d095 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
> >  #endif
> >  int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
> >  #endif
> > +#ifdef CONFIG_ACPI
> > +int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
> > +#else
> > +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> > +{ return NUMA_NO_NODE; }
> > +#endif
> >  int pci_bus_find_numa_node(struct pci_bus *bus);
> >  
> >  /* some architectures require additional setup to direct VGA traffic */
> > 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
  2017-05-12 17:18     ` Vadim Lomovtsev
@ 2017-05-15 12:57       ` Vadim Lomovtsev
  2017-05-15 13:05         ` Lorenzo Pieralisi
  0 siblings, 1 reply; 13+ messages in thread
From: Vadim Lomovtsev @ 2017-05-15 12:57 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya, Vadim.Lomovtsev

On Fri, May 12, 2017 at 10:18:46AM -0700, Vadim Lomovtsev wrote:
Hi Lorenzo,

> Hi Lorenzo
> 
> On Fri, May 12, 2017 at 04:50:40PM +0100, Lorenzo Pieralisi wrote:
> > Hi Vadim,
> > 
> > On Fri, May 12, 2017 at 05:44:05AM -0700, Vadim Lomovtsev wrote:
> > > Hi Lorenzo,
> > > 
> > > Are there any news related to these patches ?
> > 
> > Not really, I have not received any feedback but I was expecting some
> > to make progress here. Have you tested it ?
> >
> > Please let me know, thanks !
> 
> Not yet. Plan to test them after weekend and will get back to you.
>

Here is the results of testing you patches at dual-socketed board
with Cavium ThunderX SoC.

Each boot kernel boot with acpi=force argument.

1. The 4.12-rc1 couldn't find rootfs partition so can't be tested.
2.1  The 4.11 without your patch set 0 to numa node for pci device
  cat /sys/bus/pci/devices/*/numa_node
  got zeroes here for all devices
2.2 The 4.11 with your patches applied set -1 to numa_node for all pci devices
  same command provides "-1"

So looking at your patches..

At the patch 1/3 you implemented pci_bus_find_numa_node function:

+int pci_bus_find_numa_node(struct pci_bus *bus)
+{
+	return NUMA_NO_NODE;
+}

Then at the 2/3 patch it is called from pci_register_host_bridge:
@@ -770,6 +770,7 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
[..]
+	set_dev_node(&bus->dev, pci_bus_find_numa_node(bus));

I suppose that is why I'm seeing those -1 in the numa_node field.

And at the patch 3/3 you implemented acpi_pci_bus_find_numa_node function
 +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
which implements actual work of getting numa node value,
but it seems that nodoby calls it, isn't it ?

Don't we need to update pci_bus_find_numa_node with proper calling
of acpi_pci_bus_find_numa_node() ?

> > 
> > Lorenzo
> 
> WBR,
> Vadim

WBR,
Vadim

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node()
  2017-05-15 12:57       ` Vadim Lomovtsev
@ 2017-05-15 13:05         ` Lorenzo Pieralisi
  0 siblings, 0 replies; 13+ messages in thread
From: Lorenzo Pieralisi @ 2017-05-15 13:05 UTC (permalink / raw)
  To: Vadim Lomovtsev
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

On Mon, May 15, 2017 at 05:57:11AM -0700, Vadim Lomovtsev wrote:
> On Fri, May 12, 2017 at 10:18:46AM -0700, Vadim Lomovtsev wrote:
> Hi Lorenzo,
> 
> > Hi Lorenzo
> > 
> > On Fri, May 12, 2017 at 04:50:40PM +0100, Lorenzo Pieralisi wrote:
> > > Hi Vadim,
> > > 
> > > On Fri, May 12, 2017 at 05:44:05AM -0700, Vadim Lomovtsev wrote:
> > > > Hi Lorenzo,
> > > > 
> > > > Are there any news related to these patches ?
> > > 
> > > Not really, I have not received any feedback but I was expecting some
> > > to make progress here. Have you tested it ?
> > >
> > > Please let me know, thanks !
> > 
> > Not yet. Plan to test them after weekend and will get back to you.
> >
> 
> Here is the results of testing you patches at dual-socketed board
> with Cavium ThunderX SoC.
> 
> Each boot kernel boot with acpi=force argument.
> 
> 1. The 4.12-rc1 couldn't find rootfs partition so can't be tested.
> 2.1  The 4.11 without your patch set 0 to numa node for pci device
>   cat /sys/bus/pci/devices/*/numa_node
>   got zeroes here for all devices
> 2.2 The 4.11 with your patches applied set -1 to numa_node for all pci devices
>   same command provides "-1"
> 
> So looking at your patches..
> 
> At the patch 1/3 you implemented pci_bus_find_numa_node function:
> 
> +int pci_bus_find_numa_node(struct pci_bus *bus)
> +{
> +	return NUMA_NO_NODE;
> +}
> 
> Then at the 2/3 patch it is called from pci_register_host_bridge:
> @@ -770,6 +770,7 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
> [..]
> +	set_dev_node(&bus->dev, pci_bus_find_numa_node(bus));
> 
> I suppose that is why I'm seeing those -1 in the numa_node field.
> 
> And at the patch 3/3 you implemented acpi_pci_bus_find_numa_node function
>  +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
> which implements actual work of getting numa node value,
> but it seems that nodoby calls it, isn't it ?
> 
> Don't we need to update pci_bus_find_numa_node with proper calling
> of acpi_pci_bus_find_numa_node() ?

Yes:

https://lkml.org/lkml/2017/4/26/211

Apologies for wasting your time, v2 coming with the actual call,
please have a look.

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
  2017-05-15  9:17     ` Lorenzo Pieralisi
@ 2017-05-16  3:22         ` Zhou Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhou Wang @ 2017-05-16  3:22 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

On 2017/5/15 17:17, Lorenzo Pieralisi wrote:
> On Mon, May 15, 2017 at 02:13:47PM +0800, Zhou Wang wrote:
>> On 2017/4/26 18:06, Lorenzo Pieralisi wrote:
>>> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
>>> host bridge registration to detect the NUMA node for a given
>>> struct pci_bus.dev. Implement an ACPI method that, through
>>> the struct pci_bus.bridge ACPI companion, retrieve and return
>>> the NUMA node corresponding to a given struct pci_bus.dev.
>>>
>>> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>>> ---
>>>  drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
>>>  include/linux/pci.h    |  6 ++++++
>>>  2 files changed, 26 insertions(+)
>>>
>>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
>>> index 0018603..915da79 100644
>>> --- a/drivers/pci/pci-acpi.c
>>> +++ b/drivers/pci/pci-acpi.c
>>> @@ -10,6 +10,7 @@
>>>  #include <linux/delay.h>
>>>  #include <linux/init.h>
>>>  #include <linux/irqdomain.h>
>>> +#include <linux/numa.h>
>>>  #include <linux/pci.h>
>>>  #include <linux/msi.h>
>>>  #include <linux/pci_hotplug.h>
>>> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
>>>  	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
>>>  }
>>>  
>>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
>>> +{
>>> +	int node = NUMA_NO_NODE;
>>> +	struct device *bridge = get_device(bus->bridge);
>>> +
>>> +	if (!bridge)
>>> +		return node;
>>> +
>>> +	if (has_acpi_companion(bridge)) {
>>> +		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
>>> +
>>> +		node = acpi_get_node(adev->handle);
>>> +	}
>>> +
>>> +	put_device(bridge);
>>> +
>>> +	return node;
>>> +}
>>> +
>>
>> It seems there is no function to call this, am I right?
> 
> Sorry, I missed updating pci_bus_find_numa_node() while reshuffling
> the code, apologies.
> 
> I will repost shortly.
> 
>> Another question is that: in the latest IORT revision C, "Proximity
>> domain" has been added to the IORT spec.  So when we enable NUMA for a
>> PCIe device, should we also consider this?
> 
> That's for the SMMU device.

Sorry, this is another problem. Now I get it that this Proximity domain
is for SMMU itself.

Thanks,
Zhou

> 
> Lorenzo
> 
>> Thanks,
>> Zhou
>>
>>>  static int __init acpi_pci_init(void)
>>>  {
>>>  	int ret;
>>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>>> index 9e62462..b40d095 100644
>>> --- a/include/linux/pci.h
>>> +++ b/include/linux/pci.h
>>> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
>>>  #endif
>>>  int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
>>>  #endif
>>> +#ifdef CONFIG_ACPI
>>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
>>> +#else
>>> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
>>> +{ return NUMA_NO_NODE; }
>>> +#endif
>>>  int pci_bus_find_numa_node(struct pci_bus *bus);
>>>  
>>>  /* some architectures require additional setup to direct VGA traffic */
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation
@ 2017-05-16  3:22         ` Zhou Wang
  0 siblings, 0 replies; 13+ messages in thread
From: Zhou Wang @ 2017-05-16  3:22 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: linux-pci, linux-acpi, linux-kernel, Bjorn Helgaas,
	Sergey Temerkhanov, Sinan Kaya

On 2017/5/15 17:17, Lorenzo Pieralisi wrote:
> On Mon, May 15, 2017 at 02:13:47PM +0800, Zhou Wang wrote:
>> On 2017/4/26 18:06, Lorenzo Pieralisi wrote:
>>> The introduction of pci_bus_find_numa_node(pci_bus) allows at PCI
>>> host bridge registration to detect the NUMA node for a given
>>> struct pci_bus.dev. Implement an ACPI method that, through
>>> the struct pci_bus.bridge ACPI companion, retrieve and return
>>> the NUMA node corresponding to a given struct pci_bus.dev.
>>>
>>> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>>> ---
>>>  drivers/pci/pci-acpi.c | 20 ++++++++++++++++++++
>>>  include/linux/pci.h    |  6 ++++++
>>>  2 files changed, 26 insertions(+)
>>>
>>> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
>>> index 0018603..915da79 100644
>>> --- a/drivers/pci/pci-acpi.c
>>> +++ b/drivers/pci/pci-acpi.c
>>> @@ -10,6 +10,7 @@
>>>  #include <linux/delay.h>
>>>  #include <linux/init.h>
>>>  #include <linux/irqdomain.h>
>>> +#include <linux/numa.h>
>>>  #include <linux/pci.h>
>>>  #include <linux/msi.h>
>>>  #include <linux/pci_hotplug.h>
>>> @@ -853,6 +854,25 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
>>>  	return irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI);
>>>  }
>>>  
>>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
>>> +{
>>> +	int node = NUMA_NO_NODE;
>>> +	struct device *bridge = get_device(bus->bridge);
>>> +
>>> +	if (!bridge)
>>> +		return node;
>>> +
>>> +	if (has_acpi_companion(bridge)) {
>>> +		struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
>>> +
>>> +		node = acpi_get_node(adev->handle);
>>> +	}
>>> +
>>> +	put_device(bridge);
>>> +
>>> +	return node;
>>> +}
>>> +
>>
>> It seems there is no function to call this, am I right?
> 
> Sorry, I missed updating pci_bus_find_numa_node() while reshuffling
> the code, apologies.
> 
> I will repost shortly.
> 
>> Another question is that: in the latest IORT revision C, "Proximity
>> domain" has been added to the IORT spec.  So when we enable NUMA for a
>> PCIe device, should we also consider this?
> 
> That's for the SMMU device.

Sorry, this is another problem. Now I get it that this Proximity domain
is for SMMU itself.

Thanks,
Zhou

> 
> Lorenzo
> 
>> Thanks,
>> Zhou
>>
>>>  static int __init acpi_pci_init(void)
>>>  {
>>>  	int ret;
>>> diff --git a/include/linux/pci.h b/include/linux/pci.h
>>> index 9e62462..b40d095 100644
>>> --- a/include/linux/pci.h
>>> +++ b/include/linux/pci.h
>>> @@ -1481,6 +1481,12 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
>>>  #endif
>>>  int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
>>>  #endif
>>> +#ifdef CONFIG_ACPI
>>> +int acpi_pci_bus_find_numa_node(struct pci_bus *bus);
>>> +#else
>>> +static inline int acpi_pci_bus_find_numa_node(struct pci_bus *bus)
>>> +{ return NUMA_NO_NODE; }
>>> +#endif
>>>  int pci_bus_find_numa_node(struct pci_bus *bus);
>>>  
>>>  /* some architectures require additional setup to direct VGA traffic */
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-05-16  3:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26 10:06 [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Lorenzo Pieralisi
2017-04-26 10:06 ` [RFC/RFT PATCH 2/3] PCI: Add call to set-up NUMA node for struct pci_bus devices Lorenzo Pieralisi
2017-04-26 10:06 ` [RFC/RFT PATCH 3/3] PCI/ACPI: Add ACPI pci_bus_find_numa_node() implementation Lorenzo Pieralisi
2017-05-15  6:13   ` Zhou Wang
2017-05-15  6:13     ` Zhou Wang
2017-05-15  9:17     ` Lorenzo Pieralisi
2017-05-16  3:22       ` Zhou Wang
2017-05-16  3:22         ` Zhou Wang
2017-05-12 12:44 ` [RFC/RFT PATCH 1/3] PCI: Introduce pci_bus_find_numa_node() Vadim Lomovtsev
2017-05-12 15:50   ` Lorenzo Pieralisi
2017-05-12 17:18     ` Vadim Lomovtsev
2017-05-15 12:57       ` Vadim Lomovtsev
2017-05-15 13:05         ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.