]> xenbits.xensource.com Git - libvirt.git/commitdiff
domain_conf: Introduce iothreads XML
authorJohn Ferlan <jferlan@redhat.com>
Fri, 22 Aug 2014 14:15:51 +0000 (10:15 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 28 Aug 2014 20:27:53 +0000 (16:27 -0400)
Introduce XML to allowing adding iothreads to the domain. These can be
used by virtio-blk-pci devices in order to assign a specific thread to
handle the workload for the device.  The iothreads are the official
implementation of the virtio-blk Data Plane that's been in tech preview
for QEMU.

docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h

index de4e4ebfb6ba9378fe6a95cbfa5666d9c3e4a6a0..35f48b273b4fb8eb2a3ec8dded4f25903e85965c 100644 (file)
       </dd>
     </dl>
 
+    <h3><a name="elementsIOThreadsAllocation">IOThreads Allocation</a></h3>
+      <p>
+        IOThreads are dedicated event loop threads for supported disk
+        devices to perform block I/O requests in order to improve
+        scalability especially on an SMP host/guest with many LUNs.
+        <span class="since">Since 1.2.8 (QEMU only)</span>
+      </p>
+
+<pre>
+&lt;domain&gt;
+  ...
+  &lt;iothreads&gt;4&lt;/iothreads&gt;
+  ...
+&lt;/domain&gt;
+</pre>
+
+    <dl>
+      <dt><code>iothreads</code></dt>
+      <dd>
+        The content of this optional element defines the number
+        of IOThreads to be assigned to the domain for use by
+        virtio-blk-pci target storage devices. There should be
+        only 1 or 2 IOThreads per host CPU. There may be more than
+        supported device assigned to each IOThread.
+      </dd>
+    </dl>
 
     <h3><a name="elementsCPUTuning">CPU Tuning</a></h3>
 
index 3170db25c38397b3aa908dc7c0717a6064e60cbd..5f1c22658d76d77d008cba1ea241952ed2d5e408 100644 (file)
         </element>
       </optional>
 
+      <optional>
+        <element name="iothreads">
+          <ref name="unsignedInt"/>
+        </element>
+      </optional>
+
       <optional>
         <ref name="blkiotune"/>
       </optional>
index 8e42641b8318ad5e3bdc73773e3f0e41d0f70c34..adf197b80bfdb2eef2717e7d158f08217a941a42 100644 (file)
@@ -11977,6 +11977,15 @@ virDomainDefParseXML(xmlDocPtr xml,
         }
     }
 
+    /* Optional - iothreads */
+    tmp = virXPathString("string(./iothreads[1])", ctxt);
+    if (tmp && virStrToLong_uip(tmp, NULL, 10, &def->iothreads) < 0) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("invalid iothreads count '%s'"), tmp);
+        goto error;
+    }
+    VIR_FREE(tmp);
+
     /* Extract cpu tunables. */
     if ((n = virXPathULong("string(./cputune/shares[1])", ctxt,
                            &def->cputune.shares)) < -1) {
@@ -14566,6 +14575,14 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
         goto error;
     }
 
+    if (src->iothreads != dst->iothreads) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain iothreads count %u does not "
+                         "match source %u"),
+                       dst->iothreads, src->iothreads);
+        goto error;
+    }
+
     if (STRNEQ(src->os.type, dst->os.type)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain OS type %s does not match source %s"),
@@ -17971,6 +17988,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
         virBufferAsprintf(buf, " current='%u'", def->vcpus);
     virBufferAsprintf(buf, ">%u</vcpu>\n", def->maxvcpus);
 
+    if (def->iothreads > 0)
+        virBufferAsprintf(buf, "<iothreads>%u</iothreads>\n", def->iothreads);
+
     if (def->cputune.sharesSpecified ||
         (def->cputune.nvcpupin && !virDomainIsAllVcpupinInherited(def)) ||
         def->cputune.period || def->cputune.quota ||
index a05254a7b7d18f62d2100abc3833883a74d393d4..f8ae0e768934eef2ec130b710394ebdeec23636a 100644 (file)
@@ -1915,6 +1915,8 @@ struct _virDomainDef {
     int placement_mode;
     virBitmapPtr cpumask;
 
+    unsigned int iothreads;
+
     struct {
         unsigned long shares;
         bool sharesSpecified;