Skip to contentSkip to conversation

xen: vNUMA support for PV guests

PATCH Superseded Elena Ufimtseva 4 participants 5 messages Oct 16, 2013 – Nov 22, 2013

v1 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 xen: vNUMA support for PV guests

Defines XENMEM subop hypercall for PV vNUMA enabled guests and data structures that provide vNUMA topology information from per-domain vnuma topology build info.

---
Changes since RFC v2:
- fixed code style;
- the memory copying in hypercall happens in one go for arrays;
- fixed error codes logic;

---
 xen/common/domain.c         |   10 ++++++
 xen/common/domctl.c         |   72 +++++++++++++++++++++++++++++++++++++++++++
 xen/common/memory.c         |   41 ++++++++++++++++++++++++
 xen/include/public/domctl.h |   14 +++++++++
 xen/include/public/memory.h |    8 +++++
 xen/include/xen/domain.h    |   11 +++++++
 xen/include/xen/sched.h     |    1 +
 xen/include/xen/vnuma.h     |   18 +++++++++++
 8 files changed, 175 insertions(+)
 create mode 100644 xen/include/xen/vnuma.h
xen/common/domain.c +10 -0
index 5999779..d084292 100644
@@ -539,6 +539,7 @@ int domain_kill(struct domain *d)
         tmem_destroy(d->tmem);
         domain_set_outstanding_pages(d, 0);
         d->tmem = NULL;
+        domain_vnuma_destroy(&d->vnuma);
         /* fallthrough */
     case DOMDYING_dying:
         rc = domain_relinquish_resources(d);
@@ -1287,6 +1288,15 @@ int continue_hypercall_on_cpu(
     return 0;
 }
 
+void domain_vnuma_destroy(struct domain_vnuma_info *v)
+{
+    v->nr_vnodes = 0;
+    xfree(v->vnuma_memblks);
+    xfree(v->vcpu_to_vnode);
+    xfree(v->vdistance);
+    xfree(v->vnode_to_pnode);
+}
+
 /*
  * Local variables:
  * mode: C
xen/common/domctl.c +72 -0

84 lines not on this page · raw message

xen/common/memory.c +41 -0

54 lines not on this page · raw message

xen/include/public/domctl.h +14 -0
index d4e479f..1adab25 100644
@@ -35,6 +35,7 @@
 #include "xen.h"
 #include "grant_table.h"
 #include "hvm/save.h"
+#include "memory.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000009
 
@@ -863,6 +864,17 @@ struct xen_domctl_set_max_evtchn {
 typedef struct xen_domctl_set_max_evtchn xen_domctl_set_max_evtchn_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_max_evtchn_t);
 
+struct xen_domctl_vnuma {
+    uint16_t nr_vnodes;
+    XEN_GUEST_HANDLE_64(uint) vdistance;
+    XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
+    XEN_GUEST_HANDLE_64(uint) vnode_to_pnode;
+    XEN_GUEST_HANDLE_64(vnuma_memblk_t) vnuma_memblks;
+};
+
+typedef struct xen_domctl_vnuma xen_domctl_vnuma_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_vnuma_t);
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -932,6 +944,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_setnodeaffinity               68
 #define XEN_DOMCTL_getnodeaffinity               69
 #define XEN_DOMCTL_set_max_evtchn                70
+#define XEN_DOMCTL_setvnumainfo                  71
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -992,6 +1005,7 @@ struct xen_domctl {
         struct xen_domctl_set_broken_page_p2m set_broken_page_p2m;
         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
+        struct xen_domctl_vnuma             vnuma;
         uint8_t                             pad[128];
     } u;
 };
xen/include/public/memory.h +8 -0
index 7a26dee..93a17e9 100644
@@ -459,6 +459,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_sharing_op_t);
  * The zero value is appropiate.
  */
 
+struct vnuma_memblk {
+              uint64_t start, end;
+};
+typedef struct vnuma_memblk vnuma_memblk_t;
+DEFINE_XEN_GUEST_HANDLE(vnuma_memblk_t);
+
+#define XENMEM_get_vnuma_info               25
+
 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
xen/include/xen/domain.h +11 -0
index a057069..c9d53e3 100644
@@ -4,6 +4,7 @@
 
 #include <public/xen.h>
 #include <asm/domain.h>
+#include <public/memory.h>
 
 typedef union {
     struct vcpu_guest_context *nat;
@@ -89,4 +90,14 @@ extern unsigned int xen_processor_pmbits;
 
 extern bool_t opt_dom0_vcpus_pin;
 
+struct domain_vnuma_info {
+    uint16_t nr_vnodes;
+    uint *vdistance;
+    uint *vcpu_to_vnode;
+    uint *vnode_to_pnode;
+    vnuma_memblk_t *vnuma_memblks;
+};
+
+void domain_vnuma_destroy(struct domain_vnuma_info *v);
+
 #endif /* __XEN_DOMAIN_H__ */
xen/include/xen/sched.h +1 -0
index 25bf637..6693b35 100644
@@ -408,6 +408,7 @@ struct domain
     nodemask_t node_affinity;
     unsigned int last_alloc_node;
     spinlock_t node_affinity_lock;
+    struct domain_vnuma_info vnuma;
 };
 
 struct domain_setup_info
xen/include/xen/vnuma.h new file +18 -0
new file mode 100644
index 0000000..2637476
@@ -0,0 +1,18 @@
+#ifndef _VNUMA_H
+#define _VNUMA_H
+#include <public/memory.h>
+
+/* DEFINE_XEN_GUEST_HANDLE(vnuma_memblk_t); */
+
+struct vnuma_topology_info {
+    domid_t domid;
+    uint16_t nr_vnodes;
+    uint32_t _pad;
+    XEN_GUEST_HANDLE_64(uint) vdistance;
+    XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
+    XEN_GUEST_HANDLE_64(vnuma_memblk_t) vnuma_memblks;
+};
+typedef struct vnuma_topology_info vnuma_topology_info_t;
+DEFINE_XEN_GUEST_HANDLE(vnuma_topology_info_t);
+
+#endif
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Elena Ufimtseva

Changes since RFC v2:
- fixed code style;

Sadly not enough yet.

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 878

Quoted 8 lines
xen/common/domctl.c +4 -0
@@ -871,6 +872,77 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     }
     break;
 
+    case XEN_DOMCTL_setvnumainfo:
+    {
+        unsigned int i, j, nr_vnodes, dist_size;
+        unsigned int dist;

Why can't these all be together?

Review long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 879

Quoted 1 line
(quoted diff) +1 -0
+        

Line with only blanks.

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 881

Quoted 2 lines
xen/common/domctl.c +2 -0
+        ret = -EFAULT;
+        dist = i = j = 0;

Why can't these be initializers to their declarators?

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 886

Quoted 5 lines
xen/common/domctl.c +5 -0
+
+        nr_vnodes = op->u.vnuma.nr_vnodes; 
+        if ( nr_vnodes == 0 )
+            goto err_dom;
+        dist_size = nr_vnodes * nr_vnodes;

Potential for overflow?

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 895

Quoted 9 lines
xen/common/domctl.c +9 -0
+
+        d->vnuma.vdistance = xmalloc_bytes(
+                 sizeof(*d->vnuma.vdistance) * dist_size);
+        d->vnuma.vnuma_memblks = xmalloc_bytes(
+                 sizeof(*d->vnuma.vnuma_memblks) * nr_vnodes);
+        d->vnuma.vcpu_to_vnode = xmalloc_bytes(
+                 sizeof(*d->vnuma.vcpu_to_vnode) * d->max_vcpus);
+        d->vnuma.vnode_to_pnode = xmalloc_bytes(
+                 sizeof(*d->vnuma.vnode_to_pnode) * nr_vnodes);

Is there any reason why any of these really has to use xmalloc_bytes() instead of xmalloc_array() (which takes care of overflow conditions as well as type correctness for you)?

Further there's nothing preventing this call from being issued twice for a given domain, yet you blindly overwrite the old values (and thus leak them).

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 905

Quoted 10 lines
xen/common/domctl.c +10 -0
+
+        if ( d->vnuma.vdistance == NULL || d->vnuma.vnuma_memblks == NULL ||
+                                           d->vnuma.vcpu_to_vnode == NULL ||
+                                           d->vnuma.vnode_to_pnode == NULL )
+        {
+            ret = -ENOMEM;
+            goto err_dom;
+        }
+        
+        d->vnuma.nr_vnodes = nr_vnodes; 

Trailing blank.

Also I'd strongly recommend setting this field last, so that other code won't risk getting confused if some of the copying below fails - until all copying was successfully done, the domain should look like not having any vNUMA info.

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 907

Quoted 2 lines
xen/common/domctl.c +2 -0
+        if ( !guest_handle_is_null(op->u.vnuma.vdistance) )
+            if ( unlikely(copy_from_guest(d->vnuma.vdistance,

Two if()-s like here should be combined into a single one.

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 910

Quoted 3 lines
xen/common/domctl.c +3 -0
+                                    op->u.vnuma.vdistance,
+                                    dist_size)) )
+                goto err_dom;

And if guest_handle_is_null(op->u.vnuma.vdistance) d->vnuma.vdistance will remain uninitialized - is that not a problem?

(Both this and the preceding comment apply further down again.)

Quoted 13 lines
xen/common/domctl.c +13 -0
+        
+        if ( !guest_handle_is_null(op->u.vnuma.vnuma_memblks) )
+            if ( unlikely(copy_from_guest(d->vnuma.vnuma_memblks,
+                                    op->u.vnuma.vnuma_memblks,
+                                    nr_vnodes)))
+                goto err_dom;
+
+        if ( !guest_handle_is_null(op->u.vnuma.vcpu_to_vnode) )
+            if ( unlikely(copy_from_guest(d->vnuma.vcpu_to_vnode,
+                                      op->u.vnuma.vcpu_to_vnode,
+                                      d->max_vcpus)) )
+                goto err_dom;
+        

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 933

Quoted 10 lines
xen/common/domctl.c +10 -0
+        if ( !guest_handle_is_null(op->u.vnuma.vnode_to_pnode) )
+        {
+            if ( unlikely(copy_from_guest(d->vnuma.vnode_to_pnode,
+                                        op->u.vnuma.vnode_to_pnode,
+                                        nr_vnodes)) )
+                goto err_dom;
+
+        }
+        else
+            for( i = 0; i < nr_vnodes; i++ )

Missing blank after "for".

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 936

Quoted 3 lines
xen/common/domctl.c +3 -0
+                d->vnuma.vnode_to_pnode[i] = NUMA_NO_NODE;
+        ret = 0;
+err_dom:

This should be indented by one space. I also don't see why it's being named the way it is (it's for one too unspecific and also completely unrelated to anything "dom"ish).

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 937

Quoted 1 line
xen/common/domctl.c +1 -0
+        if (ret != 0) {
        if ( ret != 0 )
        {

xen/common/domctl.c long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) · line 941

Quoted 4 lines
xen/common/domctl.c +4 -0
+            d->vnuma.nr_vnodes = 0;
+            xfree( d->vnuma.vdistance );
+            xfree( d->vnuma.vnuma_memblks );
+            xfree( d->vnuma.vnode_to_pnode );

Bogus blanks around function call arguments.

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 740

Quoted 9 lines
xen/common/memory.c +5 -0
@@ -732,7 +733,47 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         rcu_unlock_domain(d);
 
         break;
+    case XENMEM_get_vnuma_info:
+    {
+        struct vnuma_topology_info mtopology;
+        struct domain *d;
+        unsigned int max_vcpus, nr_vnodes = 0;

Pretty pointless variables, and definitely a pointless initializer.

Quoted 1 line

The blank line here should actually be retained above the case label (and similarly a blank line should be there before the next [default] one).

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 752

Quoted 11 lines
xen/common/memory.c +11 -0
+        rc = -EINVAL;
+        
+        if( copy_from_guest(&mtopology, arg, 1) )
+            return -EFAULT;
+        if ( (d = rcu_lock_domain_by_any_id(mtopology.domid)) == NULL )
+            return -ESRCH;
+
+        nr_vnodes = d->vnuma.nr_vnodes;
+        max_vcpus = d->max_vcpus;
+        
+        if ((nr_vnodes == 0) || (nr_vnodes > max_vcpus))

Starting here and continuing all the way to the end of the function you're again lacking blanks inside the outermost parentheses.

Also, is the right side of the || really possible?

Quoted 1 line

+ goto vnumaout;

This yields a -EINVAL return for something that isn't really a bad function argument. Please use a more appropriate error code (like -EOPNOTSUPP).

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+        mtopology.nr_vnodes = nr_vnodes;

So this is the only field you changed.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+        if (copy_to_guest(arg , &mtopology, 1) != 0)

Hence you would be better off copying back just that one field. And having used copy_from_guest() on the same guest memory block above, using the __-prefixed variant here is correct and (for consistency with other similar code) recommended.

Quoted 1 line

+ goto vnumaout;

And from here on the error return value ought to be -EFAULT.

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 762

Quoted 4 lines
xen/common/memory.c +4 -0
+
+        if (copy_to_guest(mtopology.vnuma_memblks,
+                                d->vnuma.vnuma_memblks,
+                                nr_vnodes) != 0)

And here we see that the lack of initialization above _is_ a (security) problem - you're possibly leaking hypervisor memory contents to the guest here.

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) · line 773

Quoted 11 lines
xen/common/memory.c +11 -0
+            goto vnumaout;
+        if (copy_to_guest(mtopology.vdistance,
+                                d->vnuma.vdistance,
+                                nr_vnodes * nr_vnodes) != 0)
+            goto vnumaout;
+        if (copy_to_guest(mtopology.vcpu_to_vnode,
+                                d->vnuma.vcpu_to_vnode,
+                                max_vcpus) != 0)
+            goto vnumaout;
+        rc = 0;
+vnumaout:

Again needs to be indented by one space.

xen/include/public/domctl.h struct xen_domctl_set_max_evtchn { · line 868

Quoted 6 lines
xen/include/public/domctl.h +2 -0
@@ -863,6 +864,17 @@ struct xen_domctl_set_max_evtchn {
 typedef struct xen_domctl_set_max_evtchn xen_domctl_set_max_evtchn_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_max_evtchn_t);
 
+struct xen_domctl_vnuma {
+    uint16_t nr_vnodes;

Please insert explicit padding here. And if you want the structure to be extensible without having to increment the domctl interface version, you'd also require (and check!) the padding space to be zero-initialized.

xen/include/public/memory.h DEFINE_XEN_GUEST_HANDLE(xen_mem_sharing_op_t); · line 463

Quoted 2 lines
xen/include/public/memory.h +2 -0
+struct vnuma_memblk {
+              uint64_t start, end;

Too deep indentation.

xen/include/xen/domain.h line 7

Quoted 7 lines
xen/include/xen/domain.h +1 -0
@@ -4,6 +4,7 @@
 
 #include <public/xen.h>
 #include <asm/domain.h>
+#include <public/memory.h>

Avoid such unnecessary dependencies if you can. And you can here ...

xen/include/xen/domain.h extern unsigned int xen_processor_pmbits; · line 98

Quoted 10 lines
xen/include/xen/domain.h +6 -0
@@ -89,4 +90,14 @@ extern unsigned int xen_processor_pmbits;
 
 extern bool_t opt_dom0_vcpus_pin;
 
+struct domain_vnuma_info {
+    uint16_t nr_vnodes;
+    uint *vdistance;
+    uint *vcpu_to_vnode;
+    uint *vnode_to_pnode;
+    vnuma_memblk_t *vnuma_memblks;

... by using struct vnuma_memblk here.

Quoted 9 lines
xen/include/xen/vnuma.h new file +6 -0
@@ -0,0 +1,18 @@
+#ifndef _VNUMA_H
+#define _VNUMA_H
+#include <public/memory.h>
+
+/* DEFINE_XEN_GUEST_HANDLE(vnuma_memblk_t); */
+

xen/include/xen/vnuma.h line 16

Quoted 10 lines
xen/include/xen/vnuma.h new file +10 -0
+struct vnuma_topology_info {
+    domid_t domid;
+    uint16_t nr_vnodes;
+    uint32_t _pad;
+    XEN_GUEST_HANDLE_64(uint) vdistance;
+    XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
+    XEN_GUEST_HANDLE_64(vnuma_memblk_t) vnuma_memblks;
+};
+typedef struct vnuma_topology_info vnuma_topology_info_t;
+DEFINE_XEN_GUEST_HANDLE(vnuma_topology_info_t);

This being the argument of XENMEM_get_vnuma_info, how can this live in a non-public header? (I'm sure I had pointed this out before.)

Jan

#2 lore raw

Hi Elena,
Congratulations to your work again!

Have you considered the other memory operations in xen/common/memory.c? There are two important function: decrease_reservation(&args) and populate_physmap(&args)
decrease_reservation(&args) remove pages from domain. populate_physmap(&args) alloc pages for domain.

Both of them have NUMA operation. (there is also a function name increase_reservation(&args), I don't know why it's here since guest domain wouldn't use it as far as I know...)
Guest domain pass the mask of nodes to xen by these two hypercalls.

For decrease_reservation, xen will also receive a number of pages. We just free them from domain. Here, we should update the memory size of vnodes and pnodes
(I think you keep a counter for the page numbers of each vnode and pnode, something as vnuma_memszs, but please forgive me that you have submitted
such a huge patch that I could not understand everything in time : - | )

For populate_physmap, xen will allocate blank pages from its heap for domain guest, from specific nodes, according to the nodemask. Here we should update your counters too!

And as I see, we don't have a protocol here on whether the nodemask in (&args ) is pnode or vnode.

I think it should be vnode, since guest domain knows nothing about the node affinity.

So my idea could be: we communicate with guest domain using vnode IDs. If we need to change the memory size of guest domain, for example, memory increase/decrease on pnode[0],
we use your node affinity to change pnode[0] to vnodes_mask, pass it to guest domain. And in the two functions of memory.c mentioned above, we received the vnode_mask, transfer it back to pnode_mask, thus it will work perfectly! And we don't need an extra hypercall for guest domain any more!

Elena and Dario, what is your options?

Signature · 8 lines
Yechen Li

Team of System Virtualization and Cloud Computing
School of Electronic Engineering  and Computer Science,
Peking University, China

Nothing is impossible because impossible itself  says: " I'm possible "
lccycc From PKU

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Dario,
I just reply to this email again in case you haven't seen it :)

Quoted 57 lines · Li Yechen

Hi Elena,
Congratulations to your work again!

Have you considered the other memory operations in xen/common/memory.c? There are two important function: decrease_reservation(&args) and populate_physmap(&args)
decrease_reservation(&args) remove pages from domain. populate_physmap(&args) alloc pages for domain.

Both of them have NUMA operation. (there is also a function name increase_reservation(&args), I don't know why it's here since guest domain wouldn't use it as far as I know...)
Guest domain pass the mask of nodes to xen by these two hypercalls.

For decrease_reservation, xen will also receive a number of pages. We just free them from domain. Here, we should update the memory size of vnodes and pnodes
(I think you keep a counter for the page numbers of each vnode and pnode, something as vnuma_memszs, but please forgive me that you have submitted
such a huge patch that I could not understand everything in time : - | )

For populate_physmap, xen will allocate blank pages from its heap for domain guest, from specific nodes, according to the nodemask. Here we should update your counters too!

And as I see, we don't have a protocol here on whether the nodemask in (&args ) is pnode or vnode.

I think it should be vnode, since guest domain knows nothing about the node affinity.

So my idea could be: we communicate with guest domain using vnode IDs. If we need to change the memory size of guest domain, for example, memory increase/decrease on pnode[0],
we use your node affinity to change pnode[0] to vnodes_mask, pass it to guest domain. And in the two functions of memory.c mentioned above, we received the vnode_mask, transfer it back to pnode_mask, thus it will work perfectly! And we don't need an extra hypercall for guest domain any more!

Elena and Dario, what is your options?

--

Yechen Li

Team of System Virtualization and Cloud Computing School of Electronic Engineering and Computer Science, Peking University, China

Nothing is impossible because impossible itself says: " I'm possible " lccycc From PKU

Signature · 8 lines
Yechen Li

Team of System Virtualization and Cloud Computing
School of Electronic Engineering  and Computer Science,
Peking University, China

Nothing is impossible because impossible itself  says: " I'm possible "
lccycc From PKU

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 3 lines · Li Yechen

Dario,
I just reply to this email again in case you haven't seen it :)

No, don't worry, I haven't forgot. :-)

Quoted 7 lines

On Tue, Oct 22, 2013 at 10:31 PM, Li Yechen <[email protected]> wrote:
Hi Elena,

Congratulations to your work again!

Quoted 9 lines

Have you considered the other memory operations in xen/common/memory.c?

There are two important function: decrease_reservation(&args) and populate_physmap(&args)

decrease_reservation(&args) remove pages from domain. populate_physmap(&args) alloc pages for domain.

Yes, that's definitely something we need to adress, probably in this patch series, even before thinking about NUMA aware ballooning.

Quoted 11 lines

Guest domain pass the mask of nodes to xen by these two hypercalls.

For decrease_reservation, xen will also receive a number of pages. We just free them from domain. Here, we should update the memory size of vnodes and pnodes
(I think you keep a counter for the page numbers of each vnode and pnode, something as vnuma_memszs, but please forgive me that you have submitted such a huge patch that I could not
understand everything in time : - | )

Quoted 4 lines

For populate_physmap, xen will allocate blank pages from its heap for domain guest, from specific nodes, according to the nodemask. Here we should update your counters too!

Well, I haven't gone re-check the code, but that does make sense.

In Edinburgh, Elena told me that she did some tests of ballooning with her series applied, and nothing exploded (which is already something. :-D).

We definitely should double check what happens, from where the pages came /are taken from, and ensure the accounting is done right.

Quoted 6 lines

And as I see, we don't have a protocol here on whether the nodemask in (&args ) is pnode or vnode.

I think it should be vnode, since guest domain knows nothing about the node affinity.

Quoted 8 lines

So my idea could be: we communicate with guest domain using vnode IDs. If we need to change the memory size of guest domain, for example, memory increase/decrease on pnode[0], we . And in the two functions of memory.c mentioned above, we received the vnode_mask, transfer it back to pnode_mask, thus it will work perfectly! And we don't need an extra hypercall for guest domain any more!

Mmm.. it may be me, but I'm not sure I follow. I agree that the guest should speak vnode-s, but I'm not sure I get what you mean when you say "use your node affinity to change pnode[0] to vnodes_mask, pass it to guest domain".

Anyway, I was thinking, you did a pretty nice job on hacking something together when for NUMA aware ballooning when vNUMA wasn't even released. Now that Elena's patchset is out, how about you try to adapt what you had at the time, plus the outcome of all that nice discussion we also had, on top of it, and show us what happens? :-)

Elena's patches are not in the final form, but that should constitute a fairly decent basis for another, and this time easier to understand and to review, proof of concept implementation, isn't that so?

Of course, there's no hurry, this will definitely be something we'll consider for the next release of Xen (so 4.5, not 4.4 which will hopefully be released in January), i.e., there should be plenty of time. :-D

What do you think?

Thanks and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel