|
[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
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |