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

Re: [libvirt] [PATCH v6 3/4] libxl: vnuma support



On 11/02/2017 09:47 AM, Wim Ten Have wrote:
From: Wim ten Have <wim ten have oracle com>

This patch generates a NUMA distance-aware libxl description from the
information extracted from a NUMA distance-aware libvirt XML file.

By default, if no NUMA node distance information is supplied in the
libvirt XML file, this patch uses the distances 10 for local and 20
for remote nodes/sockets."

Signed-off-by: Wim ten Have <wim ten have oracle com>
---
Changes on v1:
- Fix function calling (coding) standards.
- Use virReportError(...) under all failing circumstances.
- Reduce redundant (format->parse) code sorting bitmaps.
- Avoid non GNU shorthand notations, difficult code practice.
Changes on v2:
- Have autonomous defaults applied from virDomainNumaGetNodeDistance.
- Automatically make Xen driver simulate vnuma pnodes on non NUMA h/w.
- Compute 'memory unit=' making it the sum of all node memory.
Changes on v4:
- Escape virDomainNumaGetNodeCount() if effective.
Changes on v5:
- User VIR_WARN to warn instead of virReportError() abuse without error.
- Have ACPI set by libxlDomainDefPostParse() when virDomainNumaGetNodeCount
   suggests such for x86_64 under HVM.
- Remove VIR_DOMAIN_DEF_PARSE_ABI_UPDATE.
---
  src/libxl/libxl_conf.c   | 119 +++++++++++++++++++++++++++++++++++++++++++++++
  src/libxl/libxl_domain.c |   7 ++-
  2 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index ecbabfc79..c0dd634cd 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -593,6 +593,120 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
      return 0;
  }
+#ifdef LIBXL_HAVE_VNUMA
+static int
+libxlMakeVnumaList(virDomainDefPtr def,
+                   libxl_ctx *ctx,
+                   libxl_domain_config *d_config)
+{
+    int ret = -1;
+    size_t i, j;
+    size_t nr_nodes;
+    size_t num_vnuma;
+    bool simulate = false;
+    virBitmapPtr bitmap = NULL;
+    virDomainNumaPtr numa = def->numa;
+    libxl_domain_build_info *b_info = &d_config->b_info;
+    libxl_physinfo physinfo;
+    libxl_vnode_info *vnuma_nodes = NULL;
+
+    if (!numa)
+        return 0;
+
+    num_vnuma = virDomainNumaGetNodeCount(numa);
+    if (!num_vnuma)
+        return 0;
+
+    libxl_physinfo_init(&physinfo);
+    if (libxl_get_physinfo(ctx, &physinfo) < 0) {
+        libxl_physinfo_dispose(&physinfo);
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("libxl_get_physinfo_info failed"));
+        return -1;
+    }
+    nr_nodes = physinfo.nr_nodes;
+    libxl_physinfo_dispose(&physinfo);
+
+    if (num_vnuma > nr_nodes) {
+        VIR_WARN("Number of configured numa cells %zu exceeds the physical available nodes %zu, guest simulates numa",
+                       num_vnuma, nr_nodes);

To be a little more explicit, I've reworded this to

"Number of configured numa cells %zu exceeds available physical nodes %zu. All cells will use physical node 0"

Also fixed-up the indentation of the VIR_WARN parameters.

Reviewed-by: Jim Fehlig <jfehlig suse com>

Regards,
Jim


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