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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Wed, 28 Feb 2024 09:58:22 +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=7st0nfvYqfoUDlhUdhHj6eV1a5dpb/v+ibFIxsOD8gg=; b=nHJa4MeMmjA2/OEv736MOubOOqWEwPPRfVsnghcPZjzeReQz05Hp/gAOuYflQuwRD9NYGmIP6QYtTJF1Kp04+NSo61uuUcyImgk2wZASVnMxyDC54f15Ek5DCJCDtqJxusTioRwnUgfdNoKOV3mPGDdnfsPNwZnd9Vn0GMtxHrQ0yAz0l29F9dnSDtw3N4EvKq31iyDmHfs7EwRQ/m8ZHrWNzdyatyXD73W9UzKXM+h/jZkqaSjw7jF2m8dFLiB7FMnJoEQIJsEh2TQaqpFr5pz4MkJTqysHrUJDbxqEx9wLs2ldItN+wB9F8Xj82/tXSWJKCpTnjgCZVexxvQspjg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H6H+WbmxVg3p/IEnPkklGZ2IpZZy2Nces89eg20oviLGWv6opACTRzh2fN3Sa1oFgAmO1L4yH6VGgXINsPI4AA+O4mEpI4jLU5y0sbZk8ThTeeturMf/R5ioxF44y6Sjtg4QYW7cuZRVr1k4Af5jlkTPKBSCeaFHZ//Pi+A6ROb2IZqOvNM0z49OD/VwuA8bJFilkIpChQ9z/9Jf9xHtqsgxlOtlGQEtOimur6emVoCMF6IkwrX7lbLFtOeYpIiG4Ke0G8F+5vkBEJXhTn7W19y98+9okJA04sGX5qRzItX/nPdz0yexT+jsith1SDmZZ4J0NR96kRjnpTfp8GNaeQ==
  • 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>, Henry Wang <Henry.Wang@xxxxxxx>
  • Delivery-date: Wed, 28 Feb 2024 01:59:08 +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, 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. Drop the in-code comment which seems to be outdated.

Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
---
v2:
- Do not do the multithread check.
---
 xen/arch/arm/smpboot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index a84e706d77..d9ebd55d4a 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,10 @@ 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));
 
+    /* Currently we assume there is no multithread. */
+    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®.