diff mbox

xl cpupool-numa-split: don't try to bring any dom0 vCPUs online

Message ID 1471007513-18155-1-git-send-email-jonathan.davies@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jonathan Davies Aug. 12, 2016, 1:11 p.m. UTC
Since commit a9dd01431a799b6743193a75f4f1ce2fdfdb7296, main_cpupoolnumasplit
wants to ensure that dom0 doesn't have more online vCPUs than the number of
pCPUs in a NUMA node.

However, if dom0 already has fewer online vCPUs than the number of pCPUs in a
NUMA node, this will cause some to be made online.

Furthermore, if dom0's maximum number of vCPUs is less than the number of pCPUs,
this will result in an error like the following:

    libxl: error: libxl.c:5564:libxl_set_vcpuonline: Requested 24 VCPUs, however maxcpus is 12!: Function not implemented
    error on removing vcpus for Domain-0

Instead, make main_cpupoolnumasplit only reduce the number of vCPUs dom0 has
online, and don't try to add any more.

This incurs an extra call to libxl_domain_info to find out the current number of
dom0 vCPUs. Conveniently, there is already an initialised libxl_dominfo that we
can use.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 tools/libxl/xl_cmdimpl.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Jürgen Groß Aug. 15, 2016, 4:19 a.m. UTC | #1
On 12/08/16 15:11, Jonathan Davies wrote:
> Since commit a9dd01431a799b6743193a75f4f1ce2fdfdb7296, main_cpupoolnumasplit
> wants to ensure that dom0 doesn't have more online vCPUs than the number of
> pCPUs in a NUMA node.
> 
> However, if dom0 already has fewer online vCPUs than the number of pCPUs in a
> NUMA node, this will cause some to be made online.
> 
> Furthermore, if dom0's maximum number of vCPUs is less than the number of pCPUs,
> this will result in an error like the following:
> 
>     libxl: error: libxl.c:5564:libxl_set_vcpuonline: Requested 24 VCPUs, however maxcpus is 12!: Function not implemented
>     error on removing vcpus for Domain-0
> 
> Instead, make main_cpupoolnumasplit only reduce the number of vCPUs dom0 has
> online, and don't try to add any more.
> 
> This incurs an extra call to libxl_domain_info to find out the current number of
> dom0 vCPUs. Conveniently, there is already an initialised libxl_dominfo that we
> can use.

Commit c256d2afc1cad0cca912492e338d6ff97e477c4f already corrects this
problem.

Ian, there seems to be some need to backport above commit.


Juergen
diff mbox

Patch

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 7f961e3..d5df20d 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -8614,12 +8614,19 @@  int main_cpupoolnumasplit(int argc, char **argv)
         goto out;
     }
 
+    if (libxl_domain_info(ctx, &info, 0)) {
+        fprintf(stderr, "error on getting info for Domain-0\n");
+        goto out;
+    }
+
     n = 0;
     for (c = 0; c < n_cpus; c++) {
         if (topology[c].node == node) {
             topology[c].node = LIBXL_CPUTOPOLOGY_INVALID_ENTRY;
-            libxl_bitmap_set(&cpumap, n);
-            n++;
+            if (n < info.vcpu_online) {
+                libxl_bitmap_set(&cpumap, n);
+                n++;
+            }
         }
     }
     if (libxl_domain_info(ctx, &info, 0)) {