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

[PATCH 1/3] tools/libxl: don't rely on xc_vcpu_setaffinity() returned cpumaps


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Juergen Gross <jgross@xxxxxxxx>
  • Date: Wed, 1 Jul 2026 13:16:04 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=susede1 header.d=suse.com header.i="@suse.com" header.h="From:Date:Message-ID:To:Cc:MIME-Version:Content-Transfer-Encoding:In-Reply-To:References"; dkim=pass header.s=susede1 header.d=suse.com header.i="@suse.com" header.h="From:Date:Message-ID:To:Cc:MIME-Version:Content-Transfer-Encoding:In-Reply-To:References"
  • Authentication-results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=JhVt65x1
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 01 Jul 2026 11:16:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In order to prepare for XEN_DOMCTL_setvcpuaffinity no longer returning
the effective affinity settings, use xc_vcpu_getaffinity() for getting
the effective affinities after having set them.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libs/light/libxl_sched.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libs/light/libxl_sched.c b/tools/libs/light/libxl_sched.c
index 2d6635dae7..2f6a70aef5 100644
--- a/tools/libs/light/libxl_sched.c
+++ b/tools/libs/light/libxl_sched.c
@@ -69,6 +69,15 @@ static int libxl__set_vcpuaffinity(libxl_ctx *ctx, uint32_t 
domid,
      * is possible that Xen will use something different from what we asked
      * for various reasons. If that's the case, report it.
      */
+    if ((cpumap_hard || cpumap_soft) &&
+        xc_vcpu_getaffinity(ctx->xch, domid, vcpuid,
+                            cpumap_hard ? hard.map : NULL,
+                            cpumap_soft ? soft.map : NULL,
+                            flags & ~XEN_VCPUAFFINITY_FORCE)) {
+        LOGED(ERROR, domid, "Checking vcpu affinity");
+        rc = ERROR_FAIL;
+        goto out;
+    }
     if (cpumap_hard &&
         !libxl_bitmap_equal(cpumap_hard, &hard, 0))
         LOGD(DEBUG, domid, "New hard affinity for vcpu %d has unreachable 
cpus", vcpuid);
-- 
2.54.0




 


Rackspace

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