|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: Set correct per-cpu cpu_core_mask
commit 701190abb3d5873cf77349b3d90bd11ded74871a
Author: Henry Wang <xin.wang2@xxxxxxx>
AuthorDate: Thu Mar 21 11:57:06 2024 +0800
Commit: Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri May 24 14:26:01 2024 +0100
xen/arm: Set correct per-cpu cpu_core_mask
In the common sysctl command XEN_SYSCTL_physinfo, the value of
cores_per_socket is calculated based on the cpu_core_mask of CPU0.
Currently on Arm this is a fixed value 1 (can be checked via xl info),
which is not correct. This is because during the Arm CPU online
process at boot time, setup_cpu_sibling_map() only sets the per-cpu
cpu_core_mask for itself.
cores_per_socket refers to the number of cores that belong to the same
socket (NUMA node). Currently Xen on Arm does not support physical
CPU hotplug and NUMA, also we assume there is no multithread. Therefore
cores_per_socket means all possible CPUs detected from the device
tree. Setting the per-cpu cpu_core_mask in setup_cpu_sibling_map()
accordingly. Modify the in-code comment which seems to be outdated. Add
a warning to users if Xen is running on processors with multithread
support.
Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
xen/arch/arm/smpboot.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 6efed87678..93a10d7721 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -67,7 +67,11 @@ static bool cpu_is_dead;
/* ID of the PCPU we're running on */
DEFINE_PER_CPU(unsigned int, cpu_id);
-/* XXX these seem awfully x86ish... */
+/*
+ * Although multithread is part of the Arm spec, there are not many
+ * processors supporting multithread and current Xen on Arm assumes there
+ * is no multithread.
+ */
/* representing HT siblings of each logical CPU */
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
/* representing HT and core siblings of each logical CPU */
@@ -86,9 +90,13 @@ static int setup_cpu_sibling_map(int cpu)
!zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
return -ENOMEM;
- /* A CPU is a sibling with itself and is always on its own core. */
+ /*
+ * Currently we assume there is no multithread and NUMA, so
+ * a CPU is a sibling with itself, and the all possible CPUs
+ * are supposed to belong to the same socket (NUMA node).
+ */
cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
- cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
+ cpumask_copy(per_cpu(cpu_core_mask, cpu), &cpu_possible_map);
return 0;
}
@@ -278,6 +286,10 @@ void __init smp_init_cpus(void)
warning_add("WARNING: HMP COMPUTING HAS BEEN ENABLED.\n"
"It has implications on the security and stability of the
system,\n"
"unless the cpu affinity of all domains is specified.\n");
+
+ if ( system_cpuinfo.mpidr.mt == 1 )
+ warning_add("WARNING: MULTITHREADING HAS BEEN DETECTED ON THE
PROCESSOR.\n"
+ "It might impact the security of the system.\n");
}
unsigned int __init smp_get_max_cpus(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |