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

Re: [Xen-devel] [PATCH v3 10/14] libxc: get and set soft and hard affinity

On 11/19/2013 02:57 PM, Ian Campbell wrote:
On Tue, 2013-11-19 at 14:51 +0000, George Dunlap wrote:
On 11/18/2013 06:18 PM, Dario Faggioli wrote:
by using the new flag introduced in the parameters of the
DOMCTL_{get,set}_vcpuaffinity hypercall.

This happens by adding a new parameter (flags) to
xc_vcpu_setaffinity() and xc_vcpu_getaffinity(), so that the
caller can decide to set either the soft or hard affinity, or
even both.

In case of setting both hard and soft, they are set to the
same cpumap. xc_get_setaffinity() also takes another new param,
for reporting back to the caller what the actual affinity the
scheduler uses will be after a successful call.
In case of asking to get both hard and soft, what the caller
gets is the intersection between them.

In-tree callers are also fixed to cope with the new interface.

Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>

Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>


Changes from v2:
   * better cleanup logic in _vcpu_setaffinity() (regarding
     xc_hypercall_buffer_{alloc,free}()), as suggested during
   * make it more evident that DOMCTL_setvcpuaffinity has an out
     parameter, by calling ecpumap_out, and improving the comment
     wrt that;
   * change the interface and have xc_vcpu_[sg]etaffinity() so
     that they take the new parameters (flags and ecpumap_out) and
     fix the in tree callers.
   tools/libxc/xc_domain.c             |   47 
   tools/libxc/xenctrl.h               |   44 ++++++++++++++++++++++++++++++++-
   tools/libxl/libxl.c                 |    7 ++++-
   tools/ocaml/libs/xc/xenctrl_stubs.c |    8 ++++--
   tools/python/xen/lowlevel/xc/xc.c   |    6 +++-
   5 files changed, 86 insertions(+), 26 deletions(-)

diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index f9ae4bf..bddf4e0 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -192,44 +192,52 @@ int xc_domain_node_getaffinity(xc_interface *xch,
   int xc_vcpu_setaffinity(xc_interface *xch,
                           uint32_t domid,
                           int vcpu,
-                        xc_cpumap_t cpumap)
+                        xc_cpumap_t cpumap,
+                        uint32_t flags,
+                        xc_cpumap_t ecpumap_out)
-    DECLARE_HYPERCALL_BUFFER(uint8_t, local);
+    DECLARE_HYPERCALL_BUFFER(uint8_t, cpumap_local);
+    DECLARE_HYPERCALL_BUFFER(uint8_t, ecpumap_local);
       int ret = -1;
       int cpusize;

       cpusize = xc_get_cpumap_size(xch);
-    if (!cpusize)
+    if ( !cpusize )

I know IanJ will have something to say about non-snuggly braces here and
below. :-)

The spaces are legit in libxc I think, it uses Xen coding style. It's
libxl which differs...

OK -- I just happened to see snuggly braces elsewhere in the file when I took a quick glance around. It has my Ack either way.


Xen-devel mailing list



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