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

[PATCH] xen/arm: Set correct per-cpu cpu_core_mask


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Mon, 26 Feb 2024 11:01:46 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sb+v1j9xyb+ru/VnYV1pVUwgPOA04LuMrPTFdg1rbn4=; b=Rw0wdxDknUavq/CDSAYI/tXLdpyd4cNJufEaDiaG3VaDtaw81kprJEY0eS0gnrYIxkp/6uEE8QdDruNqwkXBcNci32Uuu8PP6QoRG0NgFow7tbLhx3hCSYjXScw1bwwPeDz6Zb7l0aaw/yLX7IOVOsWea4cO9LzpJewVrH6ZPP1j+IQAkJQ5firhBmGCMUS1R8mVjgLyDTcgnVwlv4ifTYBLhBC4/Wpv5LCy9eq1r12HmGkR+0dOUQ/pXXQ1itfTbDYJiLXcFW2kLDNvhyLvS8x9zxy9SN0DbHDqrsSfiH5dvJcmAhsClvzr9BBmj/ah7mB2H5ltUZ6JAW1/zG7vhg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fLGKUXYMu+28U4BGUOgJ67q9z2lePw+QZx4RmDiLCps4THboznNFCHg3gkJERS2yRdPL060RIKby4QbqgpNNDdA/wfz5kW2r1k0G9SQuxhIf3BVXeRJx57Bju1KjTwSv3orCLq6GQMm0Zmcv/z5YMreo07Alc45NJDS+XPRFWOvHnWPclr3uUX3nW/BSsI+B5pD6juEdjs+zS1Dncrt9hoeLtorNAyO6G3KJEfT266t7JkeMXevg8MKU4Ierx0ymSX4Tcqkcq8aNFt97AfO1MsEuxVbDnnUu4HSR8pNI0Ay7MulfoIXmkeUFwIxqzVWwxKbf/eD2Bm2v3alyS8s+/Q==
  • Cc: Henry Wang <xin.wang2@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 26 Feb 2024 03:02:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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. Therefore if the MT bit (bit 24) in MPIDR_EL1
is 0, 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. Drop the in-code comment which seems to be outdated.

Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
---
 xen/arch/arm/smpboot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index a84e706d77..d616778655 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -66,7 +66,6 @@ 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... */
 /* 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 */
@@ -89,6 +88,11 @@ static int setup_cpu_sibling_map(int cpu)
     cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
     cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
 
+    /* PE not implemented using a multithreading type approach. */
+    if ( system_cpuinfo.mpidr.mt == 0 )
+        cpumask_or(per_cpu(cpu_core_mask, cpu),
+                   per_cpu(cpu_core_mask, cpu), &cpu_possible_map);
+
     return 0;
 }
 
-- 
2.34.1




 


Rackspace

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