diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 50847a4470..d27ab07cbb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -938,15 +938,19 @@ Only QEMU driver support since 2.1.0 -
vcpusched and iothreadsched
+
vcpusched, iothreadsched + and emulatorsched
- The optional vcpusched and iothreadsched - elements specify the scheduler type + The optional + vcpusched, iothreadsched + and emulatorsched elements specify the scheduler type (values batch, idle, fifo, - rr) for particular vCPU and IOThread threads respecively. - The attributes vcpus and iothreads select + rr) for particular vCPU, IOThread and emulator threads + respecively. For vcpusched and iothreadsched + the attributes vcpus and iothreads select which vCPUs/IOThreads this setting applies to, leaving them out sets the - default. Valid vcpus values start at 0 through one less + default. The element emulatorsched does not have that + attribute. Valid vcpus values start at 0 through one less than the number of vCPU's defined for the domain. Valid iothreads values are described in the iothreadids @@ -958,6 +962,7 @@ well (and is ignored for non-real-time ones). The value range for the priority depends on the host kernel (usually 1-99). Since 1.2.13 + emulatorsched since 5.3.0
cachetuneSince 4.1.0
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 623ef28719..111b85c36f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -967,6 +967,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e7b8b51aad..17e8975be3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3396,6 +3396,7 @@ void virDomainDefFree(virDomainDefPtr def) virDomainIOThreadIDDefArrayFree(def->iothreadids, def->niothreadids); virBitmapFree(def->cputune.emulatorpin); + VIR_FREE(def->cputune.emulatorsched); virDomainNumaFree(def->numa); @@ -18483,6 +18484,25 @@ virDomainSchedulerParseCommonAttrs(xmlNodePtr node, } +static int +virDomainEmulatorSchedParse(xmlNodePtr node, + virDomainDefPtr def) +{ + VIR_AUTOFREE(virDomainThreadSchedParamPtr) sched = NULL; + + if (VIR_ALLOC(sched) < 0) + return -1; + + if (virDomainSchedulerParseCommonAttrs(node, + &sched->policy, + &sched->priority) < 0) + return -1; + + VIR_STEAL_PTR(def->cputune.emulatorsched, sched); + return 0; +} + + static virBitmapPtr virDomainSchedulerParse(xmlNodePtr node, const char *name, @@ -19913,6 +19933,25 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); + if ((n = virXPathNodeSet("./cputune/emulatorsched", ctxt, &nodes)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot extract emulatorsched nodes")); + goto error; + } + + if (n) { + if (n > 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only one emulatorsched is supported")); + VIR_FREE(nodes); + goto error; + } + + if (virDomainEmulatorSchedParse(nodes[0], def) < 0) + goto error; + } + VIR_FREE(nodes); + if ((n = virXPathNodeSet("./cputune/cachetune", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot extract cachetune nodes")); @@ -27490,6 +27529,11 @@ virDomainCputuneDefFormat(virBufferPtr buf, VIR_FREE(cpumask); } + if (def->cputune.emulatorsched) { + virDomainSchedulerFormat(&childrenBuf, "emulator", + def->cputune.emulatorsched, 0, false); + } + for (i = 0; i < def->maxvcpus; i++) { virDomainSchedulerFormat(&childrenBuf, "vcpu", &def->vcpus[i]->sched, i, true); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 12eb71c197..988ef90f11 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2159,6 +2159,7 @@ struct _virDomainCputune { unsigned long long iothread_period; long long iothread_quota; virBitmapPtr emulatorpin; + virDomainThreadSchedParamPtr emulatorsched; }; diff --git a/tests/genericxml2xmlindata/cputune.xml b/tests/genericxml2xmlindata/cputune.xml new file mode 100644 index 0000000000..999c8cef73 --- /dev/null +++ b/tests/genericxml2xmlindata/cputune.xml @@ -0,0 +1,37 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + 4 + + 2048 + 1000000 + -1 + + + + + + + + + + + hvm + + + + + 48 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/genericxml2xmloutdata/cputune.xml b/tests/genericxml2xmloutdata/cputune.xml new file mode 100644 index 0000000000..f9f99a4846 --- /dev/null +++ b/tests/genericxml2xmloutdata/cputune.xml @@ -0,0 +1,40 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + 4 + + 2048 + 1000000 + -1 + + + + + + + + + + + + + + hvm + + + + + 48 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 4393d44464..1840d6e6a8 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -149,6 +149,8 @@ mymain(void) DO_TEST("launch-security-sev"); + DO_TEST_DIFFERENT("cputune"); + virObjectUnref(caps); virObjectUnref(xmlopt);