Skip to contentSkip to conversation

arm64: acpi: Support PCI devices numa_node property in ACPI mode

PATCH Sinan Kaya 2 participants 4 messages Apr 8, 2017 – Apr 12, 2017 ACPI

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

Review

Quoted 9 lines · On 12/31/1969 7:00 PM, linux-arm-kernel [mailto:linux-arm-kernel-bounces@lists.…

int pcibus_to_node(struct pci_bus *bus) {

(quoted diff) +7 -1
-	return dev_to_node(&bus->dev);
+	struct pci_config_window *cfg = bus->sysdata;
+	struct acpi_device *adev = NULL;
+	struct device *dev;
+
+	if (!acpi_disabled)
+		adev = to_acpi_device(cfg->parent);
+

I see a problem here that NUMA node information is read from the parent device. PCI bus can have multiple levels of switches and bridges. The NUMA information is only present on the host bridge.

This code only works if the endpoint is directly connected to the root port.

You should follow a similar design pattern like pci_dma_configure() where you go to the host bridge device from any pci device and read the _PXM from the host bridge.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw
Quoted 15 lines · Sinan Kaya

Review

Quoted 9 lines · On 12/31/1969 7:00 PM, linux-arm-kernel [mailto:linux-arm-kernel-bounces@lists.…

int pcibus_to_node(struct pci_bus *bus) {

(quoted diff) +7 -1
-	return dev_to_node(&bus->dev);
+	struct pci_config_window *cfg = bus->sysdata;
+	struct acpi_device *adev = NULL;
+	struct device *dev;
+
+	if (!acpi_disabled)
+		adev = to_acpi_device(cfg->parent);
+

I see a problem here that NUMA node information is read from the parent device. PCI bus can have multiple levels of switches and bridges. The NUMA information is only present on the host bridge.

Quoted 2 lines

This code only works if the endpoint is directly connected to the root port.

That's not what this code does. This code retrieves the struct device backing the ACPI device representing the PNP0A08 host bridge and its dev->numa_node value (that was set in pci_acpi_scan_root()).

I am not a big fan of this. I wonder if we could not make it DT/ACPI agnostic by simply setting the numa_node in the pci_bus->dev field, and propagate it downstream a PCI hierarcy (as we do with sysdata) in pci_alloc_child_bus().

This way pcibus_to_node() would become straightforward (ie as it is now - provided the above is doable):

dev_to_node(&bus->dev);

This is suspiciously similar to the domain number song and dance except that the NUMA node now is in the struct pci_bus->dev->numa_node instead of struct pci_bus->domain_nr.

Lorenzo

author
#2 lore raw

Hi Lorenzo,

Quoted 16 lines · Lorenzo Pieralisi
Quoted 15 lines · Sinan Kaya

Review

Quoted 9 lines · On 12/31/1969 7:00 PM, linux-arm-kernel [mailto:linux-arm-kernel-bounces at…

int pcibus_to_node(struct pci_bus *bus) {

(quoted diff) +7 -1
-	return dev_to_node(&bus->dev);
+	struct pci_config_window *cfg = bus->sysdata;
+	struct acpi_device *adev = NULL;
+	struct device *dev;
+
+	if (!acpi_disabled)
+		adev = to_acpi_device(cfg->parent);
+

I see a problem here that NUMA node information is read from the parent device. PCI bus can have multiple levels of switches and bridges. The NUMA information is only present on the host bridge.

Quoted 6 lines
Quoted 2 lines

This code only works if the endpoint is directly connected to the root port.

That's not what this code does. This code retrieves the struct device backing the ACPI device representing the PNP0A08 host bridge and its dev->numa_node value (that was set in pci_acpi_scan_root()).

pcibus_to_node() gets called from two places. The first place is pci_register_host_bridge() like you mentioned.

The second place is pci_device_add(). pci_device_add() gets called for every single device that is getting added to the system.

Quoted 5 lines

I am not a big fan of this. I wonder if we could not make it DT/ACPI agnostic by simply setting the numa_node in the pci_bus->dev field, and propagate it downstream a PCI hierarcy (as we do with sysdata) in pci_alloc_child_bus().

Yeah, that's what I was going to ask next about how other arches solve this. Common solution to DT/ACPI is preferable as the issue exists in both places unless DT has some other mechanism hidden behind the scenes.

Quoted 9 lines

This way pcibus_to_node() would become straightforward (ie as it is now - provided the above is doable):

dev_to_node(&bus->dev);

This is suspiciously similar to the domain number song and dance except that the NUMA node now is in the struct pci_bus->dev->numa_node instead of struct pci_bus->domain_nr.

I think this looks like the _CCA dance we are doing.

Quoted 3 lines

Lorenzo

Sinan

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#3 lore raw
Quoted 4 lines · Sinan Kaya

I am not a big fan of this. I wonder if we could not make it DT/ACPI agnostic by simply setting the numa_node in the pci_bus->dev field, and propagate it downstream a PCI hierarcy (as we do with sysdata) in pci_alloc_child_bus().

I didn't realize that we were pushing sysdata to the child buses. No issues then.

I was under the impression that sysdata only existed for the host bridge itself and was not shared with the rest of the bus.

Signature · 3 lines
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.