[PATCH v2 1/4] domain_conf: Introduce iothreads XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 docs/formatdomain.html.in     | 26 ++++++++++++++++++++++++++
 docs/schemas/domaincommon.rng |  6 ++++++
 src/conf/domain_conf.c        | 20 ++++++++++++++++++++
 src/conf/domain_conf.h        |  2 ++
 4 files changed, 54 insertions(+)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index de4e4eb..b584a08 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -470,6 +470,32 @@
       </dd>
     </dl>
 
+    <h3><a name="elementsIOThreadsAllocation">IOThreads Allocation</a></h3>
+      <p>
+        IOThreads are a QEMU feature that will allow supported disk
+        devices to be configured to use a dedicated event loop thread
+        to handle block I/O requests.
+        <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 and 1 IOThread per
+        supported device.
+      </dd>
+    </dl>
 
     <h3><a name="elementsCPUTuning">CPU Tuning</a></h3>
 
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3170db2..5f1c226 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -632,6 +632,12 @@
       </optional>
 
       <optional>
+        <element name="iothreads">
+          <ref name="unsignedInt"/>
+        </element>
+      </optional>
+
+      <optional>
         <ref name="blkiotune"/>
       </optional>
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dd512ca..81a3fdf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11957,6 +11957,15 @@ virDomainDefParseXML(xmlDocPtr xml,
         }
     }
 
+    /* Optional - iothreads */
+    tmp = virXPathString("string(./iothreads[1])", ctxt);
+    if (tmp && virStrToLong_uip(tmp, NULL, 0, &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) {
@@ -14537,6 +14546,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"),
@@ -17950,6 +17967,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 ||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index aead903..23b117d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1915,6 +1915,8 @@ struct _virDomainDef {
     int placement_mode;
     virBitmapPtr cpumask;
 
+    unsigned int iothreads;
+
     struct {
         unsigned long shares;
         bool sharesSpecified;
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]