提交 acc288d6 编写于 作者: B Bing Niu 提交者: John Ferlan

conf: Rename cachetune to resctrl

Resctrl not only supports cache tuning, but also memory bandwidth
tuning. Renaming cachetune to resctrl to reflect that. With resctrl,
all allocation for different resources (cache, memory bandwidth) are
aggregated and represented by a virResctrlAllocPtr inside
virDomainResctrlDef.
Signed-off-by: NBing Niu <bing.niu@intel.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 5b66c6cc
...@@ -2966,14 +2966,14 @@ virDomainLoaderDefFree(virDomainLoaderDefPtr loader) ...@@ -2966,14 +2966,14 @@ virDomainLoaderDefFree(virDomainLoaderDefPtr loader)
static void static void
virDomainCachetuneDefFree(virDomainCachetuneDefPtr cachetune) virDomainResctrlDefFree(virDomainResctrlDefPtr resctrl)
{ {
if (!cachetune) if (!resctrl)
return; return;
virObjectUnref(cachetune->alloc); virObjectUnref(resctrl->alloc);
virBitmapFree(cachetune->vcpus); virBitmapFree(resctrl->vcpus);
VIR_FREE(cachetune); VIR_FREE(resctrl);
} }
...@@ -3163,9 +3163,9 @@ void virDomainDefFree(virDomainDefPtr def) ...@@ -3163,9 +3163,9 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainShmemDefFree(def->shmems[i]); virDomainShmemDefFree(def->shmems[i]);
VIR_FREE(def->shmems); VIR_FREE(def->shmems);
for (i = 0; i < def->ncachetunes; i++) for (i = 0; i < def->nresctrls; i++)
virDomainCachetuneDefFree(def->cachetunes[i]); virDomainResctrlDefFree(def->resctrls[i]);
VIR_FREE(def->cachetunes); VIR_FREE(def->resctrls);
VIR_FREE(def->keywrap); VIR_FREE(def->keywrap);
...@@ -19162,7 +19162,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ...@@ -19162,7 +19162,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
virBitmapPtr vcpus = NULL; virBitmapPtr vcpus = NULL;
virResctrlAllocPtr alloc = virResctrlAllocNew(); virResctrlAllocPtr alloc = virResctrlAllocNew();
virDomainCachetuneDefPtr tmp_cachetune = NULL; virDomainResctrlDefPtr tmp_resctrl = NULL;
char *tmp = NULL; char *tmp = NULL;
char *vcpus_str = NULL; char *vcpus_str = NULL;
char *alloc_id = NULL; char *alloc_id = NULL;
...@@ -19175,7 +19175,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ...@@ -19175,7 +19175,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
if (!alloc) if (!alloc)
goto cleanup; goto cleanup;
if (VIR_ALLOC(tmp_cachetune) < 0) if (VIR_ALLOC(tmp_resctrl) < 0)
goto cleanup; goto cleanup;
vcpus_str = virXMLPropString(node, "vcpus"); vcpus_str = virXMLPropString(node, "vcpus");
...@@ -19216,8 +19216,8 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ...@@ -19216,8 +19216,8 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
goto cleanup; goto cleanup;
} }
for (i = 0; i < def->ncachetunes; i++) { for (i = 0; i < def->nresctrls; i++) {
if (virBitmapOverlaps(def->cachetunes[i]->vcpus, vcpus)) { if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("Overlapping vcpus in cachetunes")); _("Overlapping vcpus in cachetunes"));
goto cleanup; goto cleanup;
...@@ -19247,16 +19247,16 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ...@@ -19247,16 +19247,16 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
if (virResctrlAllocSetID(alloc, alloc_id) < 0) if (virResctrlAllocSetID(alloc, alloc_id) < 0)
goto cleanup; goto cleanup;
VIR_STEAL_PTR(tmp_cachetune->vcpus, vcpus); VIR_STEAL_PTR(tmp_resctrl->vcpus, vcpus);
VIR_STEAL_PTR(tmp_cachetune->alloc, alloc); VIR_STEAL_PTR(tmp_resctrl->alloc, alloc);
if (VIR_APPEND_ELEMENT(def->cachetunes, def->ncachetunes, tmp_cachetune) < 0) if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, tmp_resctrl) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
cleanup: cleanup:
ctxt->node = oldnode; ctxt->node = oldnode;
virDomainCachetuneDefFree(tmp_cachetune); virDomainResctrlDefFree(tmp_resctrl);
virObjectUnref(alloc); virObjectUnref(alloc);
virBitmapFree(vcpus); virBitmapFree(vcpus);
VIR_FREE(alloc_id); VIR_FREE(alloc_id);
...@@ -27089,7 +27089,7 @@ virDomainCachetuneDefFormatHelper(unsigned int level, ...@@ -27089,7 +27089,7 @@ virDomainCachetuneDefFormatHelper(unsigned int level,
static int static int
virDomainCachetuneDefFormat(virBufferPtr buf, virDomainCachetuneDefFormat(virBufferPtr buf,
virDomainCachetuneDefPtr cachetune, virDomainResctrlDefPtr resctrl,
unsigned int flags) unsigned int flags)
{ {
virBuffer childrenBuf = VIR_BUFFER_INITIALIZER; virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
...@@ -27097,7 +27097,7 @@ virDomainCachetuneDefFormat(virBufferPtr buf, ...@@ -27097,7 +27097,7 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
int ret = -1; int ret = -1;
virBufferSetChildIndent(&childrenBuf, buf); virBufferSetChildIndent(&childrenBuf, buf);
virResctrlAllocForeachCache(cachetune->alloc, virResctrlAllocForeachCache(resctrl->alloc,
virDomainCachetuneDefFormatHelper, virDomainCachetuneDefFormatHelper,
&childrenBuf); &childrenBuf);
...@@ -27110,14 +27110,14 @@ virDomainCachetuneDefFormat(virBufferPtr buf, ...@@ -27110,14 +27110,14 @@ virDomainCachetuneDefFormat(virBufferPtr buf,
goto cleanup; goto cleanup;
} }
vcpus = virBitmapFormat(cachetune->vcpus); vcpus = virBitmapFormat(resctrl->vcpus);
if (!vcpus) if (!vcpus)
goto cleanup; goto cleanup;
virBufferAsprintf(buf, "<cachetune vcpus='%s'", vcpus); virBufferAsprintf(buf, "<cachetune vcpus='%s'", vcpus);
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) { if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
const char *alloc_id = virResctrlAllocGetID(cachetune->alloc); const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
if (!alloc_id) if (!alloc_id)
goto cleanup; goto cleanup;
...@@ -27238,8 +27238,8 @@ virDomainCputuneDefFormat(virBufferPtr buf, ...@@ -27238,8 +27238,8 @@ virDomainCputuneDefFormat(virBufferPtr buf,
def->iothreadids[i]->iothread_id); def->iothreadids[i]->iothread_id);
} }
for (i = 0; i < def->ncachetunes; i++) for (i = 0; i < def->nresctrls; i++)
virDomainCachetuneDefFormat(&childrenBuf, def->cachetunes[i], flags); virDomainCachetuneDefFormat(&childrenBuf, def->resctrls[i], flags);
if (virBufferCheckError(&childrenBuf) < 0) if (virBufferCheckError(&childrenBuf) < 0)
return -1; return -1;
......
...@@ -2232,10 +2232,10 @@ struct _virDomainCputune { ...@@ -2232,10 +2232,10 @@ struct _virDomainCputune {
}; };
typedef struct _virDomainCachetuneDef virDomainCachetuneDef; typedef struct _virDomainResctrlDef virDomainResctrlDef;
typedef virDomainCachetuneDef *virDomainCachetuneDefPtr; typedef virDomainResctrlDef *virDomainResctrlDefPtr;
struct _virDomainCachetuneDef { struct _virDomainResctrlDef {
virBitmapPtr vcpus; virBitmapPtr vcpus;
virResctrlAllocPtr alloc; virResctrlAllocPtr alloc;
}; };
...@@ -2413,8 +2413,8 @@ struct _virDomainDef { ...@@ -2413,8 +2413,8 @@ struct _virDomainDef {
virDomainCputune cputune; virDomainCputune cputune;
virDomainCachetuneDefPtr *cachetunes; virDomainResctrlDefPtr *resctrls;
size_t ncachetunes; size_t nresctrls;
virDomainNumaPtr numa; virDomainNumaPtr numa;
virDomainResourceDefPtr resource; virDomainResourceDefPtr resource;
......
...@@ -3999,7 +3999,7 @@ qemuDomainDefValidate(const virDomainDef *def, ...@@ -3999,7 +3999,7 @@ qemuDomainDefValidate(const virDomainDef *def,
} }
} }
if (def->ncachetunes && if (def->nresctrls &&
def->virtType != VIR_DOMAIN_VIRT_KVM) { def->virtType != VIR_DOMAIN_VIRT_KVM) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("cachetune is only supported for KVM domains")); _("cachetune is only supported for KVM domains"));
......
...@@ -2559,7 +2559,7 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver, ...@@ -2559,7 +2559,7 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver,
virCapsPtr caps = NULL; virCapsPtr caps = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
if (!vm->def->ncachetunes) if (!vm->def->nresctrls)
return 0; return 0;
/* Force capability refresh since resctrl info can change /* Force capability refresh since resctrl info can change
...@@ -2568,9 +2568,9 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver, ...@@ -2568,9 +2568,9 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver,
if (!caps) if (!caps)
return -1; return -1;
for (i = 0; i < vm->def->ncachetunes; i++) { for (i = 0; i < vm->def->nresctrls; i++) {
if (virResctrlAllocCreate(caps->host.resctrl, if (virResctrlAllocCreate(caps->host.resctrl,
vm->def->cachetunes[i]->alloc, vm->def->resctrls[i]->alloc,
priv->machineName) < 0) priv->machineName) < 0)
goto cleanup; goto cleanup;
} }
...@@ -5388,8 +5388,8 @@ qemuProcessSetupVcpu(virDomainObjPtr vm, ...@@ -5388,8 +5388,8 @@ qemuProcessSetupVcpu(virDomainObjPtr vm,
&vcpu->sched) < 0) &vcpu->sched) < 0)
return -1; return -1;
for (i = 0; i < vm->def->ncachetunes; i++) { for (i = 0; i < vm->def->nresctrls; i++) {
virDomainCachetuneDefPtr ct = vm->def->cachetunes[i]; virDomainResctrlDefPtr ct = vm->def->resctrls[i];
if (virBitmapIsBitSet(ct->vcpus, vcpuid)) { if (virBitmapIsBitSet(ct->vcpus, vcpuid)) {
if (virResctrlAllocAddPID(ct->alloc, vcpupid) < 0) if (virResctrlAllocAddPID(ct->alloc, vcpupid) < 0)
...@@ -7091,8 +7091,8 @@ void qemuProcessStop(virQEMUDriverPtr driver, ...@@ -7091,8 +7091,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
/* Remove resctrl allocation after cgroups are cleaned up which makes it /* Remove resctrl allocation after cgroups are cleaned up which makes it
* kind of safer (although removing the allocation should work even with * kind of safer (although removing the allocation should work even with
* pids in tasks file */ * pids in tasks file */
for (i = 0; i < vm->def->ncachetunes; i++) for (i = 0; i < vm->def->nresctrls; i++)
virResctrlAllocRemove(vm->def->cachetunes[i]->alloc); virResctrlAllocRemove(vm->def->resctrls[i]->alloc);
qemuProcessRemoveDomainStatus(driver, vm); qemuProcessRemoveDomainStatus(driver, vm);
...@@ -7818,8 +7818,8 @@ qemuProcessReconnect(void *opaque) ...@@ -7818,8 +7818,8 @@ qemuProcessReconnect(void *opaque)
if (qemuConnectAgent(driver, obj) < 0) if (qemuConnectAgent(driver, obj) < 0)
goto error; goto error;
for (i = 0; i < obj->def->ncachetunes; i++) { for (i = 0; i < obj->def->nresctrls; i++) {
if (virResctrlAllocDeterminePath(obj->def->cachetunes[i]->alloc, if (virResctrlAllocDeterminePath(obj->def->resctrls[i]->alloc,
priv->machineName) < 0) priv->machineName) < 0)
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册