<iothread id="2"/>
<iothread id="4"/>
<iothread id="6"/>
- <iothread id="8" thread_pool_min="2" thread_pool_max="32"/>
+ <iothread id="8" thread_pool_min="2" thread_pool_max="32">
+ <poll max='123' grow='456' shrink='789'/>
+ </iothread>
</iothreadids>
<defaultiothread thread_pool_min="8" thread_pool_max="16"/>
...
``thread_pool_max`` which allow setting lower and upper boundary for number
of worker threads for given IOThread. While the former can be value of zero,
the latter can't. :since:`Since 8.5.0`
+ :since:`Since 9.4.0` an optional sub-element ``poll`` with can be used to
+ override the hypervisor-default interval of polling for the iothread before
+ it switches back to events. The optional attribute ``max`` sets the maximum
+ time polling should be used in nanoseconds. Setting ``max`` to ``0`` disables
+ polling. Attributes ``grow`` and ``shrink`` override (or disable when set to
+ ``0`` the default steps for increasing/decreasing the polling interval if
+ the set interval is deemed insufficient or extensive.
``defaultiothread``
This element represents the default event loop within hypervisor, where I/O
requests from devices not assigned to a specific IOThread are processed.
virDomainIOThreadIDDefParseXML(xmlNodePtr node)
{
g_autoptr(virDomainIOThreadIDDef) iothrid = virDomainIOThreadIDDefNew();
+ xmlNodePtr pollNode;
if (virXMLPropUInt(node, "id", 10,
VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
&iothrid->thread_pool_max, -1) < 0)
return NULL;
+ if ((pollNode = virXMLNodeGetSubelement(node, "poll"))) {
+ int rc;
+
+ if ((rc = virXMLPropULongLong(pollNode, "max", 10, VIR_XML_PROP_NONE,
+ &iothrid->poll_max_ns)) < 0)
+ return NULL;
+
+ iothrid->set_poll_max_ns = rc == 1;
+
+ if ((rc = virXMLPropULongLong(pollNode, "grow", 10, VIR_XML_PROP_NONE,
+ &iothrid->poll_grow)) < 0)
+ return NULL;
+
+ iothrid->set_poll_grow = rc == 1;
+
+ if ((rc = virXMLPropULongLong(pollNode, "shrink", 10, VIR_XML_PROP_NONE,
+ &iothrid->poll_shrink)) < 0)
+ return NULL;
+
+ iothrid->set_poll_shrink = rc == 1;
+ }
+
return g_steal_pointer(&iothrid);
}
for (i = 0; i < def->niothreadids; i++) {
if (!def->iothreadids[i]->autofill ||
+ def->iothreadids[i]->set_poll_max_ns ||
+ def->iothreadids[i]->set_poll_grow ||
+ def->iothreadids[i]->set_poll_shrink ||
def->iothreadids[i]->thread_pool_min >= 0 ||
def->iothreadids[i]->thread_pool_max >= 0)
return true;
for (i = 0; i < def->niothreadids; i++) {
virDomainIOThreadIDDef *iothread = def->iothreadids[i];
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) iothreadChildBuf = VIR_BUFFER_INIT_CHILD(&childrenBuf);
+ g_auto(virBuffer) pollAttrBuf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&attrBuf, " id='%u'",
iothread->iothread_id);
iothread->thread_pool_max);
}
- virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL);
+ if (iothread->set_poll_max_ns)
+ virBufferAsprintf(&pollAttrBuf, " max='%llu'", iothread->poll_max_ns);
+
+ if (iothread->set_poll_grow)
+ virBufferAsprintf(&pollAttrBuf, " grow='%llu'", iothread->poll_grow);
+
+ if (iothread->set_poll_shrink)
+ virBufferAsprintf(&pollAttrBuf, " shrink='%llu'", iothread->poll_shrink);
+
+ virXMLFormatElement(&iothreadChildBuf, "poll", &pollAttrBuf, NULL);
+
+ virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, &iothreadChildBuf);
}
virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf);