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

[PATCH 27/37] xen/arm: Add boot and secondary CPU to NUMA system


  • To: <wei.chen@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Thu, 23 Sep 2021 20:02:26 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cQXv12XCrC0ornD3XLR6+SrgHIB9Pxv0AYpsZjKo72M=; b=Gks5zDlFNm1dO2scoCgfCfycFecaKUXENm4ME4iqs552H6lu8DGD7TQTT8Q/5bPVn9CTXjxeH+RwHGdp3qdOHDz0gjZHBOq9a0Q7GqlIQaAV3bQOFuDF/C3/VEUbf1iLEO9HLzfkwEa72ePbFr3vs16k8oZk3XGlizZLhcE5Yd2nltnzE0auUVtUWdzSNkyKR7pqur2/fmWuSWNGs5Z1W+bcJh+ni+suMP77i0RBkDinsChGdtztBTmmPelWPuxmxFKdqU4xUvLV/Ot6NUubWl8mkUQCxOgkX8dxKfI0l4B3u0E/Q1qgmrnMFHpjQ7lMNV2WA0vx5ZgGX2cH5NqSWA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UxmubAxpGvAIsBj3jW5/TAqbSDAoE+BYSSbXcCaiJpCNqRp+GIHVmSm6mzd58y0ktGYzOiDeREQrvfyaHQEA/RM4qXhARyqSYcSGJv61VsfvD/Req4Tx5sr66iqNO3z/zR8xoFc0+mEobvHRyv9T7zDKZ/ev59kZFH3NU0ss5JrBSgiPzmAYWJY9OYYoqZUn5Qt/FBKPH17rd7mm1EzADuz/8BApzQP2Pg3BF2y6LzI8ylVeiQ8y2rTRMa8JwP1tDTZKdJYzak5g4o85EFNMkK82U+cSUTwKT442lsQbhT02vUeztHVHSEhCATbUSHpFjfE7ldJBOqR38CZPeWe4wg==
  • Cc: <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 12:17:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

In this patch, we make NUMA node online and add cpu to
its NUMA node. This will make NUMA-aware components
have NUMA affinity data to support their work.

To keep the mostly the same behavior of x86, we still use
srat_detect_node to online node. The difference is that,
we have prepared cpu_to_node in dt_smp_init_cpus, so we
don't need to setup cpu_to_node in srat_detect_node.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
 xen/arch/arm/numa.c        | 10 ++++++++++
 xen/arch/arm/setup.c       |  5 +++++
 xen/include/asm-arm/numa.h | 10 ++++++++++
 3 files changed, 25 insertions(+)

diff --git a/xen/arch/arm/numa.c b/xen/arch/arm/numa.c
index 5209d3de4d..7f05299b76 100644
--- a/xen/arch/arm/numa.c
+++ b/xen/arch/arm/numa.c
@@ -32,6 +32,16 @@ __init void bad_srat(void)
     fw_numa = -1;
 }
 
+void srat_detect_node(int cpu)
+{
+    nodeid_t node = cpu_to_node[cpu];
+
+    if ( node == NUMA_NO_NODE )
+        node = 0;
+
+    node_set_online(node);
+}
+
 void __init numa_set_distance(nodeid_t from, nodeid_t to, uint32_t distance)
 {
     if ( from >= MAX_NUMNODES || to >= MAX_NUMNODES )
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 49dc90d198..1f0fbc95b5 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -988,6 +988,11 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     for_each_present_cpu ( i )
     {
+        /* Detect and online node based on cpu_to_node[] */
+        srat_detect_node(i);
+        /* Set up node_to_cpumask based on cpu_to_node[]. */
+        numa_add_cpu(i);
+
         if ( (num_online_cpus() < cpus) && !cpu_online(i) )
         {
             int ret = cpu_up(i);
diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h
index 8a4ad379e0..7675012cb7 100644
--- a/xen/include/asm-arm/numa.h
+++ b/xen/include/asm-arm/numa.h
@@ -46,11 +46,21 @@ extern mfn_t first_valid_mfn;
 #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
 #define __node_distance(a, b) (20)
 
+static inline void numa_add_cpu(int cpu)
+{
+
+}
+
 static inline void numa_set_node(int cpu, nodeid_t node)
 {
 
 }
 
+static inline void srat_detect_node(int cpu)
+{
+
+}
+
 #endif
 
 static inline unsigned int arch_have_default_dmazone(void)
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.