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

[PATCH v3 02/22] xen/common: Default function to get the distance between nodes


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 19 Jun 2026 16:49:50 +0900
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0gX9ub+anZt6eauwPAi4d+qchhQS98QP4fnLa+KEekc=; b=cmQjcyKWRQRFWjoZvkN4S0XeHX8iohSPOISRqaNPPySG0tCrZlzqLlhdqhyK9B5GUzWrmQBUcVC5EgOqfbOorh32KwST6/1gtgYbYebxtRyfnDszbjV8Vml+qG8gETXBjz9Gha3alx5Hpv5vjATtoBlEZkktfpQPyxZTBTVcWtt+Kcv1YAX3gwXeBljRYZ9mF/IxrBlEetAC6EB1CJ7dWbHb/qvz7xBwmmRlpBSk2rnF3zPUagrc+pGkwWOgB7dGpaEDJbzfgIX2BhA3FzVBJ9IzyeDqzuBnP2gtF/x+Nz3bHL6Rv6Q6Lt19R0JBntPT/8KrR8sQQgI76zEh3/Oy9g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=an0SHIvXGtr7PgBhjOpCm8i5z5NMtz2r8h+yUEcwpCu9XhuhbjUTIxvwF26OpN1aUFZ0Z738dMLmxaOotOTRgO1X3P7m3ZVoZ/eCwpeljX8eio17bL3yIrXxoP6s4dznQUNCBJAn+Y33s0gl7CIt6HVE39RV3EHZ38739J0dftorNJcK6fH6yF/Y629GLnoujiorfUWwEVE5hnwgO0ig/HqWDjTJNuyy0jDb8Qrye/zg1zoZfMa3GZv/amNwLuBx7jccAkrYrE7KLN2M4N0V+S9lLG+WiAsHpy53DEiOkTGCe6FsJEPH2lPfNi0INZAwOUNG84Kdhe/ToX/iT9SHwA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 19 Jun 2026 07:50:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Provide a fallback function to get the distance between NUMA nodes.

Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
---
 xen/common/Makefile            |  1 +
 xen/common/numa-distance-map.c | 19 +++++++++++++++++++
 xen/include/xen/numa.h         |  2 ++
 3 files changed, 22 insertions(+)
 create mode 100644 xen/common/numa-distance-map.c

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 6018e25614..062f9ab72b 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += multicall.o
 obj-y += notifier.o
 obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_NUMA_DISTANCE_MAP) += numa-distance-map.o
 obj-y += page_alloc.o
 obj-y += pdx.o
 obj-y += percpu.o
diff --git a/xen/common/numa-distance-map.c b/xen/common/numa-distance-map.c
new file mode 100644
index 0000000000..73344f7f33
--- /dev/null
+++ b/xen/common/numa-distance-map.c
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
+
+#define LOCAL_DISTANCE      10
+#define REMOTE_DISTANCE     20
+
+/*
+ * Get the distance between node 'from' and node 'to'.
+ */
+uint8_t numa_node_distance(unsigned int from, unsigned int to)
+{
+    if ( from != to )
+        return REMOTE_DISTANCE;
+    return LOCAL_DISTANCE;
+}
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index f6c1f27ca1..18c22d3d30 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -128,6 +128,8 @@ extern bool numa_update_node_memblks(nodeid_t node, 
unsigned int arch_nid,
                                      paddr_t start, paddr_t size, bool 
hotplug);
 extern void numa_set_processor_nodes_parsed(nodeid_t node);
 
+extern uint8_t numa_node_distance(unsigned int from, unsigned int to);
+
 #else
 
 /* Fake one node for now. See also node_online_map. */
-- 
2.43.0




 


Rackspace

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