conf: Adjust the iothreadsched expectations

With iothreadid's allowing any 'id' value for an iothread_id, the
iothreadsched code needs a slight adjustment to allow for "any"
unsigned int value in order to create the bitmap of ids that will
have scheduler adjustments. Adjusted the doc description as well.
This commit is contained in:
John Ferlan 2015-04-21 17:21:28 -04:00
parent b266486fb9
commit 4dec8a0160
3 changed files with 27 additions and 6 deletions

View File

@ -691,10 +691,18 @@
type (values <code>batch</code>, <code>idle</code>, <code>fifo</code>, type (values <code>batch</code>, <code>idle</code>, <code>fifo</code>,
<code>rr</code>) for particular vCPU/IOThread threads (based on <code>rr</code>) for particular vCPU/IOThread threads (based on
<code>vcpus</code> and <code>iothreads</code>, leaving out <code>vcpus</code> and <code>iothreads</code>, leaving out
<code>vcpus</code>/<code>iothreads</code> sets the default). For <code>vcpus</code>/<code>iothreads</code> sets the default). Valid
real-time schedulers (<code>fifo</code>, <code>rr</code>), priority must <code>vcpus</code> values start at 0 through one less than the
be specified as well (and is ignored for non-real-time ones). The value number of vCPU's defined for the domain. Valid <code>iothreads</code>
range for the priority depends on the host kernel (usually 1-99). values are described in the <code>iothreadids</code>
<a href="#elementsIOThreadsAllocation"><code>description</code></a>.
If no <code>iothreadids</code> are defined, then libvirt numbers
IOThreads from 1 to the number of <code>iothreads</code> available
for the domain. For real-time schedulers (<code>fifo</code>,
<code>rr</code>), priority must real-time schedulers
(<code>fifo</code>, <code>rr</code>), priority must be specified as
well (and is ignored for non-real-time ones). The value range
for the priority depends on the host kernel (usually 1-99).
<span class="since">Since 1.2.13</span> <span class="since">Since 1.2.13</span>
</dd> </dd>

View File

@ -14348,12 +14348,24 @@ virDomainDefParseXML(xmlDocPtr xml,
def->cputune.niothreadsched = n; def->cputune.niothreadsched = n;
for (i = 0; i < def->cputune.niothreadsched; i++) { for (i = 0; i < def->cputune.niothreadsched; i++) {
ssize_t pos = -1;
if (virDomainThreadSchedParse(nodes[i], if (virDomainThreadSchedParse(nodes[i],
1, def->iothreads, 1, UINT_MAX,
"iothreads", "iothreads",
&def->cputune.iothreadsched[i]) < 0) &def->cputune.iothreadsched[i]) < 0)
goto error; goto error;
while ((pos = virBitmapNextSetBit(def->cputune.iothreadsched[i].ids,
pos)) > -1) {
if (!virDomainIOThreadIDFind(def, pos)) {
virReportError(VIR_ERR_XML_DETAIL, "%s",
_("iothreadsched attribute 'iothreads' "
"uses undefined iothread ids"));
goto error;
}
}
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (virBitmapOverlaps(def->cputune.iothreadsched[i].ids, if (virBitmapOverlaps(def->cputune.iothreadsched[i].ids,
def->cputune.iothreadsched[j].ids)) { def->cputune.iothreadsched[j].ids)) {

View File

@ -13,7 +13,8 @@
<vcpupin vcpu='1' cpuset='1'/> <vcpupin vcpu='1' cpuset='1'/>
<emulatorpin cpuset='1'/> <emulatorpin cpuset='1'/>
<vcpusched vcpus='0-1' scheduler='fifo' priority='1'/> <vcpusched vcpus='0-1' scheduler='fifo' priority='1'/>
<iothreadsched iothreads='2' scheduler='batch'/> <iothreadsched iothreads='1' scheduler='batch'/>
<iothreadsched iothreads='2' scheduler='fifo' priority='1'/>
</cputune> </cputune>
<os> <os>
<type arch='i686' machine='pc'>hvm</type> <type arch='i686' machine='pc'>hvm</type>