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

[Xen-devel] [PATCH for-4.5] xen: vnuma: expose vnode_to_pnode to guest



This information is passed in in domctl hypercall but the guest
interface doesn't expose it to guest. PV NUMA-aware ballooning relies on
this piece of information to function properly.

Also fixed one typo while I was there.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Elena Ufimtseva <ufimtseva@xxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Konrad Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
---
 xen/common/memory.c         |   13 +++++++++++--
 xen/include/public/memory.h |    4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index cc36e39..fde03dc 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1013,7 +1013,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         /*
          * Copied from guest values may differ from domain vnuma config.
          * Check here guest parameters make sure we dont overflow.
-         * Additionaly check padding.
+         * Additionally check padding.
          */
         if ( topology.nr_vnodes < dom_vnodes      ||
              topology.nr_vcpus < dom_vcpus        ||
@@ -1035,10 +1035,12 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         tmp.vdistance = xmalloc_array(unsigned int, dom_vnodes * dom_vnodes);
         tmp.vmemrange = xmalloc_array(vmemrange_t, dom_vranges);
         tmp.vcpu_to_vnode = xmalloc_array(unsigned int, dom_vcpus);
+        tmp.vnode_to_pnode = xmalloc_array(unsigned int, dom_vnodes);
 
         if ( tmp.vdistance == NULL ||
              tmp.vmemrange == NULL ||
-             tmp.vcpu_to_vnode == NULL )
+             tmp.vcpu_to_vnode == NULL ||
+             tmp.vnode_to_pnode == NULL )
         {
             rc = -ENOMEM;
             goto vnumainfo_out;
@@ -1069,6 +1071,8 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
                sizeof(*d->vnuma->vdistance) * dom_vnodes * dom_vnodes);
         memcpy(tmp.vcpu_to_vnode, d->vnuma->vcpu_to_vnode,
                sizeof(*d->vnuma->vcpu_to_vnode) * dom_vcpus);
+        memcpy(tmp.vnode_to_pnode, d->vnuma->vnode_to_pnode,
+               sizeof(*d->vnuma->vnode_to_pnode) * dom_vnodes);
 
         read_unlock(&d->vnuma_rwlock);
 
@@ -1086,6 +1090,10 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
                            dom_vcpus) != 0 )
             goto vnumainfo_out;
 
+        if ( copy_to_guest(topology.vnode_to_pnode.h, tmp.vnode_to_pnode,
+                           dom_vnodes) != 0 )
+            goto vnumainfo_out;
+
         topology.nr_vnodes = dom_vnodes;
         topology.nr_vcpus = dom_vcpus;
         topology.nr_vmemranges = dom_vranges;
@@ -1098,6 +1106,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         xfree(tmp.vdistance);
         xfree(tmp.vmemrange);
         xfree(tmp.vcpu_to_vnode);
+        xfree(tmp.vnode_to_pnode);
         break;
     }
 
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index f021958..9d8c27b 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -566,6 +566,10 @@ struct vnuma_topology_info {
         uint64_t pad;
     } vcpu_to_vnode;
     union {
+        XEN_GUEST_HANDLE(uint) h;
+        uint64_t pad;
+    } vnode_to_pnode;
+    union {
         XEN_GUEST_HANDLE(vmemrange_t) h;
         uint64_t pad;
     } vmemrange;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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