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

[PATCH 3/3] tools/libxenctrl: rename parameters of xc_vcpu_setaffinity()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Juergen Gross <jgross@xxxxxxxx>
  • Date: Wed, 1 Jul 2026 13:16:06 +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-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=hs6Tvoas
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 01 Jul 2026 11:16:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The cpumaps passed to xc_vcpu_setaffinity() are input-only now, so
drop the "_inout" suffix from their names and make them const.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/include/xenctrl.h     | 26 ++++++--------------------
 tools/libs/ctrl/xc_domain.c | 26 ++++++++++++--------------
 2 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index d5dbf69c89..96fb0cc81f 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -590,37 +590,23 @@ int xc_domain_node_getaffinity(xc_interface *xch,
  * There are two kinds of affinity. Soft affinity is on what CPUs a vcpu
  * prefers to run. Hard affinity is on what CPUs a vcpu is allowed to run.
  * If flags contains XEN_VCPUAFFINITY_SOFT, the soft affinity it is set to
- * what cpumap_soft_inout contains. If flags contains XEN_VCPUAFFINITY_HARD,
- * the hard affinity is set to what cpumap_hard_inout contains. Both flags
+ * what cpumap_soft contains. If flags contains XEN_VCPUAFFINITY_HARD,
+ * the hard affinity is set to what cpumap_hard contains. Both flags
  * can be set at the same time, in which case both soft and hard affinity are
  * set to what the respective parameter contains.
  *
- * The function also returns the effective hard or/and soft affinity, still
- * via the cpumap_soft_inout and cpumap_hard_inout parameters. Effective
- * affinity is, in case of soft affinity, the intersection of soft affinity,
- * hard affinity and the cpupool's online CPUs for the domain, and is returned
- * in cpumap_soft_inout, if XEN_VCPUAFFINITY_SOFT is set in flags. In case of
- * hard affinity, it is the intersection between hard affinity and the
- * cpupool's online CPUs, and is returned in cpumap_hard_inout, if
- * XEN_VCPUAFFINITY_HARD is set in flags. If both flags are set, both soft
- * and hard affinity are returned in the respective parameter.
- *
- * We do report it back as effective affinity is what the Xen scheduler will
- * actually use, and we thus allow checking whether or not that matches with,
- * or at least is good enough for, the caller's purposes.
- *
  * @param xch a handle to an open hypervisor interface.
  * @param domid the id of the domain to which the vcpu belongs
  * @param vcpu the vcpu id wihin the domain
- * @param cpumap_hard_inout specifies(/returns) the (effective) hard affinity
- * @param cpumap_soft_inout specifies(/returns) the (effective) soft affinity
+ * @param cpumap_hard specifies the hard affinity
+ * @param cpumap_soft specifies the soft affinity
  * @param flags what we want to set
  */
 int xc_vcpu_setaffinity(xc_interface *xch,
                         uint32_t domid,
                         int vcpu,
-                        xc_cpumap_t cpumap_hard_inout,
-                        xc_cpumap_t cpumap_soft_inout,
+                        const xc_cpumap_t cpumap_hard,
+                        const xc_cpumap_t cpumap_soft,
                         uint32_t flags);
 
 /**
diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index 01c0669c88..3ee0e43ea5 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -199,15 +199,13 @@ int xc_domain_node_getaffinity(xc_interface *xch,
 int xc_vcpu_setaffinity(xc_interface *xch,
                         uint32_t domid,
                         int vcpu,
-                        xc_cpumap_t cpumap_hard_inout,
-                        xc_cpumap_t cpumap_soft_inout,
+                        const xc_cpumap_t cpumap_hard,
+                        const xc_cpumap_t cpumap_soft,
                         uint32_t flags)
 {
     struct xen_domctl domctl = {};
-    DECLARE_HYPERCALL_BOUNCE(cpumap_hard_inout, 0,
-                             XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
-    DECLARE_HYPERCALL_BOUNCE(cpumap_soft_inout, 0,
-                             XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+    DECLARE_HYPERCALL_BOUNCE(cpumap_hard, 0, XC_HYPERCALL_BUFFER_BOUNCE_IN);
+    DECLARE_HYPERCALL_BOUNCE(cpumap_soft, 0, XC_HYPERCALL_BUFFER_BOUNCE_IN);
     int ret = -1;
     int cpusize;
 
@@ -218,11 +216,11 @@ int xc_vcpu_setaffinity(xc_interface *xch,
         return -1;
     }
 
-    HYPERCALL_BOUNCE_SET_SIZE(cpumap_hard_inout, cpusize);
-    HYPERCALL_BOUNCE_SET_SIZE(cpumap_soft_inout, cpusize);
+    HYPERCALL_BOUNCE_SET_SIZE(cpumap_hard, cpusize);
+    HYPERCALL_BOUNCE_SET_SIZE(cpumap_soft, cpusize);
 
-    if ( xc_hypercall_bounce_pre(xch, cpumap_hard_inout) ||
-         xc_hypercall_bounce_pre(xch, cpumap_soft_inout) )
+    if ( xc_hypercall_bounce_pre(xch, cpumap_hard) ||
+         xc_hypercall_bounce_pre(xch, cpumap_soft) )
     {
         PERROR("Could not allocate hcall buffers for DOMCTL_setvcpuaffinity");
         goto out;
@@ -234,17 +232,17 @@ int xc_vcpu_setaffinity(xc_interface *xch,
     domctl.u.vcpuaffinity.flags = flags;
 
     set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap_hard.bitmap,
-                         cpumap_hard_inout);
+                         cpumap_hard);
     domctl.u.vcpuaffinity.cpumap_hard.nr_bits = cpusize * 8;
     set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap_soft.bitmap,
-                         cpumap_soft_inout);
+                         cpumap_soft);
     domctl.u.vcpuaffinity.cpumap_soft.nr_bits = cpusize * 8;
 
     ret = do_domctl(xch, &domctl);
 
  out:
-    xc_hypercall_bounce_post(xch, cpumap_hard_inout);
-    xc_hypercall_bounce_post(xch, cpumap_soft_inout);
+    xc_hypercall_bounce_post(xch, cpumap_hard);
+    xc_hypercall_bounce_post(xch, cpumap_soft);
 
     return ret;
 }
-- 
2.54.0




 


Rackspace

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