Skip to contentSkip to conversation

More vNUMA patches

PATCH Superseded Wei Liu 2 participants 14 messages Sep 10, 2015 – Sep 11, 2015

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v3 cover More vNUMA patches

Wei Liu (3):
libxc: introduce xc_domain_getvnuma
xl/libxl: disallow saving a guest with vNUMA configured
xl: handle empty vnuma configuration

 docs/man/xl.cfg.pod.5         |  2 ++
 tools/libxc/include/xenctrl.h | 18 +++++++++++++++
 tools/libxc/xc_domain.c       | 54 +++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_dom.c       | 14 +++++++++++
 tools/libxl/xl_cmdimpl.c      |  3 +++
 5 files changed, 91 insertions(+)
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH v3 1/3 libxc: introduce xc_domain_getvnuma

A simple wrapper for XENMEM_get_vnumainfo.

---
 tools/libxc/include/xenctrl.h | 18 +++++++++++++++
 tools/libxc/xc_domain.c       | 54 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)
tools/libxc/include/xenctrl.h +18 -0
index 2000f12..37205c2 100644
@@ -1287,6 +1287,24 @@ int xc_domain_setvnuma(xc_interface *xch,
                         unsigned int *vdistance,
                         unsigned int *vcpu_to_vnode,
                         unsigned int *vnode_to_pnode);
+/*
+ * Retrieve vnuma configuration
+ * domid: IN, target domid
+ * nr_vnodes: IN/OUT, number of vnodes, not NULL
+ * nr_vmemranges: IN/OUT, number of vmemranges, not NULL
+ * nr_vcpus: IN/OUT, number of vcpus, not NULL
+ * vmemranges: OUT, an array which has length of nr_vmemranges
+ * vdistance: OUT, an array which has length of nr_vnodes * nr_vnodes
+ * vcpu_to_vnode: OUT, an array which has length of nr_vcpus
+ */
+int xc_domain_getvnuma(xc_interface *xch,
+                       uint32_t domid,
+                       uint32_t *nr_vnodes,
+                       uint32_t *nr_vmemranges,
+                       uint32_t *nr_vcpus,
+                       xen_vmemrange_t *vmemrange,
+                       unsigned int *vdistance,
+                       unsigned int *vcpu_to_vnode);
 
 #if defined(__i386__) || defined(__x86_64__)
 /*
tools/libxc/xc_domain.c +54 -0

60 lines not on this page · raw message

Signature · 1 line
2.1.4
author
#2 lore raw

PATCH v3 2/3 xl/libxl: disallow saving a guest with vNUMA configured

In reply to Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +2 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported, because
 there is an issue with cpuid handling that affects PV virtual NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.
 
 Each B<VNODE_SPEC> is a list, which has a form of
 "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]"  (without quotes).
tools/libxl/libxl_dom.c +14 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
+    /* Disallow saving a guest with vNUMA configured because migration
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges,
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno == XEN_EOPNOTSUPP));
+    if (errno == XEN_ENOBUFS && nr_vnodes) {
+        LOG(ERROR, "Cannot save a guest with vNUMA configured");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     dss->guest_evtchn.port = -1;
     dss->guest_evtchn_lockfd = -1;
     dss->guest_responded = 0;
Signature · 1 line
2.1.4
#3 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 52 lines · Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +2 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported, because
 there is an issue with cpuid handling that affects PV virtual NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.
 
 Each B<VNODE_SPEC> is a list, which has a form of
 "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]"  (without quotes).
tools/libxl/libxl_dom.c +2 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);

tools/libxl/libxl_dom.c void libxl__domain_save(libxl__egc *egc, · line 1647

Quoted 10 lines
tools/libxl/libxl_dom.c +6 -0
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
+    /* Disallow saving a guest with vNUMA configured because migration
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges,
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno == XEN_EOPNOTSUPP));

Has this been tested with a domain _without_ vnuma config.

Specifically if there is no vnuma config and therefore 0 vnodes and 0 vmemranges will the hypervisor actually return XEN_ENOBUFS rather than success (because it succeeded to put 0 things into a zero length array).

It looks like the non-zero number of vcpus in the domain will indeed trigger the ENOBUFS case, but I wanted to check.

Ian.

Quoted 9 lines
tools/libxl/libxl_dom.c +6 -0
+    if (errno == XEN_ENOBUFS && nr_vnodes) {
+        LOG(ERROR, "Cannot save a guest with vNUMA configured");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     dss->guest_evtchn.port = -1;
     dss->guest_evtchn_lockfd = -1;
     dss->guest_responded = 0;
author
#4 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 57 lines · Ian Campbell
Quoted 56 lines · Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +2 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported, because
 there is an issue with cpuid handling that affects PV virtual NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.
 
 Each B<VNODE_SPEC> is a list, which has a form of
 "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]"  (without quotes).
tools/libxl/libxl_dom.c +2 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);
tools/libxl/libxl_dom.c +0 -0
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
Quoted 9 lines

tools/libxl/libxl_dom.c void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) · line 1646

Quoted 6 lines
tools/libxl/libxl_dom.c +6 -0
+    /* Disallow saving a guest with vNUMA configured because migration
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges,
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno == XEN_EOPNOTSUPP));

Has this been tested with a domain _without_ vnuma config.

Yes.

Quoted 4 lines

Specifically if there is no vnuma config and therefore 0 vnodes and 0 vmemranges will the hypervisor actually return XEN_ENOBUFS rather than success (because it succeeded to put 0 things into a zero length array).

If there is no vnuma configuration at all, hv returns XEN_EOPNOTSUPP (hence the assertion in code).

Quoted 1 line

It looks like the non-zero number of vcpus in the domain will indeed

I guess you meant "zero number"?

Quoted 13 lines

trigger the ENOBUFS case, but I wanted to check.

Ian.

Quoted 9 lines
tools/libxl/libxl_dom.c +6 -0
+    if (errno == XEN_ENOBUFS && nr_vnodes) {
+        LOG(ERROR, "Cannot save a guest with vNUMA configured");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
     dss->guest_evtchn.port = -1;
     dss->guest_evtchn_lockfd = -1;
     dss->guest_responded = 0;
#5 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 74 lines · Wei Liu
Quoted 58 lines · Ian Campbell
Quoted 57 lines · Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +2 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported, because
 there is an issue with cpuid handling that affects PV virtual NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.
 
 Each B<VNODE_SPEC> is a list, which has a form of
 "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]"  (without quotes).
tools/libxl/libxl_dom.c +2 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);
tools/libxl/libxl_dom.c +0 -0
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
Quoted 12 lines
Quoted 9 lines
tools/libxl/libxl_dom.c +1 -0
+    /* Disallow saving a guest with vNUMA configured because

migration

tools/libxl/libxl_dom.c +3 -0
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes,

&nr_vmemranges,

tools/libxl/libxl_dom.c +2 -0
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno ==

XEN_EOPNOTSUPP));

Has this been tested with a domain _without_ vnuma config.

Yes.

Quoted 8 lines
Quoted 5 lines

Specifically if there is no vnuma config and therefore 0 vnodes and 0 vmemranges will the hypervisor actually return XEN_ENOBUFS rather than success (because it succeeded to put 0 things into a zero length array).

If there is no vnuma configuration at all, hv returns XEN_EOPNOTSUPP (hence the assertion in code).

Ah, I took that to be "Xen cannot do vnuma at all", rather than "This particular domain has no vnuma".

Quoted 3 lines
Quoted 1 line

It looks like the non-zero number of vcpus in the domain will indeed

I guess you meant "zero number"?

No, I meant non-zero. A domain with no vnuma still has some vcpus I think. Hence the NULL for the vcpus_to_vnodes array would trigger XEN_ENOBUFS.

author
#6 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 87 lines · Ian Campbell
Quoted 74 lines · Wei Liu
Quoted 58 lines · Ian Campbell
Quoted 57 lines · Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +2 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported, because
 there is an issue with cpuid handling that affects PV virtual NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.
 
 Each B<VNODE_SPEC> is a list, which has a form of
 "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]"  (without quotes).
tools/libxl/libxl_dom.c +2 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);
tools/libxl/libxl_dom.c +0 -0
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
Quoted 12 lines
Quoted 9 lines
tools/libxl/libxl_dom.c +1 -0
+    /* Disallow saving a guest with vNUMA configured because

migration

tools/libxl/libxl_dom.c +3 -0
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes,

&nr_vmemranges,

tools/libxl/libxl_dom.c +2 -0
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno ==

XEN_EOPNOTSUPP));

Has this been tested with a domain _without_ vnuma config.

Yes.

Quoted 8 lines
Quoted 5 lines

Specifically if there is no vnuma config and therefore 0 vnodes and 0 vmemranges will the hypervisor actually return XEN_ENOBUFS rather than success (because it succeeded to put 0 things into a zero length array).

If there is no vnuma configuration at all, hv returns XEN_EOPNOTSUPP (hence the assertion in code).

Ah, I took that to be "Xen cannot do vnuma at all", rather than "This particular domain has no vnuma".

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

It looks like the non-zero number of vcpus in the domain will indeed

I guess you meant "zero number"?

No, I meant non-zero. A domain with no vnuma still has some vcpus I think. Hence the NULL for the vcpus_to_vnodes array would trigger XEN_ENOBUFS.

Ah, you meant d->vcpus inside HV.

Yes, that's right. XEN_ENOBUFS is guaranteed in the above xc_domain_getvnuma call if there is d->vnuma structure inside HV, because a d->nr_vcpus is not zero.

Wei.

#7 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 105 lines · Wei Liu
Quoted 95 lines · Ian Campbell
Quoted 88 lines · Wei Liu
Quoted 64 lines · Ian Campbell
Quoted 63 lines · Wei Liu

This is because the migration stream does not preserve node information.

Note this is not a regression for migration v2 vs legacy migration
because neither of them preserve node information.

---
Cc: [email protected]

v3:
1. Update manpage, code comment and commit message.
2. *Don't* check if nomigrate is set.

---
 docs/man/xl.cfg.pod.5   |  2 ++
 tools/libxl/libxl_dom.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +0 -0
index 80e51bb..555f8ba 100644
@@ -263,6 +263,8 @@ virtual node.
 
 Note that virtual NUMA for PV guest is not yet supported,

because
there is an issue with cpuid handling that affects PV virtual
NUMA.
+Further more, guest with virtual NUMA cannot be saved or migrated
+because migration stream does not preserve node information.

Each B<VNODE_SPEC> is a list, which has a form of "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]" (without
quotes).

tools/libxl/libxl_dom.c +1 -0
index c2518a3..a4d37dc 100644
@@ -24,6 +24,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/e820.h>
+#include <xen/errno.h>
 
 libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t
 domid)

{

tools/libxl/libxl_dom.c +1 -0
@@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
     const libxl_domain_remus_info *const r_info = dss->remus;
     libxl__srm_save_autogen_callbacks *const callbacks =
         &dss->sws.shs.callbacks.save.a;
+    unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0;
 
     dss->rc = 0;
     logdirty_init(&dss->logdirty);
tools/libxl/libxl_dom.c +0 -0
@@ -1636,6 +1638,18 @@ void libxl__domain_save(libxl__egc *egc,
 libxl__domain_suspend_state *dss)
           | (debug ? XCFLAGS_DEBUG : 0)
           | (dss->hvm ? XCFLAGS_HVM : 0);
 
Quoted 12 lines
Quoted 9 lines
tools/libxl/libxl_dom.c +1 -0
+    /* Disallow saving a guest with vNUMA configured because

migration

tools/libxl/libxl_dom.c +3 -0
+     * stream does not preserve node information.
+     */
+    rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes,

&nr_vmemranges,

tools/libxl/libxl_dom.c +2 -0
+                            &nr_vcpus, NULL, NULL, NULL);
+    assert(rc == -1 && (errno == XEN_ENOBUFS || errno ==

XEN_EOPNOTSUPP));

Has this been tested with a domain _without_ vnuma config.

Yes.

Quoted 7 lines

Specifically if there is no vnuma config and therefore 0 vnodes and 0
vmemranges will the hypervisor actually return XEN_ENOBUFS rather than
success (because it succeeded to put 0 things into a zero length array).

Quoted 2 lines

If there is no vnuma configuration at all, hv returns XEN_EOPNOTSUPP (hence the assertion in code).

Ah, I took that to be "Xen cannot do vnuma at all", rather than "This particular domain has no vnuma".

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It looks like the non-zero number of vcpus in the domain will indeed

I guess you meant "zero number"?

No, I meant non-zero. A domain with no vnuma still has some vcpus I think.
Hence the NULL for the vcpus_to_vnodes array would trigger XEN_ENOBUFS.

Quoted 5 lines

Ah, you meant d->vcpus inside HV.

Yes, that's right. XEN_ENOBUFS is guaranteed in the above xc_domain_getvnuma call if there is d->vnuma structure inside HV, because a d->nr_vcpus is not zero.

But "is d->vnuma" corresponds to there being vnuma config for the domain. I 'm specifically worried about the case where there is no vnuma config for the domain.

Ian.

#8 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 1 line · Ian Campbell

But "is d->vnuma" corresponds to there being vnuma config for the domain.

We discussed this IRL and concluded that we should stop trying to differentiate "no vnuma configuration" from "has empty vnuma configuration".

So this code should raise this error if xc_domain_getvnuma returns anything other than rc == -1 && errno == XEN_EOPNOTSUPP. So the check is

    if ( rc != -1 || errno != XEN_EOPNOTSUPP )

I think.

This then avoids any confusion about what it means to have a d->vnuma with nr_something == 0 in it.

Ian.

author
#9 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 12 lines · Ian Campbell
Quoted 1 line · Ian Campbell

But "is d->vnuma" corresponds to there being vnuma config for the domain.

We discussed this IRL and concluded that we should stop trying to differentiate "no vnuma configuration" from "has empty vnuma configuration".

So this code should raise this error if xc_domain_getvnuma returns anything other than rc == -1 && errno == XEN_EOPNOTSUPP. So the check is

    if ( rc != -1 || errno != XEN_EOPNOTSUPP )

To be precise, this should be

      if ( rc != -1 || errno == XEN_EOPNOTSUPP )

(your if expression contradicts what you said)

Quoted 6 lines

I think.

This then avoids any confusion about what it means to have a d->vnuma with nr_something == 0 in it.

Ian.

#10 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 13 lines · Wei Liu
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

But "is d->vnuma" corresponds to there being vnuma config for the domain.

We discussed this IRL and concluded that we should stop trying to differentiate "no vnuma configuration" from "has empty vnuma configuration".

So this code should raise this error if xc_domain_getvnuma returns anything
other than rc == -1 && errno == XEN_EOPNOTSUPP. So the check is

Quoted 8 lines
Quoted 2 lines
    if ( rc != -1 || errno != XEN_EOPNOTSUPP )

To be precise, this should be

      if ( rc != -1 || errno == XEN_EOPNOTSUPP )

(your if expression contradicts what you said)

I don't think it did, but they are inverses of each other, due to the "other than" wording in the prose.

		errno == OPNOTSUPP	errno != OPNOTSUPP

rc >=0 ??? Some vnuma config
rc ==-1 No vnuma config(*) Some other error

(*) is the only situation which is allowed, which is what I described in the text.

But the if needs to reject the other 3 cases, so it is in the inverse test. rc != -1 covers the top row, and errno != OPNOTSUPP covers the second column, if either are true then we do not want to proceed.

Ian.

author
#11 lore raw

Re: [PATCH for 4.6 v3 2/3] xl/libxl: disallow saving a guest with vNUMA configured

Quoted 29 lines · Ian Campbell
Quoted 13 lines · Wei Liu
Quoted 12 lines · Ian Campbell
Quoted 2 lines · Ian Campbell

But "is d->vnuma" corresponds to there being vnuma config for the domain.

We discussed this IRL and concluded that we should stop trying to differentiate "no vnuma configuration" from "has empty vnuma configuration".

So this code should raise this error if xc_domain_getvnuma returns anything
other than rc == -1 && errno == XEN_EOPNOTSUPP. So the check is

Quoted 8 lines
Quoted 2 lines
    if ( rc != -1 || errno != XEN_EOPNOTSUPP )

To be precise, this should be

      if ( rc != -1 || errno == XEN_EOPNOTSUPP )

(your if expression contradicts what you said)

I don't think it did, but they are inverses of each other, due to the "other than" wording in the prose.

		errno == OPNOTSUPP	errno != OPNOTSUPP

rc >=0 ??? Some vnuma config
rc ==-1 No vnuma config(*) Some other error

Quoted 7 lines

(*) is the only situation which is allowed, which is what I described in the text.

But the if needs to reject the other 3 cases, so it is in the inverse test. rc != -1 covers the top row, and errno != OPNOTSUPP covers the second column, if either are true then we do not want to proceed.

Oh, right, I misinterpreted your expression. Sorry for the noise.

Wei.

Quoted 1 line

Ian.

author
#12 lore raw

PATCH v3 3/3 xl: handle empty vnuma configuration

In reply to Wei Liu

When user specifies vnuma = [], we need to skip the whole parser function, otherwise the parser sets b_info->max_memkb to garbage value.

---
 tools/libxl/xl_cmdimpl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxl/xl_cmdimpl.c +3 -0
index ebbb9a5..7dbf37f 100644
@@ -1093,6 +1093,9 @@ static void parse_vnuma_config(const XLU_Config *config,
     if (xlu_cfg_get_list(config, "vnuma", &vnuma, &num_vnuma, 1))
         return;
 
+    if (!num_vnuma)
+        return;
+
     b_info->num_vnuma_nodes = num_vnuma;
     b_info->vnuma_nodes = xcalloc(num_vnuma, sizeof(libxl_vnode_info));
     vcpu_parsed = xcalloc(num_vnuma, sizeof(libxl_bitmap));
Signature · 1 line
2.1.4
Acked-by on v3 3/3
#13 lore raw

Re: [PATCH for 4.6 v3 3/3] xl: handle empty vnuma configuration

Quoted 2 lines · Wei Liu

When user specifies vnuma = [], we need to skip the whole parser function, otherwise the parser sets b_info->max_memkb to garbage value.

Arguably the bug here is in the code which does so without reference to num_vnuma (the majority of this function does the right thing if num_vnuma == 0).

However we may as well short circuit the whole thing regardless of this bug so:

Quoted 1 line
Quoted 19 lines
---
 tools/libxl/xl_cmdimpl.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxl/xl_cmdimpl.c +3 -0
index ebbb9a5..7dbf37f 100644
@@ -1093,6 +1093,9 @@ static void parse_vnuma_config(const XLU_Config
 *config,
     if (xlu_cfg_get_list(config, "vnuma", &vnuma, &num_vnuma, 1))
         return;
 
+    if (!num_vnuma)
+        return;
+
     b_info->num_vnuma_nodes = num_vnuma;
     b_info->vnuma_nodes = xcalloc(num_vnuma, sizeof(libxl_vnode_info));
     vcpu_parsed = xcalloc(num_vnuma, sizeof(libxl_bitmap));