Skip to content

Commit 35b5e07

Browse files
committed
Merge: Updates for numa node if PHB is attached
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4795 Description: Updates for numa node if PHB is attached JIRA: https://issues.redhat.com/browse/RHEL-50147 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=62823584 Tested: Verified Brew build test kernel RPMs and confirmed issue is resovled Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> commit 1198181 Author: Nilay Shroff <nilay@linux.ibm.com> Date: Fri May 17 19:55:23 2024 +0530 powerpc/numa: Online a node if PHB is attached. In the current design, a numa-node is made online only if that node is attached to cpu/memory. With this design, if any PCI/IO device is found to be attached to a numa-node which is not online then the numa-node id of the corresponding PCI/IO device is set to NUMA_NO_NODE(-1). This design may negatively impact the performance of PCIe device if the numa-node assigned to PCIe device is -1 because in such case we may not be able to accurately calculate the distance between two nodes. The multi-controller NVMe PCIe disk has an issue with calculating the node distance if the PCIe NVMe controller is attached to a PCI host bridge which has numa-node id value set to NUMA_NO_NODE. This patch helps fix this ensuring that a cpu/memory less numa node is made online if it's attached to PCI host bridge. Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240517142531.3273464-3-nilay@linux.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Rafael Aquini <aquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 8e1f4b3 + 9c4a6e0 commit 35b5e07

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

arch/powerpc/mm/numa.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ static int __init numa_setup_drmem_lmb(struct drmem_lmb *lmb,
895895

896896
static int __init parse_numa_properties(void)
897897
{
898-
struct device_node *memory;
898+
struct device_node *memory, *pci;
899899
int default_nid = 0;
900900
unsigned long i;
901901
const __be32 *associativity;
@@ -1009,6 +1009,18 @@ static int __init parse_numa_properties(void)
10091009
goto new_range;
10101010
}
10111011

1012+
for_each_node_by_name(pci, "pci") {
1013+
int nid = NUMA_NO_NODE;
1014+
1015+
associativity = of_get_associativity(pci);
1016+
if (associativity) {
1017+
nid = associativity_to_nid(associativity);
1018+
initialize_form1_numa_distance(associativity);
1019+
}
1020+
if (likely(nid >= 0) && !node_online(nid))
1021+
node_set_online(nid);
1022+
}
1023+
10121024
/*
10131025
* Now do the same thing for each MEMBLOCK listed in the
10141026
* ibm,dynamic-memory property in the

arch/powerpc/platforms/pseries/pci_dlpar.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <linux/pci.h>
1313
#include <linux/export.h>
14+
#include <linux/node.h>
1415
#include <asm/pci-bridge.h>
1516
#include <asm/ppc-pci.h>
1617
#include <asm/firmware.h>
@@ -21,9 +22,22 @@
2122
struct pci_controller *init_phb_dynamic(struct device_node *dn)
2223
{
2324
struct pci_controller *phb;
25+
int nid;
2426

2527
pr_debug("PCI: Initializing new hotplug PHB %pOF\n", dn);
2628

29+
nid = of_node_to_nid(dn);
30+
if (likely((nid) >= 0)) {
31+
if (!node_online(nid)) {
32+
if (__register_one_node(nid)) {
33+
pr_err("PCI: Failed to register node %d\n", nid);
34+
} else {
35+
update_numa_distance(dn);
36+
node_set_online(nid);
37+
}
38+
}
39+
}
40+
2741
phb = pcibios_alloc_controller(dn);
2842
if (!phb)
2943
return NULL;

0 commit comments

Comments
 (0)