All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Anthony PERARD <anthony.perard@vates.tech>
Subject: [PATCH 3/3] tools/libxenctrl: rename parameters of xc_vcpu_setaffinity()
Date: Wed,  1 Jul 2026 13:16:06 +0200	[thread overview]
Message-ID: <20260701111606.4063972-4-jgross@suse.com> (raw)
In-Reply-To: <20260701111606.4063972-1-jgross@suse.com>

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@suse.com>
---
 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



  parent reply	other threads:[~2026-07-01 11:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 11:16 [PATCH 0/3] Change XEN_DOMCTL_setvcpuaffinity interface Juergen Gross
2026-07-01 11:16 ` [PATCH 1/3] tools/libxl: don't rely on xc_vcpu_setaffinity() returned cpumaps Juergen Gross
2026-07-01 11:16 ` [PATCH 2/3] xen: don't let XEN_DOMCTL_setvcpuaffinity return the new affinities Juergen Gross
2026-07-01 11:16 ` Juergen Gross [this message]
2026-07-01 11:39 ` [PATCH 0/3] Change XEN_DOMCTL_setvcpuaffinity interface Jan Beulich
2026-07-01 11:45   ` Andrew Cooper
2026-07-01 13:00     ` Jürgen Groß
2026-07-01 13:08   ` Jürgen Groß
2026-07-01 13:48     ` Jan Beulich
2026-07-01 14:19       ` Jürgen Groß
2026-07-01 15:34   ` Juergen Gross
2026-07-02  5:54     ` Jan Beulich
2026-07-02  6:13       ` Jürgen Groß
2026-07-02  6:25         ` Jan Beulich
2026-07-02  6:30           ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260701111606.4063972-4-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=anthony.perard@vates.tech \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.