mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
libxl: allow for explicitly specifying node-affinity
By introducing a nodemap in libxl_domain_build_info and providing the get/set methods to deal with it. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
02ec52272f
commit
a5d30c236a
5 files changed
+39
No files matched your search
@@ -4183,6 +4183,26 @@ int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int libxl_domain_set_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_bitmap *nodemap)
|
||||
{
|
||||
if (xc_domain_node_setaffinity(ctx->xch, domid, nodemap->map)) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "setting node affinity");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_bitmap *nodemap)
|
||||
{
|
||||
if (xc_domain_node_getaffinity(ctx->xch, domid, nodemap->map)) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting node affinity");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap)
|
||||
{
|
||||
GC_INIT(ctx);
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
*/
|
||||
#define LIBXL_HAVE_FIRMWARE_PASSTHROUGH 1
|
||||
|
||||
/*
|
||||
* LIBXL_HAVE_DOMAIN_NODEAFFINITY indicates that a 'nodemap' field
|
||||
* (of libxl_bitmap type) is present in libxl_domain_build_info,
|
||||
* containing the node-affinity for the domain.
|
||||
*/
|
||||
#define LIBXL_HAVE_DOMAIN_NODEAFFINITY 1
|
||||
|
||||
/*
|
||||
* libxl ABI compatibility
|
||||
*
|
||||
@@ -884,6 +891,10 @@ int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
|
||||
libxl_bitmap *cpumap);
|
||||
int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
|
||||
unsigned int max_vcpus, libxl_bitmap *cpumap);
|
||||
int libxl_domain_set_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_bitmap *nodemap);
|
||||
int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid,
|
||||
libxl_bitmap *nodemap);
|
||||
int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap);
|
||||
|
||||
libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx);
|
||||
|
||||
@@ -191,6 +191,12 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
|
||||
|
||||
libxl_defbool_setdefault(&b_info->numa_placement, true);
|
||||
|
||||
if (!b_info->nodemap.size) {
|
||||
if (libxl_node_bitmap_alloc(CTX, &b_info->nodemap, 0))
|
||||
return ERROR_FAIL;
|
||||
libxl_bitmap_set_any(&b_info->nodemap);
|
||||
}
|
||||
|
||||
if (b_info->max_memkb == LIBXL_MEMKB_DEFAULT)
|
||||
b_info->max_memkb = 32 * 1024;
|
||||
if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT)
|
||||
|
||||
@@ -230,6 +230,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
libxl_domain_set_nodeaffinity(ctx, domid, &info->nodemap);
|
||||
libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
|
||||
|
||||
xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
|
||||
|
||||
@@ -263,6 +263,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
|
||||
("max_vcpus", integer),
|
||||
("avail_vcpus", libxl_bitmap),
|
||||
("cpumap", libxl_bitmap),
|
||||
("nodemap", libxl_bitmap),
|
||||
("numa_placement", libxl_defbool),
|
||||
("tsc_mode", libxl_tsc_mode),
|
||||
("max_memkb", MemKB),
|
||||
|
||||