mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-11 12:25:52 +00:00
qemu: Support numad
numad is an user-level daemon that monitors NUMA topology and processes resource consumption to facilitate good NUMA resource alignment of applications/virtual machines to improve performance and minimize cost of remote memory latencies. It provides a pre-placement advisory interface, so significant processes can be pre-bound to nodes with sufficient available resources. More details: http://fedoraproject.org/wiki/Features/numad "numad -w ncpus:memory_amount" is the advisory interface numad provides currently. This patch add the support by introducing a new XML attribute for <vcpu>. e.g. <vcpu placement="auto">4</vcpu> <vcpu placement="static" cpuset="1-10^6">4</vcpu> The returned advisory nodeset from numad will be printed in domain's dumped XML. e.g. <vcpu placement="auto" cpuset="1-10^6">4</vcpu> If placement is "auto", the number of vcpus and the current memory amount specified in domain XML will be used for numad command line (numad uses MB for memory amount): numad -w $num_of_vcpus:$current_memory_amount / 1024 The advisory nodeset returned from numad will be used to set domain process CPU affinity then. (e.g. qemuProcessInitCpuAffinity). If the user specifies both CPU affinity policy (e.g. (<vcpu cpuset="1-10,^7,^8">4</vcpu>) and placement == "auto" the specified CPU affinity will be overridden. Only QEMU/KVM drivers support it now. See docs update in patch for more details.
This commit is contained in:
parent
3165602a55
commit
0f8e7ae33a
@ -1445,6 +1445,14 @@ AM_CONDITIONAL([HAVE_NUMACTL], [test "$with_numactl" != "no"])
|
|||||||
AC_SUBST([NUMACTL_CFLAGS])
|
AC_SUBST([NUMACTL_CFLAGS])
|
||||||
AC_SUBST([NUMACTL_LIBS])
|
AC_SUBST([NUMACTL_LIBS])
|
||||||
|
|
||||||
|
dnl Do we have numad?
|
||||||
|
if test "$with_qemu" = "yes"; then
|
||||||
|
AC_PATH_PROG([NUMAD], [numad], [], [/bin:/usr/bin:/usr/local/bin:$PATH])
|
||||||
|
|
||||||
|
if test -n "$NUMAD"; then
|
||||||
|
AC_DEFINE_UNQUOTED([NUMAD],["$NUMAD"], [Location or name of the numad program])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl pcap lib
|
dnl pcap lib
|
||||||
LIBPCAP_CONFIG="pcap-config"
|
LIBPCAP_CONFIG="pcap-config"
|
||||||
|
@ -318,7 +318,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
<domain>
|
<domain>
|
||||||
...
|
...
|
||||||
<vcpu cpuset="1-4,^3,6" current="1">2</vcpu>
|
<vcpu placement='static' cpuset="1-4,^3,6" current="1">2</vcpu>
|
||||||
...
|
...
|
||||||
</domain>
|
</domain>
|
||||||
</pre>
|
</pre>
|
||||||
@ -336,7 +336,18 @@
|
|||||||
be excluded from a previous range. <span class="since">Since
|
be excluded from a previous range. <span class="since">Since
|
||||||
0.8.5</span>, the optional attribute <code>current</code> can
|
0.8.5</span>, the optional attribute <code>current</code> can
|
||||||
be used to specify whether fewer than the maximum number of
|
be used to specify whether fewer than the maximum number of
|
||||||
virtual CPUs should be enabled.
|
virtual CPUs should be enabled. <span class="since">Since
|
||||||
|
0.9.11 (QEMU and KVM only), the optional attribute
|
||||||
|
<code>placement</code> can be used to indicate the CPU placement
|
||||||
|
mode for domain process, its value can be either "static" or
|
||||||
|
"auto", defaults to "static" if <code>cpuset</code> is specified,
|
||||||
|
"auto" indicates the domain process will be pinned to the advisory
|
||||||
|
nodeset from querying numad, and the value of attribute
|
||||||
|
<code>cpuset</code> will be overridden by the advisory nodeset
|
||||||
|
from numad if it's specified. If both <code>cpuset</code> and
|
||||||
|
<code>placement</code> are not specified, or if <code>placement</code>
|
||||||
|
is "static", but no <code>cpuset</code> is specified, the domain
|
||||||
|
process will be pinned to all the available physical CPUs.
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@ -544,7 +555,7 @@
|
|||||||
<span class='since'>Since 0.9.3</span>
|
<span class='since'>Since 0.9.3</span>
|
||||||
<dt><code>memory</code></dt>
|
<dt><code>memory</code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
The optional <code>memory</code> element specify how to allocate memory
|
The optional <code>memory</code> element specifies how to allocate memory
|
||||||
for the domain process on a NUMA host. It contains two attributes,
|
for the domain process on a NUMA host. It contains two attributes,
|
||||||
attribute <code>mode</code> is either 'interleave', 'strict',
|
attribute <code>mode</code> is either 'interleave', 'strict',
|
||||||
or 'preferred',
|
or 'preferred',
|
||||||
|
@ -487,6 +487,14 @@
|
|||||||
|
|
||||||
<optional>
|
<optional>
|
||||||
<element name="vcpu">
|
<element name="vcpu">
|
||||||
|
<optional>
|
||||||
|
<attribute name="placement">
|
||||||
|
<choice>
|
||||||
|
<value>static</value>
|
||||||
|
<value>auto</value>
|
||||||
|
</choice>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
<optional>
|
<optional>
|
||||||
<attribute name="cpuset">
|
<attribute name="cpuset">
|
||||||
<ref name="cpuset"/>
|
<ref name="cpuset"/>
|
||||||
|
@ -624,6 +624,11 @@ VIR_ENUM_IMPL(virDomainStartupPolicy, VIR_DOMAIN_STARTUP_POLICY_LAST,
|
|||||||
"requisite",
|
"requisite",
|
||||||
"optional");
|
"optional");
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainCpuPlacementMode, VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST,
|
||||||
|
"default",
|
||||||
|
"static",
|
||||||
|
"auto");
|
||||||
|
|
||||||
#define virDomainReportError(code, ...) \
|
#define virDomainReportError(code, ...) \
|
||||||
virReportErrorHelper(VIR_FROM_DOMAIN, code, __FILE__, \
|
virReportErrorHelper(VIR_FROM_DOMAIN, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||||
@ -7497,7 +7502,6 @@ error:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int virDomainDefMaybeAddController(virDomainDefPtr def,
|
static int virDomainDefMaybeAddController(virDomainDefPtr def,
|
||||||
int type,
|
int type,
|
||||||
int idx)
|
int idx)
|
||||||
@ -7611,6 +7615,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
bool uuid_generated = false;
|
bool uuid_generated = false;
|
||||||
virBitmapPtr bootMap = NULL;
|
virBitmapPtr bootMap = NULL;
|
||||||
unsigned long bootMapSize = 0;
|
unsigned long bootMapSize = 0;
|
||||||
|
xmlNodePtr cur;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0) {
|
if (VIR_ALLOC(def) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -7839,6 +7844,22 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp = virXPathString("string(./vcpu[1]/@placement)", ctxt);
|
||||||
|
if (tmp) {
|
||||||
|
if ((def->placement_mode =
|
||||||
|
virDomainCpuPlacementModeTypeFromString(tmp)) < 0) {
|
||||||
|
virDomainReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("Unsupported CPU placement mode '%s'"),
|
||||||
|
tmp);
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
} else {
|
||||||
|
if (def->cpumasklen)
|
||||||
|
def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
|
||||||
|
}
|
||||||
|
|
||||||
/* Extract cpu tunables. */
|
/* Extract cpu tunables. */
|
||||||
if (virXPathULong("string(./cputune/shares[1])", ctxt,
|
if (virXPathULong("string(./cputune/shares[1])", ctxt,
|
||||||
&def->cputune.shares) < 0)
|
&def->cputune.shares) < 0)
|
||||||
@ -7886,47 +7907,74 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
|||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
/* Extract numatune if exists. */
|
/* Extract numatune if exists. */
|
||||||
if ((n = virXPathNodeSet("./numatune", ctxt, NULL)) < 0) {
|
if ((n = virXPathNodeSet("./numatune", ctxt, &nodes)) < 0) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot extract numatune nodes"));
|
"%s", _("cannot extract numatune nodes"));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n > 1) {
|
||||||
|
virDomainReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("only one numatune is supported"));
|
||||||
|
VIR_FREE(nodes);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
tmp = virXPathString("string(./numatune/memory/@nodeset)", ctxt);
|
cur = nodes[0]->children;
|
||||||
if (tmp) {
|
while (cur != NULL) {
|
||||||
char *set = tmp;
|
if (cur->type == XML_ELEMENT_NODE) {
|
||||||
int nodemasklen = VIR_DOMAIN_CPUMASK_LEN;
|
if ((xmlStrEqual(cur->name, BAD_CAST "memory"))) {
|
||||||
|
tmp = virXMLPropString(cur, "nodeset");
|
||||||
|
|
||||||
if (VIR_ALLOC_N(def->numatune.memory.nodemask, nodemasklen) < 0) {
|
if (tmp) {
|
||||||
goto no_memory;
|
char *set = tmp;
|
||||||
|
int nodemasklen = VIR_DOMAIN_CPUMASK_LEN;
|
||||||
|
|
||||||
|
if (VIR_ALLOC_N(def->numatune.memory.nodemask,
|
||||||
|
nodemasklen) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "nodeset" leads same syntax with "cpuset". */
|
||||||
|
if (virDomainCpuSetParse(set, 0,
|
||||||
|
def->numatune.memory.nodemask,
|
||||||
|
nodemasklen) < 0)
|
||||||
|
goto error;
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
} else {
|
||||||
|
virDomainReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("nodeset for NUMA memory "
|
||||||
|
"tuning must be set"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = virXMLPropString(cur, "mode");
|
||||||
|
if (tmp) {
|
||||||
|
if ((def->numatune.memory.mode =
|
||||||
|
virDomainNumatuneMemModeTypeFromString(tmp)) < 0) {
|
||||||
|
virDomainReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("Unsupported NUMA memory "
|
||||||
|
"tuning mode '%s'"),
|
||||||
|
tmp);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
} else {
|
||||||
|
def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
virDomainReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("unsupported XML element %s"),
|
||||||
|
(const char *)cur->name);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
cur = cur->next;
|
||||||
/* "nodeset" leads same syntax with "cpuset". */
|
|
||||||
if (virDomainCpuSetParse(set, 0, def->numatune.memory.nodemask,
|
|
||||||
nodemasklen) < 0)
|
|
||||||
goto error;
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
} else {
|
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
"%s", _("nodeset for NUMA memory tuning must be set"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = virXPathString("string(./numatune/memory/@mode)", ctxt);
|
|
||||||
if (tmp) {
|
|
||||||
if ((def->numatune.memory.mode =
|
|
||||||
virDomainNumatuneMemModeTypeFromString(tmp)) < 0) {
|
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Unsupported NUMA memory tuning mode '%s'"),
|
|
||||||
tmp);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
VIR_FREE(tmp);
|
|
||||||
} else {
|
|
||||||
def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
n = virXPathNodeSet("./features/*", ctxt, &nodes);
|
n = virXPathNodeSet("./features/*", ctxt, &nodes);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
@ -12214,6 +12262,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
allones = 0;
|
allones = 0;
|
||||||
|
|
||||||
virBufferAddLit(buf, " <vcpu");
|
virBufferAddLit(buf, " <vcpu");
|
||||||
|
if (def->placement_mode)
|
||||||
|
virBufferAsprintf(buf, " placement='%s'",
|
||||||
|
virDomainCpuPlacementModeTypeToString(def->placement_mode));
|
||||||
if (!allones) {
|
if (!allones) {
|
||||||
char *cpumask = NULL;
|
char *cpumask = NULL;
|
||||||
if ((cpumask =
|
if ((cpumask =
|
||||||
@ -12265,22 +12316,24 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
virBufferAddLit(buf, " </cputune>\n");
|
virBufferAddLit(buf, " </cputune>\n");
|
||||||
|
|
||||||
if (def->numatune.memory.nodemask) {
|
if (def->numatune.memory.nodemask) {
|
||||||
|
virBufferAddLit(buf, " <numatune>\n");
|
||||||
const char *mode;
|
const char *mode;
|
||||||
char *nodemask = NULL;
|
char *nodemask = NULL;
|
||||||
|
|
||||||
virBufferAddLit(buf, " <numatune>\n");
|
|
||||||
nodemask = virDomainCpuSetFormat(def->numatune.memory.nodemask,
|
nodemask = virDomainCpuSetFormat(def->numatune.memory.nodemask,
|
||||||
VIR_DOMAIN_CPUMASK_LEN);
|
VIR_DOMAIN_CPUMASK_LEN);
|
||||||
if (nodemask == NULL) {
|
if (nodemask == NULL) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to format nodeset for NUMA memory tuning"));
|
_("failed to format nodeset for "
|
||||||
|
"NUMA memory tuning"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = virDomainNumatuneMemModeTypeToString(def->numatune.memory.mode);
|
mode = virDomainNumatuneMemModeTypeToString(def->numatune.memory.mode);
|
||||||
virBufferAsprintf(buf, " <memory mode='%s' nodeset='%s'/>\n",
|
virBufferAsprintf(buf, " <memory mode='%s' nodeset='%s'/>\n",
|
||||||
mode, nodemask);
|
mode, nodemask);
|
||||||
VIR_FREE(nodemask);
|
VIR_FREE(nodemask);
|
||||||
|
|
||||||
virBufferAddLit(buf, " </numatune>\n");
|
virBufferAddLit(buf, " </numatune>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,6 +1394,14 @@ enum virDomainTimerModeType {
|
|||||||
VIR_DOMAIN_TIMER_MODE_LAST,
|
VIR_DOMAIN_TIMER_MODE_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum virDomainCpuPlacementMode {
|
||||||
|
VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT = 0,
|
||||||
|
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
|
||||||
|
VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO,
|
||||||
|
|
||||||
|
VIR_DOMAIN_CPU_PLACEMENT_MODE_LAST,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
|
typedef struct _virDomainTimerCatchupDef virDomainTimerCatchupDef;
|
||||||
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
|
typedef virDomainTimerCatchupDef *virDomainTimerCatchupDefPtr;
|
||||||
struct _virDomainTimerCatchupDef {
|
struct _virDomainTimerCatchupDef {
|
||||||
@ -1520,6 +1528,7 @@ struct _virDomainDef {
|
|||||||
} mem;
|
} mem;
|
||||||
unsigned short vcpus;
|
unsigned short vcpus;
|
||||||
unsigned short maxvcpus;
|
unsigned short maxvcpus;
|
||||||
|
int placement_mode;
|
||||||
int cpumasklen;
|
int cpumasklen;
|
||||||
char *cpumask;
|
char *cpumask;
|
||||||
|
|
||||||
@ -2161,6 +2170,7 @@ VIR_ENUM_DECL(virDomainTimerName)
|
|||||||
VIR_ENUM_DECL(virDomainTimerTrack)
|
VIR_ENUM_DECL(virDomainTimerTrack)
|
||||||
VIR_ENUM_DECL(virDomainTimerTickpolicy)
|
VIR_ENUM_DECL(virDomainTimerTickpolicy)
|
||||||
VIR_ENUM_DECL(virDomainTimerMode)
|
VIR_ENUM_DECL(virDomainTimerMode)
|
||||||
|
VIR_ENUM_DECL(virDomainCpuPlacementMode)
|
||||||
|
|
||||||
VIR_ENUM_DECL(virDomainStartupPolicy)
|
VIR_ENUM_DECL(virDomainStartupPolicy)
|
||||||
|
|
||||||
|
@ -271,6 +271,8 @@ virDomainControllerModelSCSITypeToString;
|
|||||||
virDomainControllerModelUSBTypeFromString;
|
virDomainControllerModelUSBTypeFromString;
|
||||||
virDomainControllerModelUSBTypeToString;
|
virDomainControllerModelUSBTypeToString;
|
||||||
virDomainControllerTypeToString;
|
virDomainControllerTypeToString;
|
||||||
|
virDomainCpuPlacementTypeFromString;
|
||||||
|
virDomainCpuPlacementTypeToString;
|
||||||
virDomainCpuSetFormat;
|
virDomainCpuSetFormat;
|
||||||
virDomainCpuSetParse;
|
virDomainCpuSetParse;
|
||||||
virDomainDefAddImplicitControllers;
|
virDomainDefAddImplicitControllers;
|
||||||
|
@ -1633,11 +1633,47 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NUMAD)
|
||||||
|
static char *
|
||||||
|
qemuGetNumadAdvice(virDomainDefPtr def)
|
||||||
|
{
|
||||||
|
virCommandPtr cmd = NULL;
|
||||||
|
char *args = NULL;
|
||||||
|
char *output = NULL;
|
||||||
|
|
||||||
|
if (virAsprintf(&args, "%d:%lu", def->vcpus, def->mem.cur_balloon) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
cmd = virCommandNewArgList(NUMAD, "-w", args, NULL);
|
||||||
|
|
||||||
|
virCommandSetOutputBuffer(cmd, &output);
|
||||||
|
|
||||||
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
|
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Failed to query numad for the advisory nodeset"));
|
||||||
|
|
||||||
|
out:
|
||||||
|
VIR_FREE(args);
|
||||||
|
virCommandFree(cmd);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static char *
|
||||||
|
qemuGetNumadAdvice(virDomainDefPtr def ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("numad is not available on this host"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To be run between fork/exec of QEMU only
|
* To be run between fork/exec of QEMU only
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qemuProcessInitCpuAffinity(virDomainObjPtr vm)
|
qemuProcessInitCpuAffinity(struct qemud_driver *driver,
|
||||||
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
int i, hostcpus, maxcpu = QEMUD_CPUMASK_LEN;
|
int i, hostcpus, maxcpu = QEMUD_CPUMASK_LEN;
|
||||||
virNodeInfo nodeinfo;
|
virNodeInfo nodeinfo;
|
||||||
@ -1661,19 +1697,53 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm->def->cpumask) {
|
if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
|
||||||
/* XXX why don't we keep 'cpumask' in the libvirt cpumap
|
char *tmp_cpumask = NULL;
|
||||||
* format to start with ?!?! */
|
char *nodeset = NULL;
|
||||||
for (i = 0 ; i < maxcpu && i < vm->def->cpumasklen ; i++)
|
|
||||||
if (vm->def->cpumask[i])
|
nodeset = qemuGetNumadAdvice(vm->def);
|
||||||
|
if (!nodeset)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (VIR_ALLOC_N(tmp_cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virDomainCpuSetParse(nodeset, 0, tmp_cpumask,
|
||||||
|
VIR_DOMAIN_CPUMASK_LEN) < 0) {
|
||||||
|
VIR_FREE(tmp_cpumask);
|
||||||
|
VIR_FREE(nodeset);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < maxcpu && i < VIR_DOMAIN_CPUMASK_LEN; i++) {
|
||||||
|
if (tmp_cpumask[i])
|
||||||
VIR_USE_CPU(cpumap, i);
|
VIR_USE_CPU(cpumap, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_FREE(vm->def->cpumask);
|
||||||
|
vm->def->cpumask = tmp_cpumask;
|
||||||
|
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
|
||||||
|
VIR_WARN("Unable to save status on vm %s after state change",
|
||||||
|
vm->def->name);
|
||||||
|
}
|
||||||
|
VIR_FREE(nodeset);
|
||||||
} else {
|
} else {
|
||||||
/* You may think this is redundant, but we can't assume libvirtd
|
if (vm->def->cpumask) {
|
||||||
* itself is running on all pCPUs, so we need to explicitly set
|
/* XXX why don't we keep 'cpumask' in the libvirt cpumap
|
||||||
* the spawned QEMU instance to all pCPUs if no map is given in
|
* format to start with ?!?! */
|
||||||
* its config file */
|
for (i = 0 ; i < maxcpu && i < vm->def->cpumasklen ; i++)
|
||||||
for (i = 0 ; i < maxcpu ; i++)
|
if (vm->def->cpumask[i])
|
||||||
VIR_USE_CPU(cpumap, i);
|
VIR_USE_CPU(cpumap, i);
|
||||||
|
} else {
|
||||||
|
/* You may think this is redundant, but we can't assume libvirtd
|
||||||
|
* itself is running on all pCPUs, so we need to explicitly set
|
||||||
|
* the spawned QEMU instance to all pCPUs if no map is given in
|
||||||
|
* its config file */
|
||||||
|
for (i = 0 ; i < maxcpu ; i++)
|
||||||
|
VIR_USE_CPU(cpumap, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are pressuming we are running between fork/exec of QEMU
|
/* We are pressuming we are running between fork/exec of QEMU
|
||||||
@ -2404,7 +2474,7 @@ static int qemuProcessHook(void *data)
|
|||||||
/* This must be done after cgroup placement to avoid resetting CPU
|
/* This must be done after cgroup placement to avoid resetting CPU
|
||||||
* affinity */
|
* affinity */
|
||||||
VIR_DEBUG("Setup CPU affinity");
|
VIR_DEBUG("Setup CPU affinity");
|
||||||
if (qemuProcessInitCpuAffinity(h->vm) < 0)
|
if (qemuProcessInitCpuAffinity(h->driver, h->vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuProcessInitNumaMemoryPolicy(h->vm) < 0)
|
if (qemuProcessInitNumaMemoryPolicy(h->vm) < 0)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</metadata>
|
</metadata>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<name>QEMUGuest1</name>
|
<name>QEMUGuest1</name>
|
||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219136</memory>
|
<memory unit='KiB'>219136</memory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<name>QEMUGuest1</name>
|
<name>QEMUGuest1</name>
|
||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219136</memory>
|
<memory unit='KiB'>219136</memory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</description>
|
</description>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</metadata>
|
</metadata>
|
||||||
<memory unit='KiB'>219100</memory>
|
<memory unit='KiB'>219100</memory>
|
||||||
<currentMemory unit='KiB'>219100</currentMemory>
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
<vcpu cpuset='1-4,8-20,525'>1</vcpu>
|
<vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
|
||||||
<os>
|
<os>
|
||||||
<type arch='i686' machine='pc'>hvm</type>
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user