[libvirt] [PATCHv4 11/18] conf: Refactor code for matching existing resctrls
Refactoring the code of matching the new resctrl with existing resctrl groups. Add the virObjectRef action into function virDomainResctrlVcpuMatch. Signed-off-by: Wang Huaqiang --- src/conf/domain_conf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b77680e..e2b4701 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18833,7 +18833,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def, * Just updating memory allocation information of that group */ if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) { -*alloc = def->resctrls[i]->alloc; +*alloc = virObjectRef(def->resctrls[i]->alloc); break; } if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) { @@ -19225,8 +19225,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, if (!alloc) goto cleanup; new_alloc = true; -} else { -alloc = virObjectRef(alloc); } for (i = 0; i < n; i++) { -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 12/18] conf: Refactor virDomainResctrlAppend
Refactor virDomainResctrlAppend to facilitate virDomainResctrlDef with the capability to hold more element. Signed-off-by: Wang Huaqiang --- src/conf/domain_conf.c | 64 +++--- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e2b4701..9a514a6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18920,24 +18920,43 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt, } +static virDomainResctrlDefPtr +virDomainResctrlNew(virResctrlAllocPtr alloc, +virBitmapPtr vcpus) +{ +virDomainResctrlDefPtr resctrl = NULL; + +if (VIR_ALLOC(resctrl) < 0) +return NULL; + +if ((resctrl->vcpus = virBitmapNewCopy(vcpus)) == NULL) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to copy 'vcpus'")); +goto error; +} + +resctrl->alloc = virObjectRef(alloc); + +return resctrl; + error: +virDomainResctrlDefFree(resctrl); +return NULL; +} + + static int virDomainResctrlAppend(virDomainDefPtr def, xmlNodePtr node, - virResctrlAllocPtr alloc, - virBitmapPtr vcpus, + virDomainResctrlDefPtr resctrl, unsigned int flags) { char *vcpus_str = NULL; char *alloc_id = NULL; -virDomainResctrlDefPtr tmp_resctrl = NULL; int ret = -1; -if (VIR_ALLOC(tmp_resctrl) < 0) -goto cleanup; - /* We need to format it back because we need to be consistent in the naming * even when users specify some "sub-optimal" string there. */ -vcpus_str = virBitmapFormat(vcpus); +vcpus_str = virBitmapFormat(resctrl->vcpus); if (!vcpus_str) goto cleanup; @@ -18954,18 +18973,14 @@ virDomainResctrlAppend(virDomainDefPtr def, goto cleanup; } -if (virResctrlAllocSetID(alloc, alloc_id) < 0) +if (virResctrlAllocSetID(resctrl->alloc, alloc_id) < 0) goto cleanup; -tmp_resctrl->vcpus = vcpus; -tmp_resctrl->alloc = alloc; - -if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, tmp_resctrl) < 0) +if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) goto cleanup; ret = 0; cleanup: -virDomainResctrlDefFree(tmp_resctrl); VIR_FREE(alloc_id); VIR_FREE(vcpus_str); return ret; @@ -18982,6 +18997,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, xmlNodePtr *nodes = NULL; virBitmapPtr vcpus = NULL; virResctrlAllocPtr alloc = NULL; +virDomainResctrlDefPtr resctrl = NULL; ssize_t i = 0; int n; int ret = -1; @@ -19030,15 +19046,18 @@ virDomainCachetuneDefParse(virDomainDefPtr def, goto cleanup; } -if (virDomainResctrlAppend(def, node, alloc, vcpus, flags) < 0) +resctrl = virDomainResctrlNew(alloc, vcpus); +if (!resctrl) goto cleanup; -vcpus = NULL; -alloc = NULL; +if (virDomainResctrlAppend(def, node, resctrl, flags) < 0) +goto cleanup; +resctrl = NULL; ret = 0; cleanup: ctxt->node = oldnode; +virDomainResctrlDefFree(resctrl); virObjectUnref(alloc); virBitmapFree(vcpus); VIR_FREE(nodes); @@ -19196,6 +19215,8 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, xmlNodePtr *nodes = NULL; virBitmapPtr vcpus = NULL; virResctrlAllocPtr alloc = NULL; +virDomainResctrlDefPtr resctrl = NULL; + ssize_t i = 0; int n; int ret = -1; @@ -19240,15 +19261,20 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, * just update the existing alloc information, which is done in above * virDomainMemorytuneDefParseMemory */ if (new_alloc) { -if (virDomainResctrlAppend(def, node, alloc, vcpus, flags) < 0) +resctrl = virDomainResctrlNew(alloc, vcpus); +if (!resctrl) goto cleanup; -vcpus = NULL; -alloc = NULL; + +if (virDomainResctrlAppend(def, node, resctrl, flags) < 0) +goto cleanup; + +resctrl = NULL; } ret = 0; cleanup: ctxt->node = oldnode; +virDomainResctrlDefFree(resctrl); virObjectUnref(alloc); virBitmapFree(vcpus); VIR_FREE(nodes); -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 17/18] qemu: refactor qemuDomainGetStatsCpu
Refactoring qemuDomainGetStatsCpu, make it possible to add more CPU statistics. Signed-off-by: Wang Huaqiang --- src/qemu/qemu_driver.c | 45 ++--- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b238309..9cc6910 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19708,30 +19708,29 @@ qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, unsigned long long sys_time = 0; int err = 0; -if (!priv->cgroup) -return 0; - -err = virCgroupGetCpuacctUsage(priv->cgroup, _time); -if (!err && virTypedParamsAddULLong(>params, ->nparams, -maxparams, -"cpu.time", -cpu_time) < 0) -return -1; +if (priv->cgroup) { +err = virCgroupGetCpuacctUsage(priv->cgroup, _time); +if (!err && virTypedParamsAddULLong(>params, +>nparams, +maxparams, +"cpu.time", +cpu_time) < 0) +return -1; -err = virCgroupGetCpuacctStat(priv->cgroup, _time, _time); -if (!err && virTypedParamsAddULLong(>params, ->nparams, -maxparams, -"cpu.user", -user_time) < 0) -return -1; -if (!err && virTypedParamsAddULLong(>params, ->nparams, -maxparams, -"cpu.system", -sys_time) < 0) -return -1; +err = virCgroupGetCpuacctStat(priv->cgroup, _time, _time); +if (!err && virTypedParamsAddULLong(>params, +>nparams, +maxparams, +"cpu.user", +user_time) < 0) +return -1; +if (!err && virTypedParamsAddULLong(>params, +>nparams, +maxparams, +"cpu.system", +sys_time) < 0) +return -1; +} return 0; } -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 16/18] conf: Add a 'id' to virDomainResctrlDef
Adding element 'id' to virDomainResctrlDef. This 'id' reflects the attribute 'id' of of element 'cachetune in XML. virResctrlAlloc.id is a copy of virDomanResctrlDef.id. Signed-off-by: Wang Huaqiang --- src/conf/domain_conf.c | 20 src/conf/domain_conf.h | 1 + 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4f4604f..6da9dd4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2979,6 +2979,7 @@ virDomainResctrlDefFree(virDomainResctrlDefPtr resctrl) virObjectUnref(resctrl->alloc); virBitmapFree(resctrl->vcpus); VIR_FREE(resctrl->monitors); +VIR_FREE(resctrl->id); VIR_FREE(resctrl); } @@ -19138,6 +19139,9 @@ virDomainResctrlAppend(virDomainDefPtr def, goto cleanup; } +if (VIR_STRDUP(resctrl->id, alloc_id) < 0) +goto cleanup; + if (virResctrlAllocSetID(resctrl->alloc, alloc_id) < 0) goto cleanup; @@ -27320,13 +27324,9 @@ virDomainCachetuneDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "alloc); -if (!alloc_id) -goto cleanup; +if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) +virBufferAsprintf(buf, " id='%s'", resctrl->id); -virBufferAsprintf(buf, " id='%s'", alloc_id); -} virBufferAddLit(buf, ">\n"); virBufferAddBuffer(buf, ); @@ -27383,13 +27383,9 @@ virDomainMemorytuneDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "alloc); -if (!alloc_id) -goto cleanup; +if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) +virBufferAsprintf(buf, " id='%s'", resctrl->id); -virBufferAsprintf(buf, " id='%s'", alloc_id); -} virBufferAddLit(buf, ">\n"); virBufferAddBuffer(buf, ); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 60f6464..e190aa2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2248,6 +2248,7 @@ typedef struct _virDomainResctrlDef virDomainResctrlDef; typedef virDomainResctrlDef *virDomainResctrlDefPtr; struct _virDomainResctrlDef { +char *id; virBitmapPtr vcpus; virResctrlAllocPtr alloc; -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 18/18] qemu: Report cache occupancy (CMT) with domstats
Adding the interface in qemu to report CMT statistic information through command 'virsh domstats --cpu-total'. Below is a typical output: # virsh domstats 1 --cpu-total Domain: 'ubuntu16.04-base' ... cpu.cache.monitor.count=2 cpu.cache.0.name=vcpus_1 cpu.cache.0.vcpus=1 cpu.cache.0.bank.count=2 cpu.cache.0.bank.0.id=0 cpu.cache.0.bank.0.bytes=4505600 cpu.cache.0.bank.1.id=1 cpu.cache.0.bank.1.bytes=5586944 cpu.cache.1.name=vcpus_4-6 cpu.cache.1.vcpus=4,5,6 cpu.cache.1.bank.count=2 cpu.cache.1.bank.0.id=0 cpu.cache.1.bank.0.bytes=17571840 cpu.cache.1.bank.1.id=1 cpu.cache.1.bank.1.bytes=29106176 Signed-off-by: Wang Huaqiang --- src/qemu/qemu_driver.c | 231 - 1 file changed, 230 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9cc6910..943e443 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -102,6 +102,7 @@ #include "virnuma.h" #include "dirname.h" #include "netdev_bandwidth_conf.h" +#include "c-ctype.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -19691,10 +19692,234 @@ typedef enum { block stats */ } qemuDomainStatsFlags; - #define HAVE_JOB(flags) ((flags) & QEMU_DOMAIN_STATS_HAVE_JOB) +/* In terms of the output of virBitmapFormat, both '1-3' and '1,3' are valid + * outputs and represent different vcpu set. + * + * It is not easy to differentiate these two vcpu set formats at first glance. + * This function could be used to clear this ambiguity, it substitutes all '-' + * with ',' while generates semantically correct vcpu set. + * e.g. vcpu set string '1-3' will be replaced by string '1,2,3'. */ +static char * +qemuDomainVcpuFormatHelper(const char *vcpus) +{ +size_t i = 0; +int last = 0; +int start = 0; +char * tmp = NULL; +bool firstnum = true; +const char *cur = vcpus; +virBuffer buf = VIR_BUFFER_INITIALIZER; +char *ret = NULL; + +if (virStringIsEmpty(cur)) +return NULL; + +while (*cur != '\0') { +if (!c_isdigit(*cur)) +goto cleanup; + +if (virStrToLong_i(cur, , 10, ) < 0) +goto cleanup; +if (start < 0) +goto cleanup; + +cur = tmp; + +virSkipSpaces(); + +if (*cur == ',' || *cur == 0) { +if (!firstnum) +virBufferAddChar(, ','); +virBufferAsprintf(, "%d", start); +firstnum = false; +} else if (*cur == '-') { +cur++; +virSkipSpaces(); + +if (virStrToLong_i(cur, , 10, ) < 0) +goto cleanup; + +if (last < start) +goto cleanup; +cur = tmp; + +for (i = start; i <= last; i++) { +if (!firstnum) + +virBufferAddChar(, ','); +virBufferAsprintf(, "%ld", i); +firstnum = 0; +} + +virSkipSpaces(); +} + +if (*cur == ',') { +cur++; +virSkipSpaces(); +} else if (*cur == 0) { +break; +} else { +goto cleanup; +} +} + +ret = virBufferContentAndReset(); + cleanup: +virBufferFreeAndReset(); +return ret; +} + + +static int +qemuDomainGetStatsCpuResource(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, + virDomainObjPtr dom, + virDomainStatsRecordPtr record, + int *maxparams, + unsigned int privflags ATTRIBUTE_UNUSED, + virResctrlMonitorType restag) +{ +char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; +virDomainResctrlMonDefPtr domresmon = NULL; +virDomainResctrlDefPtr resctrl = NULL; +unsigned int nmonitors = NULL; +const char *restype = NULL; +unsigned int *vals = NULL; +unsigned int *ids = NULL; +size_t nvals = 0; +char *rawvcpus = NULL; +char *vcpus = NULL; +size_t i = 0; +size_t j = 0; +int ret = -1; + +if (!virDomainObjIsActive(dom)) +return 0; + +if (restag == VIR_RESCTRL_MONITOR_TYPE_CACHE) { +restype = "cache"; +} else { +VIR_DEBUG("Invalid CPU resource type"); +return -1; +} + +for (i = 0; i < dom->def->nresctrls; i++) { +resctrl = dom->def->resctrls[i]; + +for (j = 0; j < resctrl->nmonitors; j++) { +domresmon = resctrl->monitors[j]; +if (virResctrlMonitorIsRunning(domresmon->instance) && +domresmon->tag == restag) +nmonitors++; +} +} + +if (nmonitors) { +snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, +
[libvirt] [PATCHv4 06/18] util: Add monitor interface to determine path
Add interface for resctrl monitor to determine the path. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 32 src/util/virresctrl.h| 3 +++ 3 files changed, 36 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a6259f7..5a408c8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2678,6 +2678,7 @@ virResctrlInfoGetMonitorPrefix; virResctrlInfoMonFree; virResctrlInfoNew; virResctrlMonitorAddPID; +virResctrlMonitorDeterminePath; virResctrlMonitorNew; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 5beed92..de10a0c 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2467,3 +2467,35 @@ virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, { return virResctrlAddPID(monitor->path, pid); } + +int +virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, + const char *machinename) +{ +char *alloc_path = NULL; +char *parentpath = NULL; + +if (!monitor) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid resctrl monitor")); +return -1; +} + +if (monitor->alloc) +alloc_path = monitor->alloc->path; +else +alloc_path = (char *)SYSFS_RESCTRL_PATH; + +if (virAsprintf(, "%s/mon_groups", alloc_path) < 0) +return -1; + +monitor->path = virResctrlDeterminePath(parentpath, machinename, +monitor->id); + +VIR_FREE(parentpath); + +if (!monitor->path) +return -1; + +return 0; +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index cb9bfae..69b6b1d 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -196,4 +196,7 @@ virResctrlMonitorNew(void); int virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, pid_t pid); +int +virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, + const char *machinename); #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 14/18] Util: Add function for checking if monitor is running
Check monitor status by checking the PIDs are in file 'task' or not. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 84 +++- src/util/virresctrl.h| 4 +++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0f7dd25..a6da885 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2683,6 +2683,7 @@ virResctrlMonitorDeterminePath; virResctrlMonitorGetCacheLevel; virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; +virResctrlMonitorIsRunning; virResctrlMonitorNew; virResctrlMonitorRemove; virResctrlMonitorSetCacheLevel; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index fc412be..abd1776 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -364,6 +364,9 @@ struct _virResctrlMonitor { char *path; /* Boolean flag for default monitor */ bool default_monitor; +/* Tracking the tasks' PID associated with this monitor */ +pid_t *pids; +size_t npids; /* The cache 'level', special for cache monitor */ unsigned int cache_level; }; @@ -425,6 +428,7 @@ virResctrlMonitorDispose(void *obj) virObjectUnref(monitor->alloc); VIR_FREE(monitor->id); VIR_FREE(monitor->path); +VIR_FREE(monitor->pids); } @@ -2493,7 +2497,13 @@ int virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, pid_t pid) { -return virResctrlAddPID(monitor->path, pid); +if (virResctrlAddPID(monitor->path, pid) < 0) +return -1; + +if (VIR_APPEND_ELEMENT(monitor->pids, monitor->npids, pid) < 0) +return -1; + +return 0; } @@ -2764,3 +2774,75 @@ virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor) { monitor->default_monitor = true; } + + +static int +virResctrlPIDCompare(const void *pida, const void *pidb) +{ +return *(pid_t*)pida - *(pid_t*)pidb; +} + + +bool +virResctrlMonitorIsRunning(virResctrlMonitorPtr monitor) +{ +char *pidstr = NULL; +char **spids = NULL; +size_t nspids = 0; +pid_t *pids = NULL; +size_t npids = 0; +size_t i = 0; +int rv = -1; +bool ret = false; + +if (!monitor->path) +return false; + +if (monitor->npids == 0) +return false; + +rv = virFileReadValueString(, "%s/tasks", monitor->path); +if (rv == -2) +virReportError(VIR_ERR_INTERNAL_ERROR, + _("Task file '%s/tasks' does not exist"), + monitor->path); +if (rv < 0) +goto cleanup; + +/* no PID in task file */ +if (!*pidstr) +goto cleanup; + +spids = virStringSplitCount(pidstr, "\n", 0, ); +if (nspids != monitor->npids) +return false; + +for (i = 0; i < nspids; i++) { +unsigned int val = 0; +pid_t pid = 0; + +if (virStrToLong_uip(spids[i], NULL, 0, ) < 0) +goto cleanup; + +pid = (pid_t)val; + +if (VIR_APPEND_ELEMENT(pids, npids, pid) < 0) +goto cleanup; +} + +qsort(pids, npids, sizeof(pid_t), virResctrlPIDCompare); +qsort(monitor->pids, monitor->npids, sizeof(pid_t), virResctrlPIDCompare); + +for (i = 0; i < monitor->npids; i++) { +if (monitor->pids[i] != pids[i]) +goto cleanup; +} + +ret = true; + cleanup: +virStringListFree(spids); +VIR_FREE(pids); +VIR_FREE(pidstr); + +return ret; +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 371df8a..c5794cb 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -230,4 +230,8 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, unsigned int **bankcaches); void virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor); + +bool +virResctrlMonitorIsRunning(virResctrlMonitorPtr monitor); + #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 13/18] conf: Add resctrl monitor configuration
Introducing element under to represent a cache monitor. Supports two kind of monitors, which are, monitor under default allocation or monitor under particular allocation. Monitor supervises the cache or memory bandwidth usage for interested vcpu thread set, if the vcpu thread set is belong to some resctrl allocation, then the monitor will be created under this allocation, that is, creating a resctrl monitoring group directory under the directory of '@alloc->path/mon_group'. Otherwise, the monitor will be created under default allocation. For default allocation monitor, it will have such kind of XML layout: For other type monitor, the XML layout will be something like: Signed-off-by: Wang Huaqiang --- docs/schemas/domaincommon.rng | 10 + src/conf/domain_conf.c | 217 - src/conf/domain_conf.h | 11 ++ tests/genericxml2xmlindata/cachetune-cdp.xml | 3 + .../cachetune-colliding-monitor.xml| 30 +++ tests/genericxml2xmlindata/cachetune-small.xml | 7 + tests/genericxml2xmltest.c | 2 + 7 files changed, 275 insertions(+), 5 deletions(-) create mode 100644 tests/genericxml2xmlindata/cachetune-colliding-monitor.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5c533d6..7ce49d3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -981,6 +981,16 @@ + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9a514a6..4f4604f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2955,13 +2955,30 @@ virDomainLoaderDefFree(virDomainLoaderDefPtr loader) static void +virDomainResctrlMonDefFree(virDomainResctrlMonDefPtr domresmon) +{ +if (!domresmon) +return; + +virBitmapFree(domresmon->vcpus); +virObjectUnref(domresmon->instance); +} + + +static void virDomainResctrlDefFree(virDomainResctrlDefPtr resctrl) { +size_t i = 0; + if (!resctrl) return; +for (i = 0; i < resctrl->nmonitors; i++) +virDomainResctrlMonDefFree(resctrl->monitors[i]); + virObjectUnref(resctrl->alloc); virBitmapFree(resctrl->vcpus); +VIR_FREE(resctrl->monitors); VIR_FREE(resctrl); } @@ -18919,6 +18936,154 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt, return ret; } +/* Checking if the monitor's vcpus is conflicted with existing allocation + * and monitors. + * + * Returns 1 if @vcpus equals to @resctrl->vcpus, means it is a default + * monitor. Returns - 1 if a conflict found. Returns 0 if no conflict and + * @vcpus is not equal to @resctrl->vcpus. + * */ +static int +virDomainResctrlMonValidateVcpu(virDomainResctrlDefPtr resctrl, +virBitmapPtr vcpus) +{ +size_t i = 0; +int vcpu = -1; + +if (virBitmapIsAllClear(vcpus)) { +virReportError(VIR_ERR_INVALID_ARG, "%s", + _("vcpus is empty")); +return -1; +} + +while ((vcpu = virBitmapNextSetBit(vcpus, vcpu)) >= 0) { +if (!virBitmapIsBitSet(resctrl->vcpus, vcpu)) { +virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Monitor vcpus conflicts with allocation")); +return -1; +} +} + +if (resctrl->alloc && virBitmapEqual(vcpus, resctrl->vcpus)) +return 1; + +for (i = 0; i < resctrl->nmonitors; i++) { +if (virBitmapEqual(resctrl->vcpus, resctrl->monitors[i]->vcpus)) +continue; + +if (virBitmapOverlaps(vcpus, resctrl->monitors[i]->vcpus)) { +virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Monitor vcpus conflicts with monitors")); + +return -1; +} +} + +return 0; +} + + +static int +virDomainResctrlMonDefParse(virDomainDefPtr def, +xmlXPathContextPtr ctxt, +xmlNodePtr node, +virResctrlMonitorType tag, +virDomainResctrlDefPtr resctrl) +{ +virDomainResctrlMonDefPtr domresmon = NULL; +xmlNodePtr oldnode = ctxt->node; +xmlNodePtr *nodes = NULL; +unsigned int level = 0; +char * tmp = NULL; +char * id = NULL; +size_t i = 0; +int n = 0; +int rv = -1; +int ret = -1; + +ctxt->node = node; + +if ((n = virXPathNodeSet("./monitor", ctxt, )) < 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot extract monitor nodes")); +goto cleanup; +} + +for (i = 0; i < n; i++) { + +if (VIR_ALLOC(domresmon) < 0) +
[libvirt] [PATCHv4 15/18] qemu: enable resctrl monitor in qemu
Add functions for creating, destroying, reconnecting resctrl monitor in qemu according to the configuration in domain XML. Signed-off-by: Wang Huaqiang --- src/qemu/qemu_process.c | 41 - 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 29b0ba1..9b103e8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2611,10 +2611,21 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver, return -1; for (i = 0; i < vm->def->nresctrls; i++) { +size_t j = 0; if (virResctrlAllocCreate(caps->host.resctrl, vm->def->resctrls[i]->alloc, priv->machineName) < 0) goto cleanup; + +for (j = 0; j < vm->def->resctrls[i]->nmonitors; j++) { +virDomainResctrlMonDefPtr mon = vm->def->resctrls[i]->monitors[j]; + +if (virResctrlMonitorCreate(vm->def->resctrls[i]->alloc, +mon->instance, +priv->machineName) < 0) +goto cleanup; + +} } ret = 0; @@ -5443,11 +5454,22 @@ qemuProcessSetupVcpu(virDomainObjPtr vm, return -1; for (i = 0; i < vm->def->nresctrls; i++) { +size_t j = 0; virDomainResctrlDefPtr ct = vm->def->resctrls[i]; if (virBitmapIsBitSet(ct->vcpus, vcpuid)) { if (virResctrlAllocAddPID(ct->alloc, vcpupid) < 0) return -1; + +for (j = 0; j < vm->def->resctrls[i]->nmonitors; j++) { +virDomainResctrlMonDefPtr mon = NULL; + +mon = vm->def->resctrls[i]->monitors[j]; +if (virBitmapIsBitSet(mon->vcpus, vcpuid)) { +if (virResctrlMonitorAddPID(mon->instance, vcpupid) < 0) +return -1; +} +} break; } } @@ -7210,8 +7232,15 @@ void qemuProcessStop(virQEMUDriverPtr driver, /* Remove resctrl allocation after cgroups are cleaned up which makes it * kind of safer (although removing the allocation should work even with * pids in tasks file */ -for (i = 0; i < vm->def->nresctrls; i++) +for (i = 0; i < vm->def->nresctrls; i++) { +size_t j = 0; + virResctrlAllocRemove(vm->def->resctrls[i]->alloc); +for (j = 0; j < vm->def->resctrls[i]->nmonitors; j++) { +virDomainResctrlMonDefPtr mon = vm->def->resctrls[i]->monitors[j]; +virResctrlMonitorRemove(mon->instance); +} +} qemuProcessRemoveDomainStatus(driver, vm); @@ -7947,9 +7976,19 @@ qemuProcessReconnect(void *opaque) goto error; for (i = 0; i < obj->def->nresctrls; i++) { +size_t j = 0; + if (virResctrlAllocDeterminePath(obj->def->resctrls[i]->alloc, priv->machineName) < 0) goto error; + +for (j = 0; j < obj->def->resctrls[i]->nmonitors; j++) { +virDomainResctrlMonDefPtr mon = obj->def->resctrls[i]->monitors[j]; + +if (virResctrlMonitorDeterminePath(mon->instance, + priv->machineName) < 0) +goto error; +} } /* update domain state XML with possibly updated state in virDomainObj */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 09/18] util: Add more interfaces for resctrl monitor
Add interfaces monitor group to support operations such as add PID, set ID, remove group ... etc. The interface for getting cache occupancy information from the monitor is also added. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 6 ++ src/util/virresctrl.c| 209 ++- src/util/virresctrl.h| 23 ++ 3 files changed, 236 insertions(+), 2 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1d6ed0b..a8932a7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2680,7 +2680,13 @@ virResctrlInfoNew; virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; +virResctrlMonitorGetCacheLevel; +virResctrlMonitorGetCacheOccupancy; +virResctrlMonitorGetID; virResctrlMonitorNew; +virResctrlMonitorRemove; +virResctrlMonitorSetCacheLevel; +virResctrlMonitorSetID; # util/virrotatingfile.h diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 772dfaf..c91078f 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -225,11 +225,19 @@ virResctrlInfoMonFree(virResctrlInfoMonPtr mon) } + +/* + * virResctrlAlloc and virResctrlMonitor are representing a resource control + * group (in XML under cputune/cachetune and consequently a directory under + * /sys/fs/resctrl). virResctrlAlloc is the data structure for resource + * allocation, while the virResctrlMonitor represents the resource monitoring + * part. + */ + /* virResctrlAlloc */ /* - * virResctrlAlloc represents one allocation (in XML under cputune/cachetune and - * consequently a directory under /sys/fs/resctrl). Since it can have multiple + * virResctrlAlloc represents one allocation. Since it can have multiple * parts of multiple caches allocated it is represented as bunch of nested * sparse arrays (by sparse I mean array of pointers so that each might be NULL * in case there is no allocation for that particular cache allocation (level, @@ -347,6 +355,8 @@ struct _virResctrlMonitor { /* libvirt-generated path in /sys/fs/resctrl for this particular * monitor */ char *path; +/* The cache 'level', special for cache monitor */ +unsigned int cache_level; }; @@ -2512,6 +2522,27 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, int +virResctrlMonitorSetID(virResctrlMonitorPtr monitor, + const char *id) +{ +if (!id) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Resctrl monitor 'id' cannot be NULL")); +return -1; +} + +return VIR_STRDUP(monitor->id, id); +} + + +const char * +virResctrlMonitorGetID(virResctrlMonitorPtr monitor) +{ +return monitor->id; +} + + +int virResctrlMonitorCreate(virResctrlAllocPtr alloc, virResctrlMonitorPtr monitor, const char *machinename) @@ -2536,3 +2567,177 @@ virResctrlMonitorCreate(virResctrlAllocPtr alloc, virResctrlUnlock(lockfd); return ret; } + + +int +virResctrlMonitorRemove(virResctrlMonitorPtr monitor) +{ +int ret = 0; + +if (!monitor->path) +return 0; + +VIR_DEBUG("Removing resctrl monitor%s", monitor->path); +if (rmdir(monitor->path) != 0 && errno != ENOENT) { +virReportSystemError(errno, + _("Unable to remove %s (%d)"), + monitor->path, errno); +ret = -errno; +VIR_ERROR(_("Unable to remove %s (%d)"), monitor->path, errno); +} + +return ret; +} + + +int +virResctrlMonitorSetCacheLevel(virResctrlMonitorPtr monitor, + unsigned int level) +{ +/* Only supports cache level 3 CMT */ +if (level != 3) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid resctrl monitor cache level")); +return -1; +} + +monitor->cache_level = level; + +return 0; +} + +unsigned int +virResctrlMonitorGetCacheLevel(virResctrlMonitorPtr monitor) +{ +return monitor->cache_level; +} + + +/* + * virResctrlMonitorGetStatistic + * + * @monitor: The monitor that the statistic data will be retrieved from. + * @resource: The name for resource name. 'llc_occpancy' for cache resource. + * "mbm_totol_bytes" and "mbm_local_bytes" for memory bandwidth resource. + * @len: The array length for @ids, and @vals + * @ids: The id array for resource statistic information, ids[0] + * stores the first node id value, ids[1] stores the second node id value, + * ... and so on. + * @vals: The resource resource utilization information array. vals[0] + * stores the cache or memory bandwidth utilization value for first node, + * vals[1] stores the second value ... and so on. + * + * Get cache or memory bandwidth utilization information from monitor that + * specified by @id. + * + * Returns 0 for success, -1 for error. + */ +static int +virResctrlMonitorGetStatistic(virResctrlMonitorPtr monitor, +
[libvirt] [PATCHv4 10/18] util: Introduce default monitor
In resctrl file system, more than one monitoring groups could be created within one allocation group, along with the creation of allocation group, a monitoring group is created at the same, which monitors the resource utilization information of whole allocation group. This patch is introducing the concept of default monitor, which represents the particular monitoring group that created along with the creation of allocation group. Default monitor shares the common 'vcpu' list with the allocation. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 23 +++ src/util/virresctrl.h| 2 ++ 3 files changed, 26 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a8932a7..0f7dd25 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2686,6 +2686,7 @@ virResctrlMonitorGetID; virResctrlMonitorNew; virResctrlMonitorRemove; virResctrlMonitorSetCacheLevel; +virResctrlMonitorSetDefault; virResctrlMonitorSetID; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index c91078f..fc412be 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -340,6 +340,13 @@ struct _virResctrlAlloc { * bandwidth technology (MBM), as well as the CAT and MBA, are all orthogonal * features. The monitor will be created under the scope of default allocation * if no CAT or MBA supported in the system. + * + * In resctrl file sytem, more than one monitoring groups could be created + * within one allocation group, along with the creation of allocation group, + * a monitoring group is created at the same, which monitors the resource + * utilization information of whole allocation group. + * A virResctrlMonitor with @default_monitor marked as 'true' is representing + * the monitoring group created along with the creation of allocation group. */ struct _virResctrlMonitor { virObject parent; @@ -355,6 +362,8 @@ struct _virResctrlMonitor { /* libvirt-generated path in /sys/fs/resctrl for this particular * monitor */ char *path; +/* Boolean flag for default monitor */ +bool default_monitor; /* The cache 'level', special for cache monitor */ unsigned int cache_level; }; @@ -2501,6 +2510,13 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, return -1; } +if (monitor->default_monitor) { +if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0) +return -1; + +return 0; +} + if (monitor->alloc) alloc_path = monitor->alloc->path; else @@ -2741,3 +2757,10 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, return virResctrlMonitorGetStatistic(monitor, "llc_occupancy", nbank, bankids, bankcaches); } + + +void +virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor) +{ +monitor->default_monitor = true; +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 6137fee..371df8a 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -228,4 +228,6 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, size_t *nbank, unsigned int **bankids, unsigned int **bankcaches); +void +virResctrlMonitorSetDefault(virResctrlMonitorPtr monitor); #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 07/18] util: Refactor code for creating resctrl group
The code for creating resctrl allocation group could be reused for monitoring group, refactor it for reusing in the later patch. Signed-off-by: Wang Huaqiang --- src/util/virresctrl.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index de10a0c..d573713 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2312,6 +2312,26 @@ virResctrlAllocDeterminePath(virResctrlAllocPtr alloc, } +/* This function creates a resctrl directory in resource control file system, + * and the directory path is specified by @path. */ +static int +virResctrlCreateGroupPath(const char *path) +{ +/* Directory exists, return */ +if (virFileExists(path)) +return 0; + +if (virFileMakePath(path) < 0) { +virReportSystemError(errno, + _("Cannot create resctrl directory '%s'"), + path); +return -1; +} + +return 0; +} + + /* This checks if the directory for the alloc exists. If not it tries to create * it and apply appropriate alloc settings. */ int @@ -2336,13 +2356,6 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl, if (virResctrlAllocDeterminePath(alloc, machinename) < 0) return -1; -if (virFileExists(alloc->path)) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("Path '%s' for resctrl allocation exists"), - alloc->path); -goto cleanup; -} - lockfd = virResctrlLockWrite(); if (lockfd < 0) goto cleanup; @@ -2350,6 +2363,9 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl, if (virResctrlAllocAssign(resctrl, alloc) < 0) goto cleanup; +if (virResctrlCreateGroupPath(alloc->path) < 0) +goto cleanup; + alloc_str = virResctrlAllocFormat(alloc); if (!alloc_str) goto cleanup; @@ -2357,13 +2373,6 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl, if (virAsprintf(_path, "%s/schemata", alloc->path) < 0) goto cleanup; -if (virFileMakePath(alloc->path) < 0) { -virReportSystemError(errno, - _("Cannot create resctrl directory '%s'"), - alloc->path); -goto cleanup; -} - VIR_DEBUG("Writing resctrl schemata '%s' into '%s'", alloc_str, schemata_path); if (virFileWriteStr(schemata_path, alloc_str, 0) < 0) { rmdir(alloc->path); -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 08/18] util: Add interface for creating monitor group
Add interface for creating the resource monitoring group according to '@virResctrlMonitor->path'. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 28 src/util/virresctrl.h| 6 ++ 3 files changed, 35 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5a408c8..1d6ed0b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2678,6 +2678,7 @@ virResctrlInfoGetMonitorPrefix; virResctrlInfoMonFree; virResctrlInfoNew; virResctrlMonitorAddPID; +virResctrlMonitorCreate; virResctrlMonitorDeterminePath; virResctrlMonitorNew; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index d573713..772dfaf 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2477,6 +2477,7 @@ virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, return virResctrlAddPID(monitor->path, pid); } + int virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, const char *machinename) @@ -2508,3 +2509,30 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, return 0; } + + +int +virResctrlMonitorCreate(virResctrlAllocPtr alloc, +virResctrlMonitorPtr monitor, +const char *machinename) +{ +int lockfd = -1; +int ret = -1; + +if (!monitor) +return 0; + +monitor->alloc = virObjectRef(alloc); + +if (virResctrlMonitorDeterminePath(monitor, machinename) < 0) +return -1; + +lockfd = virResctrlLockWrite(); +if (lockfd < 0) +return -1; + +ret = virResctrlCreateGroupPath(monitor->path); + +virResctrlUnlock(lockfd); +return ret; +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 69b6b1d..1efe394 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -196,7 +196,13 @@ virResctrlMonitorNew(void); int virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, pid_t pid); + int virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor, const char *machinename); + +int +virResctrlMonitorCreate(virResctrlAllocPtr alloc, +virResctrlMonitorPtr monitor, +const char *machinename); #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 02/18] util: Introduce resctrl monitor for CMT
Cache Monitoring Technology (aka CMT) provides the capability to report cache utilization information of system task. This patch introduces the concept of resctrl monitor through data structure virResctrlMonitor. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 56 src/util/virresctrl.h| 7 ++ 3 files changed, 64 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9236391..754578f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2677,6 +2677,7 @@ virResctrlInfoGetCache; virResctrlInfoGetMonitorPrefix; virResctrlInfoMonFree; virResctrlInfoNew; +virResctrlMonitorNew; # util/virrotatingfile.h diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 74d9b6b..bd36406 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -105,6 +105,7 @@ typedef virResctrlAllocMemBW *virResctrlAllocMemBWPtr; /* Class definitions and initializations */ static virClassPtr virResctrlInfoClass; static virClassPtr virResctrlAllocClass; +static virClassPtr virResctrlMonitorClass; /* virResctrlInfo */ @@ -319,6 +320,35 @@ struct _virResctrlAlloc { char *path; }; +/* virResctrlMonitor */ + +/* + * virResctrlMonitor is the data structure for resctrl monitor. Resctrl + * monitor represents a resctrl monitoring group, which can be used to + * monitor the resource utilization information for either cache or + * memory bandwidth. + * + * From hardware perspective, cache monitoring technology (CMT), memory + * bandwidth technology (MBM), as well as the CAT and MBA, are all orthogonal + * features. The monitor will be created under the scope of default allocation + * if no CAT or MBA supported in the system. + */ +struct _virResctrlMonitor { +virObject parent; + +/* In resctrl, each monitor is associated with one specific allocation, + * either the allocation under /sys/fs/resctrl or the default allocation. + * If this pointer is NULL, then the monitor will be associated with + * default allocation, otherwise, this pointer points to the allocation + * this monitor associated with. */ +virResctrlAllocPtr alloc; +/* The monitor identifier */ +char *id; +/* libvirt-generated path in /sys/fs/resctrl for this particular + * monitor */ +char *path; +}; + static void virResctrlAllocDispose(void *obj) @@ -368,6 +398,17 @@ virResctrlAllocDispose(void *obj) } +static void +virResctrlMonitorDispose(void *obj) +{ +virResctrlMonitorPtr monitor = obj; + +virObjectUnref(monitor->alloc); +VIR_FREE(monitor->id); +VIR_FREE(monitor->path); +} + + /* Global initialization for classes */ static int virResctrlOnceInit(void) @@ -378,6 +419,9 @@ virResctrlOnceInit(void) if (!VIR_CLASS_NEW(virResctrlAlloc, virClassForObject())) return -1; +if (!VIR_CLASS_NEW(virResctrlMonitor, virClassForObject())) +return -1; + return 0; } @@ -2374,3 +2418,15 @@ virResctrlAllocRemove(virResctrlAllocPtr alloc) return ret; } + + +/* virResctrlMonitor-related definitions */ + +virResctrlMonitorPtr +virResctrlMonitorNew(void) +{ +if (virResctrlInitialize() < 0) +return NULL; + +return virObjectNew(virResctrlMonitorClass); +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 10505e9..f59a9aa 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -185,4 +185,11 @@ int virResctrlInfoGetMonitorPrefix(virResctrlInfoPtr resctrl, const char *prefix, virResctrlInfoMonPtr *monitor); + +/* Monitor-related things */ +typedef struct _virResctrlMonitor virResctrlMonitor; +typedef virResctrlMonitor *virResctrlMonitorPtr; + +virResctrlMonitorPtr +virResctrlMonitorNew(void); #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 03/18] util: Refactor code for adding PID to the resource group
The code of adding PID to the allocation could be reused, refactor it for later reusing. Signed-off-by: Wang Huaqiang --- src/util/virresctrl.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index bd36406..8c2bb21 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2361,24 +2361,21 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl, } -int -virResctrlAllocAddPID(virResctrlAllocPtr alloc, - pid_t pid) +static int +virResctrlAddPID(const char *path, + pid_t pid) { char *tasks = NULL; char *pidstr = NULL; int ret = 0; -if (!alloc) -return 0; - -if (!alloc->path) { +if (!path) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot add pid to non-existing resctrl allocation")); + _("Cannot add pid to non-existing resctrl group")); return -1; } -if (virAsprintf(, "%s/tasks", alloc->path) < 0) +if (virAsprintf(, "%s/tasks", path) < 0) return -1; if (virAsprintf(, "%lld", (long long int) pid) < 0) @@ -2400,6 +2397,17 @@ virResctrlAllocAddPID(virResctrlAllocPtr alloc, int +virResctrlAllocAddPID(virResctrlAllocPtr alloc, + pid_t pid) +{ +if (!alloc) +return 0; + +return virResctrlAddPID(alloc->path, pid); +} + + +int virResctrlAllocRemove(virResctrlAllocPtr alloc) { int ret = 0; -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 01/18] docs: Refactor schemas to support default allocation
The resctrl default allocation is introduced in this patch, which refers to the root directory (/sys/fs/resctrl) and immediately be created after mounting, owns all the tasks and cpus in the system and can make full use of all resources. It does not intentionally allocate any dedicated amount of resource, either cache or memory bandwidth, for default allocation. If a system task has no resource control applied but you want to know task's cache or memroy bandwidth utilization information, the default allocation is meaningful. We create resctrl monitor under the default allocation for such kind of task. Refactoring schemas docs and APIs to create a default cache allocation by allowing the appearance of an with no element. Signed-off-by: Wang Huaqiang --- docs/schemas/domaincommon.rng | 4 ++-- src/conf/domain_conf.c| 32 +++- src/util/virresctrl.c | 27 +++ 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 099a949..5c533d6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -956,7 +956,7 @@ - + @@ -980,7 +980,7 @@ - + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56..b77680e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19002,22 +19002,27 @@ virDomainCachetuneDefParse(virDomainDefPtr def, goto cleanup; } -if (virDomainResctrlVcpuMatch(def, vcpus, ) < 0) -goto cleanup; - -if (!alloc) { -alloc = virResctrlAllocNew(); -if (!alloc) +/* If 'n' equals 0, then no element found in , + * this means it is a default alloction. For default allocation, + * @SetvirDomainResctrlDefPtr->alloc is set to NULL */ +if (n != 0) { +if (virDomainResctrlVcpuMatch(def, vcpus, ) < 0) goto cleanup; -} else { -virReportError(VIR_ERR_XML_ERROR, "%s", - _("Identical vcpus in cachetunes found")); -goto cleanup; -} -for (i = 0; i < n; i++) { -if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) +if (!alloc) { +alloc = virResctrlAllocNew(); +if (!alloc) +goto cleanup; +} else { +virReportError(VIR_ERR_XML_ERROR, "%s", + _("Identical vcpus in cachetunes found")); goto cleanup; +} + +for (i = 0; i < n; i++) { +if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) +goto cleanup; +} } if (virResctrlAllocIsEmpty(alloc)) { @@ -19027,6 +19032,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, if (virDomainResctrlAppend(def, node, alloc, vcpus, flags) < 0) goto cleanup; + vcpus = NULL; alloc = NULL; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index fb25ca8..74d9b6b 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -234,6 +234,10 @@ virResctrlInfoMonFree(virResctrlInfoMonPtr mon) * in case there is no allocation for that particular cache allocation (level, * cache, ...) or memory allocation for particular node). * + * Resctrl file system root directory, /sys/fs/sysctrl/, is called the default + * allocation, which is created, immediately after mounting, owns all the + * tasks and cpus in the system and can make full use of all resources. + * * =Cache allocation technology (CAT)= * * Since one allocation can be made for caches on different levels, the first @@ -1167,6 +1171,9 @@ virResctrlAllocSetCacheSize(virResctrlAllocPtr alloc, unsigned int cache, unsigned long long size) { +if (!alloc) +return 0; + if (virResctrlAllocCheckCollision(alloc, level, type, cache)) { virReportError(VIR_ERR_XML_ERROR, _("Colliding cache allocations for cache " @@ -1237,6 +1244,9 @@ virResctrlAllocSetMemoryBandwidth(virResctrlAllocPtr alloc, { virResctrlAllocMemBWPtr mem_bw = alloc->mem_bw; +if (!alloc) +return 0; + if (memory_bandwidth > 100) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Memory Bandwidth value exceeding 100 is invalid.")); @@ -1306,6 +1316,11 @@ int virResctrlAllocSetID(virResctrlAllocPtr alloc, const char *id) { +/* If passed a default allocation in, @alloc will be NULL. This is + * a valid case, return normally. */ +if (!alloc) +return 0; + if (!id) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Resctrl allocation 'id' cannot be
[libvirt] [PATCHv4 04/18] util: Add interface for adding PID to monitor
Add interface for adding task PID to monitor. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/util/virresctrl.c| 8 src/util/virresctrl.h| 4 3 files changed, 13 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 754578f..a6259f7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2677,6 +2677,7 @@ virResctrlInfoGetCache; virResctrlInfoGetMonitorPrefix; virResctrlInfoMonFree; virResctrlInfoNew; +virResctrlMonitorAddPID; virResctrlMonitorNew; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 8c2bb21..f2c94d2 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2438,3 +2438,11 @@ virResctrlMonitorNew(void) return virObjectNew(virResctrlMonitorClass); } + + +int +virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, +pid_t pid) +{ +return virResctrlAddPID(monitor->path, pid); +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index f59a9aa..cb9bfae 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -192,4 +192,8 @@ typedef virResctrlMonitor *virResctrlMonitorPtr; virResctrlMonitorPtr virResctrlMonitorNew(void); + +int +virResctrlMonitorAddPID(virResctrlMonitorPtr monitor, +pid_t pid); #endif /* __VIR_RESCTRL_H__ */ -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 05/18] util: Refactor code for determining allocation path
The code for determining resctrl allocation path could be reused for monitor. Refactor it for reusing. Signed-off-by: Wang Huaqiang --- src/util/virresctrl.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index f2c94d2..5beed92 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2269,6 +2269,26 @@ virResctrlAllocAssign(virResctrlInfoPtr resctrl, } +static char * +virResctrlDeterminePath(const char *pathparent, +const char *prefix, +const char *id) +{ +char *path = NULL; + +if (!id) { +virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Resctrl resource ID must be set before creation")); +return NULL; +} + +if (virAsprintf(, "%s/%s-%s", pathparent, prefix, id) < 0) +return NULL; + +return path; +} + + int virResctrlAllocDeterminePath(virResctrlAllocPtr alloc, const char *machinename) @@ -2276,15 +2296,16 @@ virResctrlAllocDeterminePath(virResctrlAllocPtr alloc, if (!alloc) return 0; -if (!alloc->id) { -virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Resctrl Allocation ID must be set before creation")); +if (alloc->path) { +virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Resctrl group path is expected to be NULL")); return -1; } -if (!alloc->path && -virAsprintf(>path, "%s/%s-%s", -SYSFS_RESCTRL_PATH, machinename, alloc->id) < 0) +alloc->path = virResctrlDeterminePath(SYSFS_RESCTRL_PATH, + machinename, + alloc->id); +if (!alloc->path) return -1; return 0; -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 00/18] Introduce x86 Cache Monitoring Technology (CMT)
This series of patches and the series already been merged introduce the x86 Cache Monitoring Technology (CMT) to libvirt by interacting with kernel resource control (resctrl) interface. CMT is one of the Intel(R) x86 CPU feature which belongs to the Resource Director Technology (RDT). CMT reports the occupancy of the last level cache, which is shared by all CPU cores. In the v1 series, an original and complete feature for CMT was introduced The v2 and v3 patches address the feature for the host capability of CMT. v4 is addressing the feature for monitoring VM vcpu thread set cache occupancy and reporting it through a virsh command. We have serval discussion about the enabling of CMT, please refer to following links for the RFCs. RFCv3 https://www.redhat.com/archives/libvir-list/2018-August/msg01213.html RFCv2 https://www.redhat.com/archives/libvir-list/2018-July/msg00409.html https://www.redhat.com/archives/libvir-list/2018-July/msg01241.html RFCv1 https://www.redhat.com/archives/libvir-list/2018-June/msg00674.html And the merged commits are list as below, for host capability of CMT. 6af8417415508c31f8ce71234b573b4999f35980 8f6887998bf63594ae26e3db18d4d5896c5f2cb4 58fcee6f3a2b7e89c21c1fb4ec21429c31a0c5b8 12093f1feaf8f5023dcd9d65dff111022842183d a5d293c18831dcf69ec6195798387fbb70c9f461 1. About reason why CMT is necessary in libvirt? The perf events of 'CMT, MBML, MBMT' have been phased out since Linux kernel commit c39a0e2c8850f08249383f2425dbd8dbe4baad69, in libvirt the perf based cmt,mbm will not work with the latest linux kernel. These patches add CMT feature to libvirt through kernel resctrlfs interface. 2 Create cache monitoring group (cache monitor). The main interface for creating monitoring group is through XML file. The proposed configuration is like: + + In above XML, created 2 cache resctrl allocation groups and 2 resctrl monitoring groups. The changes of cache monitor will be effective in next booting of VM. 2 Show CMT result through command 'domstats' Adding the interface in qemu to report this information for resource monitor group through command 'virsh domstats --cpu-total'. Below is a typical output: # virsh domstats 1 --cpu-total Domain: 'ubuntu16.04-base' ... cpu.cache.monitor.count=2 cpu.cache.0.name=vcpus_1 cpu.cache.0.vcpus=1 cpu.cache.0.bank.count=2 cpu.cache.0.bank.0.id=0 cpu.cache.0.bank.0.bytes=4505600 cpu.cache.0.bank.1.id=1 cpu.cache.0.bank.1.bytes=5586944 cpu.cache.1.name=vcpus_4-6 cpu.cache.1.vcpus=4,5,6 cpu.cache.1.bank.count=2 cpu.cache.1.bank.0.id=0 cpu.cache.1.bank.0.bytes=17571840 cpu.cache.1.bank.1.id=1 cpu.cache.1.bank.1.bytes=29106176 Changes in v4: v4 is addressing the feature for monitoring VM vcpu thread set cache occupancy and reporting it through a virsh command. - Introduced resctrl default allocation - Introduced resctrl monitor and default monitor Changes in v3: - Addressed John Ferlan's review. - Typo fixed. - Removed VIR_ENUM_DECL(virMonitor); Changes in v2: - Introduced MBM capability. - Capability layout changed * Moved from cahe to * Renamed to - Document for 'reuseThreshold' changed. - Introduced API virResctrlInfoGetMonitorPrefix - Added more tests, covering standalone CMT, fake new feature. - Creating CMT resource control group will be subsequent job. Wang Huaqiang (18): docs: Refactor schemas to support default allocation util: Introduce resctrl monitor for CMT util: Refactor code for adding PID to the resource group util: Add interface for adding PID to monitor util: Refactor code for determining allocation path util: Add monitor interface to determine path util: Refactor code for creating resctrl group util: Add interface for creating monitor group util: Add more interfaces for resctrl monitor util: Introduce default monitor conf: Refactor code for matching existing resctrls conf: Refactor virDomainResctrlAppend conf: Add resctrl monitor configuration Util: Add function for checking if monitor is running qemu: enable resctrl monitor in qemu conf: Add a 'id' to virDomainResctrlDef qemu: refactor qemuDomainGetStatsCpu qemu: Report cache occupancy (CMT) with domstats docs/schemas/domaincommon.rng | 14 +- src/conf/domain_conf.c | 327 ++-- src/conf/domain_conf.h | 12 + src/libvirt_private.syms | 12 + src/qemu/qemu_driver.c | 272 +- src/qemu/qemu_process.c| 41 +- src/util/virresctrl.c | 555 +++-- src/util/virresctrl.h | 49 ++ tests/genericxml2xmlindata/cachetune-cdp.xml | 3 +
Re: [libvirt] [PATCH RFC] lxc: Include support to lxc version 3.0 and higher.
For further reference: https://lists.linuxcontainers.org/pipermail/lxc-devel/2018-April/017663.html Em dom, 30 de set de 2018 às 23:24, Julio Faracco escreveu: > > Hi guys, > > I put the RFC mark because I don't know if this is the best way to > enhance the support for LXC 3.0. Considering this patch, I can use > both o version without any issue, but I would like to see other points > of view. I'm not completely right about this approach. > > -- > Julio Cesar Faracco > > Em dom, 30 de set de 2018 às 23:19, Julio Faracco > escreveu: > > > > This patch introduce the new settings for LXC 3.0 and higher. The older > > versions keep the compatibility to deprecated settings for LXC, but > > after release 3.0, the compatibility was removed. This commit adds the > > support to the refactored settings. > > > > Signed-off-by: Julio Faracco > > --- > > src/lxc/lxc_native.c | 12 +--- > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c > > index cbdec723dd..c0f70ebb7d 100644 > > --- a/src/lxc/lxc_native.c > > +++ b/src/lxc/lxc_native.c > > @@ -200,7 +200,9 @@ lxcSetRootfs(virDomainDefPtr def, > > int type = VIR_DOMAIN_FS_TYPE_MOUNT; > > VIR_AUTOFREE(char *) value = NULL; > > > > -if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0) > > +if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0 && > > +/* Legacy config keys were removed after release 3.0. */ > > +virConfGetValueString(properties, "lxc.rootfs.path", ) <= 0) > > return -1; > > > > if (STRPREFIX(value, "/dev/")) > > @@ -1041,7 +1043,9 @@ lxcParseConfigString(const char *config, > > if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0) > > goto error; > > > > -if (virConfGetValueString(properties, "lxc.utsname", ) <= 0 || > > +if ((virConfGetValueString(properties, "lxc.utsname", ) <= 0 && > > + /* Legacy config keys were removed after release 3.0. */ > > + virConfGetValueString(properties, "lxc.uts.name", ) <= 0) || > > VIR_STRDUP(vmdef->name, value) < 0) > > goto error; > > if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0)) > > @@ -1051,7 +1055,9 @@ lxcParseConfigString(const char *config, > > goto error; > > > > /* Look for fstab: we shouldn't have it */ > > -if (virConfGetValue(properties, "lxc.mount")) { > > +if (virConfGetValue(properties, "lxc.mount") || > > + /* Legacy config keys were removed after release 3.0. */ > > +virConfGetValue(properties, "lxc.mount.fstab")) { > > virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > > _("lxc.mount found, use lxc.mount.entry lines > > instead")); > > goto error; > > -- > > 2.17.1 > > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC] lxc: Include support to lxc version 3.0 and higher.
Hi guys, I put the RFC mark because I don't know if this is the best way to enhance the support for LXC 3.0. Considering this patch, I can use both o version without any issue, but I would like to see other points of view. I'm not completely right about this approach. -- Julio Cesar Faracco Em dom, 30 de set de 2018 às 23:19, Julio Faracco escreveu: > > This patch introduce the new settings for LXC 3.0 and higher. The older > versions keep the compatibility to deprecated settings for LXC, but > after release 3.0, the compatibility was removed. This commit adds the > support to the refactored settings. > > Signed-off-by: Julio Faracco > --- > src/lxc/lxc_native.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c > index cbdec723dd..c0f70ebb7d 100644 > --- a/src/lxc/lxc_native.c > +++ b/src/lxc/lxc_native.c > @@ -200,7 +200,9 @@ lxcSetRootfs(virDomainDefPtr def, > int type = VIR_DOMAIN_FS_TYPE_MOUNT; > VIR_AUTOFREE(char *) value = NULL; > > -if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0) > +if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0 && > +/* Legacy config keys were removed after release 3.0. */ > +virConfGetValueString(properties, "lxc.rootfs.path", ) <= 0) > return -1; > > if (STRPREFIX(value, "/dev/")) > @@ -1041,7 +1043,9 @@ lxcParseConfigString(const char *config, > if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0) > goto error; > > -if (virConfGetValueString(properties, "lxc.utsname", ) <= 0 || > +if ((virConfGetValueString(properties, "lxc.utsname", ) <= 0 && > + /* Legacy config keys were removed after release 3.0. */ > + virConfGetValueString(properties, "lxc.uts.name", ) <= 0) || > VIR_STRDUP(vmdef->name, value) < 0) > goto error; > if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0)) > @@ -1051,7 +1055,9 @@ lxcParseConfigString(const char *config, > goto error; > > /* Look for fstab: we shouldn't have it */ > -if (virConfGetValue(properties, "lxc.mount")) { > +if (virConfGetValue(properties, "lxc.mount") || > + /* Legacy config keys were removed after release 3.0. */ > +virConfGetValue(properties, "lxc.mount.fstab")) { > virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", > _("lxc.mount found, use lxc.mount.entry lines > instead")); > goto error; > -- > 2.17.1 > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH RFC] lxc: Include support to lxc version 3.0 and higher.
This patch introduce the new settings for LXC 3.0 and higher. The older versions keep the compatibility to deprecated settings for LXC, but after release 3.0, the compatibility was removed. This commit adds the support to the refactored settings. Signed-off-by: Julio Faracco --- src/lxc/lxc_native.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index cbdec723dd..c0f70ebb7d 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -200,7 +200,9 @@ lxcSetRootfs(virDomainDefPtr def, int type = VIR_DOMAIN_FS_TYPE_MOUNT; VIR_AUTOFREE(char *) value = NULL; -if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0) +if (virConfGetValueString(properties, "lxc.rootfs", ) <= 0 && +/* Legacy config keys were removed after release 3.0. */ +virConfGetValueString(properties, "lxc.rootfs.path", ) <= 0) return -1; if (STRPREFIX(value, "/dev/")) @@ -1041,7 +1043,9 @@ lxcParseConfigString(const char *config, if (VIR_STRDUP(vmdef->os.init, "/sbin/init") < 0) goto error; -if (virConfGetValueString(properties, "lxc.utsname", ) <= 0 || +if ((virConfGetValueString(properties, "lxc.utsname", ) <= 0 && + /* Legacy config keys were removed after release 3.0. */ + virConfGetValueString(properties, "lxc.uts.name", ) <= 0) || VIR_STRDUP(vmdef->name, value) < 0) goto error; if (!vmdef->name && (VIR_STRDUP(vmdef->name, "unnamed") < 0)) @@ -1051,7 +1055,9 @@ lxcParseConfigString(const char *config, goto error; /* Look for fstab: we shouldn't have it */ -if (virConfGetValue(properties, "lxc.mount")) { +if (virConfGetValue(properties, "lxc.mount") || + /* Legacy config keys were removed after release 3.0. */ +virConfGetValue(properties, "lxc.mount.fstab")) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("lxc.mount found, use lxc.mount.entry lines instead")); goto error; -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 5/5] xenconfig: add support for type="pvh"
Handle PVH domain type in both directions (xen-xl->xml, xml->xen-xl). And add a test for it. Signed-off-by: Marek Marczykowski-Górecki --- Changes in v3: - update for modified "libxl: add support for PVH" --- src/xenconfig/xen_common.c | 11 +-- src/xenconfig/xen_xl.c | 5 + tests/testutilsxen.c | 3 ++- tests/xlconfigdata/test-pvh-type.cfg | 13 + tests/xlconfigdata/test-pvh-type.xml | 25 + tests/xlconfigtest.c | 1 + 6 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 tests/xlconfigdata/test-pvh-type.cfg create mode 100644 tests/xlconfigdata/test-pvh-type.xml diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 6c27936..30b1c9f 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1091,6 +1091,7 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) virCapsDomainDataPtr capsdata = NULL; VIR_AUTOFREE(char *) str = NULL; int hvm = 0, ret = -1; +const char *machine = "xenpv"; if (xenConfigCopyString(conf, "name", >name) < 0) goto out; @@ -1101,8 +1102,12 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) if (xenConfigGetString(conf, "type", , NULL) == 0 && str) { if (STREQ(str, "pv")) { hvm = 0; +} else if (STREQ(str, "pvh")) { +hvm = 0; +machine = "xenpvh"; } else if (STREQ(str, "hvm")) { hvm = 1; +machine = "xenfv"; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("type %s is not supported"), str); @@ -1110,14 +1115,16 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) } } else { if ((xenConfigGetString(conf, "builder", , "linux") == 0) && -STREQ(str, "hvm")) +STREQ(str, "hvm")) { hvm = 1; +machine = "xenfv"; +} } def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN); if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type, -VIR_ARCH_NONE, def->virtType, NULL, NULL))) +VIR_ARCH_NONE, def->virtType, NULL, machine))) goto out; def->os.arch = capsdata->arch; diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 7250e57..0df8f35 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -1287,6 +1287,11 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def) /* XXX floppy disks */ } else { +if (STREQ(def->os.machine, "xenpvh")) { +if (xenConfigSetString(conf, "type", "pvh") < 0) +return -1; +} + if (def->os.bootloader && xenConfigSetString(conf, "bootloader", def->os.bootloader) < 0) return -1; diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index d34be72..c112912 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -17,7 +17,8 @@ testXLInitCaps(void) "xenfv" }; static const char *const xen_machines[] = { -"xenpv" +"xenpv", +"xenpvh" }; if ((caps = virCapabilitiesNew(virArchFromHost(), diff --git a/tests/xlconfigdata/test-pvh-type.cfg b/tests/xlconfigdata/test-pvh-type.cfg new file mode 100644 index 000..2493535 --- /dev/null +++ b/tests/xlconfigdata/test-pvh-type.cfg @@ -0,0 +1,13 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem = 579 +memory = 394 +vcpus = 1 +localtime = 0 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +type = "pvh" +kernel = "/tmp/vmlinuz" +ramdisk = "/tmp/initrd" +cmdline = "root=/dev/xvda1 console=hvc0" diff --git a/tests/xlconfigdata/test-pvh-type.xml b/tests/xlconfigdata/test-pvh-type.xml new file mode 100644 index 000..7e3f182 --- /dev/null +++ b/tests/xlconfigdata/test-pvh-type.xml @@ -0,0 +1,25 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + +xen +/tmp/vmlinuz +/tmp/initrd +root=/dev/xvda1 console=hvc0 + + + destroy + restart + restart + + + + + + + + + diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 6e3267e..5159182 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -281,6 +281,7 @@ mymain(void) DO_TEST("rbd-multihost-noauth"); DO_TEST_FORMAT("paravirt-type", false); DO_TEST_FORMAT("fullvirt-type", false); +DO_TEST("pvh-type"); #ifdef LIBXL_HAVE_DEVICE_CHANNEL DO_TEST("channel-pty"); -- git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 1/5] libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support
Make it easier to share HVM and PVH code where relevant. No functional change. Signed-off-by: Marek Marczykowski-Górecki --- src/libxl/libxl_conf.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index e2bfa2f..f3da0ed 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -376,18 +376,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, b_info->max_memkb = virDomainDefGetMemoryInitial(def); b_info->target_memkb = def->mem.cur_balloon; if (hvm) { -char bootorder[VIR_DOMAIN_BOOT_LAST + 1]; - -libxl_defbool_set(_info->u.hvm.pae, - def->features[VIR_DOMAIN_FEATURE_PAE] == - VIR_TRISTATE_SWITCH_ON); -libxl_defbool_set(_info->u.hvm.apic, - def->features[VIR_DOMAIN_FEATURE_APIC] == - VIR_TRISTATE_SWITCH_ON); -libxl_defbool_set(_info->u.hvm.acpi, - def->features[VIR_DOMAIN_FEATURE_ACPI] == - VIR_TRISTATE_SWITCH_ON); - if (caps && def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) { bool hasHwVirt = false; @@ -474,6 +462,20 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, "mode=host-passthrough to avoid risk of changed guest " "semantics when mode=custom is supported in the future"); } +} + +if (hvm) { +char bootorder[VIR_DOMAIN_BOOT_LAST + 1]; + +libxl_defbool_set(_info->u.hvm.pae, + def->features[VIR_DOMAIN_FEATURE_PAE] == + VIR_TRISTATE_SWITCH_ON); +libxl_defbool_set(_info->u.hvm.apic, + def->features[VIR_DOMAIN_FEATURE_APIC] == + VIR_TRISTATE_SWITCH_ON); +libxl_defbool_set(_info->u.hvm.acpi, + def->features[VIR_DOMAIN_FEATURE_ACPI] == + VIR_TRISTATE_SWITCH_ON); if (def->nsounds > 0) { /* -- git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 2/5] libxl: add support for PVH
Since this is something between PV and HVM, it makes sense to put the setting in place where domain type is specified. To enable it, use It is also included in capabilities.xml, for every supported HVM guest type - it doesn't seems to be any other requirement (besides new enough Xen). Signed-off-by: Marek Marczykowski-Górecki --- Changes in v2 proposed by Jim: - use new_arch_added var instead of i == nr_guest_archs for clarity - improve comment - adjust for now required Xen >= 4.6 (remove part for Xen < 4.5) Changes in v3: - limit VIR_DOMAIN_OSTYPE_XEN -> VIR_DOMAIN_OSTYPE_LINUX conversion to Xen PV only - do not accept VIR_DOMAIN_OSTYPE_LINUX for PVH - fix reported capabilities for PVH - remove hostdev passthrough and video/graphics - use #ifdef LIBXL_DOMAIN_TYPE_PVH instead of hypervisor version to check for PVH support - compile fix for Xen < 4.9 --- docs/formatcaps.html.in| 4 +-- docs/schemas/domaincommon.rng | 1 +- src/conf/domain_conf.c | 6 ++-- src/libxl/libxl_capabilities.c | 47 - src/libxl/libxl_conf.c | 50 ++- src/libxl/libxl_driver.c | 6 ++-- 6 files changed, 95 insertions(+), 19 deletions(-) diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in index 0d9c53d..b8102fd 100644 --- a/docs/formatcaps.html.in +++ b/docs/formatcaps.html.in @@ -104,8 +104,8 @@ machineMachine type, for use in machine attribute of os/type element in domain XML. For example Xen - supports xenfv for HVM or xenpv for - PV. + supports xenfv for HVM, xenpv for + PV, or xenpvh for PVHv2. domainThe type attribute of this element specifies the type of hypervisor required to run the domain. Use in type diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 099a949..820a7c6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -341,6 +341,7 @@ xenpv xenfv +xenpvh diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56..a945ad4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19094,7 +19094,8 @@ virDomainDefParseCaps(virDomainDefPtr def, * be 'xen'. So we accept the former and convert */ if (def->os.type == VIR_DOMAIN_OSTYPE_LINUX && -def->virtType == VIR_DOMAIN_VIRT_XEN) { +def->virtType == VIR_DOMAIN_VIRT_XEN && +(!def->os.machine || STREQ(def->os.machine, "xenpv"))) { def->os.type = VIR_DOMAIN_OSTYPE_XEN; } @@ -27705,7 +27706,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, * be 'xen'. So we convert to the former for backcompat */ if (def->virtType == VIR_DOMAIN_VIRT_XEN && -def->os.type == VIR_DOMAIN_OSTYPE_XEN) +def->os.type == VIR_DOMAIN_OSTYPE_XEN && +(!def->os.machine || STREQ(def->os.machine, "xenpv"))) virBufferAsprintf(buf, ">%s\n", virDomainOSTypeToString(VIR_DOMAIN_OSTYPE_LINUX)); else diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 18596c7..be51a4d 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -57,6 +57,7 @@ struct guest_arch { virArch arch; int bits; int hvm; +int pvh; int pae; int nonpae; int ia64_be; @@ -439,6 +440,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) int hvm = STRPREFIX([subs[1].rm_so], "hvm"); virArch arch; int pae = 0, nonpae = 0, ia64_be = 0; +#ifdef LIBXL_DOMAIN_TYPE_PVH +bool new_arch_added = false; +#endif if (STRPREFIX([subs[2].rm_so], "x86_32")) { arch = VIR_ARCH_I686; @@ -475,8 +479,12 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) if (i >= ARRAY_CARDINALITY(guest_archs)) continue; /* Didn't find a match, so create a new one */ -if (i == nr_guest_archs) +if (i == nr_guest_archs) { nr_guest_archs++; +#ifdef LIBXL_DOMAIN_TYPE_PVH +new_arch_added = true; +#endif +} guest_archs[i].arch = arch; guest_archs[i].hvm = hvm; @@ -491,13 +499,33 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps) guest_archs[i].nonpae = nonpae; if (ia64_be) guest_archs[i].ia64_be = ia64_be; + +/* + * Xen 4.9 introduced support for the PVH guest type, which + * requires hardware virtualization support similar to the + * HVM guest type. Add a PVH guest type for each new HVM + * guest type. + */ +#ifdef LIBXL_DOMAIN_TYPE_PVH +if (hvm && new_arch_added) { +i
[libvirt] [PATCH v3 3/5] tests: add basic Xen PVH test
Signed-off-by: Marek Marczykowski-Górecki --- Changes in v3: - update for modified "libxl: add support for PVH" - skip PVH test on too old Xen --- tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++- tests/libxlxml2domconfigdata/basic-pvh.xml | 28 +- tests/libxlxml2domconfigtest.c | 3 +- 3 files changed, 80 insertions(+) create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json b/tests/libxlxml2domconfigdata/basic-pvh.json new file mode 100644 index 000..48365c9 --- /dev/null +++ b/tests/libxlxml2domconfigdata/basic-pvh.json @@ -0,0 +1,49 @@ +{ +"c_info": { +"type": "pvh", +"name": "test-pvh", +"uuid": "039e9ee6-4a84-3055-4c81-8ba426ae2656" +}, +"b_info": { +"max_vcpus": 4, +"avail_vcpus": [ +0, +1, +2, +3 +], +"max_memkb": 524288, +"target_memkb": 524288, +"shadow_memkb": 8192, +"sched_params": { + +}, +"kernel": "/boot/vmlinuz", +"ramdisk": "/boot/initrd.img", +"type.pvh": { +}, +"arch_arm": { + +} +}, +"disks": [ +{ +"pdev_path": "/var/lib/xen/images/test-pv.img", +"vdev": "xvda", +"backend": "qdisk", +"format": "raw", +"removable": 1, +"readwrite": 1 +} +], +"nics": [ +{ +"devid": 0, +"mac": "00:16:3e:3e:86:60", +"bridge": "br0", +"script": "/etc/xen/scripts/vif-bridge", +"nictype": "vif" +} +], +"on_reboot": "restart" +} diff --git a/tests/libxlxml2domconfigdata/basic-pvh.xml b/tests/libxlxml2domconfigdata/basic-pvh.xml new file mode 100644 index 000..7bcf67f --- /dev/null +++ b/tests/libxlxml2domconfigdata/basic-pvh.xml @@ -0,0 +1,28 @@ + + test-pvh + 039e9ee6-4a84-3055-4c81-8ba426ae2656 + 524288 + 524288 + 4 + +xen +/boot/vmlinuz +/boot/initrd.img + + + destroy + restart + destroy + + + + + + + + + + + + + diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 22f9c2c..a11e525 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -204,6 +204,9 @@ mymain(void) DO_TEST("basic-pv"); DO_TEST("basic-hvm"); +# ifdef LIBXL_DOMAIN_TYPE_PVH +DO_TEST("basic-pvh"); +# endif DO_TEST("cpu-shares-hvm"); DO_TEST("variable-clock-hvm"); DO_TEST("moredevs-hvm"); -- git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 4/5] xenconfig: add support for parsing type= xl config entry
builder="hvm" is deprecated since Xen 4.10, new syntax is type="hvm" (or type="pv", which is default). Since the old one is still supported, still use it when writing native config, so the config will work on older Xen too (and will also not complicate tests). Signed-off-by: Marek Marczykowski-Górecki --- "type" option is the only syntax for specifying PVH guest, coming in next patch. Changes in v2: - fix code style --- src/xenconfig/xen_common.c| 18 +--- tests/xlconfigdata/test-fullvirt-type.cfg | 21 +++- tests/xlconfigdata/test-fullvirt-type.xml | 27 - tests/xlconfigdata/test-paravirt-type.cfg | 13 - tests/xlconfigdata/test-paravirt-type.xml | 25 ++- tests/xlconfigtest.c | 2 ++- 6 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg create mode 100644 tests/xlconfigdata/test-paravirt-type.xml diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c index 0a99587..6c27936 100644 --- a/src/xenconfig/xen_common.c +++ b/src/xenconfig/xen_common.c @@ -1098,9 +1098,21 @@ xenParseGeneralMeta(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps) if (xenConfigGetUUID(conf, "uuid", def->uuid) < 0) goto out; -if ((xenConfigGetString(conf, "builder", , "linux") == 0) && -STREQ(str, "hvm")) -hvm = 1; +if (xenConfigGetString(conf, "type", , NULL) == 0 && str) { +if (STREQ(str, "pv")) { +hvm = 0; +} else if (STREQ(str, "hvm")) { +hvm = 1; +} else { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("type %s is not supported"), str); +return -1; +} +} else { +if ((xenConfigGetString(conf, "builder", , "linux") == 0) && +STREQ(str, "hvm")) +hvm = 1; +} def->os.type = (hvm ? VIR_DOMAIN_OSTYPE_HVM : VIR_DOMAIN_OSTYPE_XEN); diff --git a/tests/xlconfigdata/test-fullvirt-type.cfg b/tests/xlconfigdata/test-fullvirt-type.cfg new file mode 100644 index 000..f8ecc2e --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-type.cfg @@ -0,0 +1,21 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +maxmem = 579 +memory = 394 +vcpus = 1 +pae = 1 +acpi = 1 +apic = 1 +viridian = 0 +rtc_timeoffset = 0 +localtime = 0 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +device_model = "/usr/lib/xen/bin/qemu-system-i386" +sdl = 0 +vnc = 0 +parallel = "none" +serial = "none" +type = "hvm" +boot = "d" diff --git a/tests/xlconfigdata/test-fullvirt-type.xml b/tests/xlconfigdata/test-fullvirt-type.xml new file mode 100644 index 000..da8e360 --- /dev/null +++ b/tests/xlconfigdata/test-fullvirt-type.xml @@ -0,0 +1,27 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + +hvm +/usr/lib/xen/boot/hvmloader + + + + + + + + + destroy + restart + restart + +/usr/lib/xen/bin/qemu-system-i386 + + + + + diff --git a/tests/xlconfigdata/test-paravirt-type.cfg b/tests/xlconfigdata/test-paravirt-type.cfg new file mode 100644 index 000..078db99 --- /dev/null +++ b/tests/xlconfigdata/test-paravirt-type.cfg @@ -0,0 +1,13 @@ +name = "XenGuest2" +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809" +type = "pv" +maxmem = 579 +memory = 394 +vcpus = 1 +localtime = 0 +on_poweroff = "destroy" +on_reboot = "restart" +on_crash = "restart" +kernel = "/tmp/vmlinuz" +ramdisk = "/tmp/initrd" +cmdline = "root=/dev/xvda1 console=hvc0" diff --git a/tests/xlconfigdata/test-paravirt-type.xml b/tests/xlconfigdata/test-paravirt-type.xml new file mode 100644 index 000..4357640 --- /dev/null +++ b/tests/xlconfigdata/test-paravirt-type.xml @@ -0,0 +1,25 @@ + + XenGuest2 + c7a5fdb2-cdaf-9455-926a-d65c16db1809 + 592896 + 403456 + 1 + +linux +/tmp/vmlinuz +/tmp/initrd +root=/dev/xvda1 console=hvc0 + + + destroy + restart + restart + + + + + + + + + diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index b2e4591..6e3267e 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -279,6 +279,8 @@ mymain(void) DO_TEST_FORMAT("paravirt-cmdline-extra-root", false); DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root", false); DO_TEST("rbd-multihost-noauth"); +DO_TEST_FORMAT("paravirt-type", false); +DO_TEST_FORMAT("fullvirt-type", false); #ifdef LIBXL_HAVE_DEVICE_CHANNEL DO_TEST("channel-pty"); -- git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3 0/5] libxl: PVHv2 support
This is a respin of my old PVHv1 patch[1], converted to PVHv2. Should the code use "PVH" name (as libxl does internally), or "PVHv2" as in many places in Xen documentation? I've chosen the former, but want to confirm it. Also, not sure about VIR_DOMAIN_OSTYPE_XENPVH (as discussed on PVHv1 patch) - while it will be messy in many cases, there is libxl_domain_build_info.u.{hvm,pv,pvh} which would be good to not mess up. Also, PVHv2 needs different kernel features than PV (CONFIG_XEN_PVH vs CONFIG_XEN_PV), so keeping the same VIR_DOMAIN_OSTYPE_XEN could be confusing. On the other hand, libxl_domain_build_info.u.pv is used in very few places (one section of libxlMakeDomBuildInfo), so guarding u.hvm access with VIR_DOMAIN_OSTYPE_HVM may be enough. For now I've reused VIR_DOMAIN_OSTYPE_XEN - in the driver itself, most of the code is the same as for PV. Since PVHv2 relies on features in newer Xen versions, I needed to convert also some older code. For example b_info->u.hvm.nested_hvm was deprecated in favor of b_info->nested_hvm. While the code do handle both old and new versions (obviously refusing PVHv2 if Xen is too old), this isn't the case for tests. How it should be handled, if at all? First few preparatory patches can be applied independently. [1] https://www.redhat.com/archives/libvir-list/2016-August/msg00376.html Changes in v2: - drop "docs: don't refer to deprecated 'linux' ostype in example" patch - migrating further away from "linux" os type is offtopic to this series and apparently is a controversial thing - drop "docs: update domain schema for machine attribute" patch - already applied - apply review comments from Jim - rebase on master Changes in v3: - rebase on master, drop already applied patches - use #ifdef LIBXL_DOMAIN_TYPE_PVH to detect PVH support, fix compilation failure on older Xen - exclude PVH from VIR_DOMAIN_OSTYPE_XEN <-> VIR_DOMAIN_OSTYPE_LINUX conversion - fix reported capabilities for PVH Marek Marczykowski-Górecki (5): libxl: reorder libxlMakeDomBuildInfo for upcoming PVH support libxl: add support for PVH tests: add basic Xen PVH test xenconfig: add support for parsing type= xl config entry xenconfig: add support for type="pvh" docs/formatcaps.html.in | 4 +- docs/schemas/domaincommon.rng | 1 +- src/conf/domain_conf.c | 6 +- src/libxl/libxl_capabilities.c | 47 +++--- src/libxl/libxl_conf.c | 76 -- src/libxl/libxl_driver.c| 6 +- src/xenconfig/xen_common.c | 27 ++-- src/xenconfig/xen_xl.c | 5 +- tests/libxlxml2domconfigdata/basic-pvh.json | 49 ++- tests/libxlxml2domconfigdata/basic-pvh.xml | 28 - tests/libxlxml2domconfigtest.c | 3 +- tests/testutilsxen.c| 3 +- tests/xlconfigdata/test-fullvirt-type.cfg | 21 ++- tests/xlconfigdata/test-fullvirt-type.xml | 27 - tests/xlconfigdata/test-paravirt-type.cfg | 13 - tests/xlconfigdata/test-paravirt-type.xml | 25 +++- tests/xlconfigdata/test-pvh-type.cfg| 13 - tests/xlconfigdata/test-pvh-type.xml| 25 +++- tests/xlconfigtest.c| 3 +- 19 files changed, 346 insertions(+), 36 deletions(-) create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.json create mode 100644 tests/libxlxml2domconfigdata/basic-pvh.xml create mode 100644 tests/xlconfigdata/test-fullvirt-type.cfg create mode 100644 tests/xlconfigdata/test-fullvirt-type.xml create mode 100644 tests/xlconfigdata/test-paravirt-type.cfg create mode 100644 tests/xlconfigdata/test-paravirt-type.xml create mode 100644 tests/xlconfigdata/test-pvh-type.cfg create mode 100644 tests/xlconfigdata/test-pvh-type.xml base-commit: 199eee6aae7af3d813fbe98660c7e0fa1a8ae7b7 -- git-series 0.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list