libxl: vNUMA supporting interface.
PATCH 4/7 libxl: vNUMA supporting interface.
* Provides verification and construction of vnode to pnode mapping. Will be in use for vNUMA nodes allocation if running on NUMA machine; If the mapping can be used, disables automatic NUMA placement;
* Verifies the correctness of memory blocks pfns for Linux guest by requesting the e820 map for that domain;
* Provides information to Xen with domain vNUMA topology;
TODO:
add additional check, as to vcpu pinning, before disabling automatic NUMA placement machanism;
---
Changes since RFC v2:
- added vnode_to_pnode map and its verification;
- in case vnode_to_pnode map can be used, turns off automatic NUMA placement;
- removed bogus memory blocks pfn alignment;
--- tools/libxl/libxl.c | 19 +++++ tools/libxl/libxl.h | 18 ++++ tools/libxl/libxl_arch.h | 8 ++ tools/libxl/libxl_dom.c | 186 +++++++++++++++++++++++++++++++++++++++++- tools/libxl/libxl_internal.h | 3 + tools/libxl/libxl_types.idl | 5 +- tools/libxl/libxl_x86.c | 53 ++++++++++++ 7 files changed, 290 insertions(+), 2 deletions(-)
tools/libxl/libxl.c +19 -0
@@ -4306,6 +4306,25 @@ static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, }return 0 ; } +int libxl_domain_setvnodes (libxl_ctx *ctx, +uint32_t domid, +uint16_t nr_vnodes, +uint16_t nr_vcpus, +vnuma_memblk_t *vnuma_memblks, +unsigned int *vdistance, +unsigned int *vcpu_to_vnode, +unsigned int *vnode_to_pnode) +{ +GC_INIT (ctx); +int ret; + ret =xc_domain_setvnodes (ctx->xch, domid, nr_vnodes, + nr_vcpus, vnuma_memblks, + vdistance, + vcpu_to_vnode, + vnode_to_pnode); +GC_FREE ; +return ret; +}int libxl_set_vcpuonline (libxl_ctx *ctx,uint32_t domid,libxl_bitmap *cpumap) {
tools/libxl/libxl.h +18 -0
@@ -281,6 +281,7 @@#include <netinet/in.h> #include <sys/wait.h> /* for pid_t */ +#include <xen/memory.h> #include <xentoollog.h> #include <libxl_uuid.h>
@@ -376,6 +377,14 @@#define LIBXL_EXTERNAL_CALLERS_ONLY /* disappears for callers outside libxl */ #endif +/* +* LIBXL_HAVE_BUILDINFO_VNUMA indicates that vnuma topology will be +* build for the guest upon request and with VM configuration. +* It will try to define best allocation for vNUMA +* nodes on real NUMA nodes. +*/ +#define LIBXL_HAVE_BUILDINFO_VNUMA 1 +typedef uint8_t libxl_mac [6 ];#define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"#define LIBXL_MAC_FMTLEN ((2*6)+5)/* 6 hex bytes plus 5 colons */
@@ -753,6 +762,15 @@ void libxl_vcpuinfo_list_free(libxl_vcpuinfo *, int nr_vcpus);void libxl_device_vtpm_list_free (libxl_device_vtpm *,int nr_vtpms);void libxl_vtpminfo_list_free (libxl_vtpminfo *,int nr_vtpms); +int libxl_domain_setvnodes (libxl_ctx *ctx, +uint32_t domid, +uint16_t nr_vnodes, +uint16_t nr_vcpus, +vnuma_memblk_t *vnuma_memblks, +unsigned int *vdistance, +unsigned int *vcpu_to_vnode, +unsigned int *vnode_to_pnode); +/* * Devices * =======
tools/libxl/libxl_arch.h +8 -0
@@ -19,4 +19,12 @@int libxl__arch_domain_create (libxl__gc *gc,libxl_domain_config *d_config,uint32_t domid); +int libxl__vnuma_align_mem (libxl__gc *gc, +uint32_t domid, +struct libxl_domain_build_info *b_info, +vnuma_memblk_t *memblks); + +int libxl__vnodemap_is_usable (libxl__gc *gc, +libxl_domain_build_info *info); +#endif
tools/libxl/libxl_dom.c +185 -1
218 lines not on this page · raw message
tools/libxl/libxl_internal.h +3 -0
@@ -2710,6 +2710,7 @@ static inline void libxl__ctx_unlock(libxl_ctx *ctx) {#define CTX_LOCK (libxl__ctx_lock(CTX))#define CTX_UNLOCK (libxl__ctx_unlock(CTX)) +#define VNUMA_NO_NODE ~((unsigned int)0)/* * Automatic NUMA placement *
@@ -2833,6 +2834,8 @@ void libxl__numa_candidate_put_nodemap(libxl__gc *gc,libxl_bitmap_copy (CTX , &cndt->nodemap, nodemap); } +int libxl__init_vnodemap (libxl__gc *gc,uint32_t domid, +libxl_domain_build_info *info);/* * Inserts "elm_new" into the sorted list "head". *
tools/libxl/libxl_types.idl +4 -1
@@ -292,7 +292,10 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("disable_migrate", libxl_defbool), ("cpuid", libxl_cpuid_policy_list), ("blkdev_start", string), - + ("vnuma_memszs", Array(uint64, "nr_vnodes")), + ("vcpu_to_vnode", Array(uint32, "nr_vnodemap")), + ("vdistance", Array(uint32, "nr_vdist")), + ("vnode_to_pnode", Array(uint32, "nr_vnode_to_pnode")), ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", libxl_defbool), # if you set device_model you must set device_model_version too
tools/libxl/libxl_x86.c +53 -0
56 lines not on this page · raw message
Signature · 1 line
1.7.10.4