Re: [PATCH 4/4] qemu: add multiqueue vhost-user support

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

 



On Thu, Jun 04, 2015 at 05:54:17PM +0200, Maxime Leroy wrote:
On Thu, Jun 4, 2015 at 3:43 PM, Martin Kletzander <mkletzan@xxxxxxxxxx> wrote:
From: Maxime Leroy <maxime.leroy@xxxxxxxxx>

This patch adds the support of queues attribute of the driver element
for vhost-user interface type. Example:

<interface type='vhostuser'>
      <mac address='52:54:00:ee:96:6d'/>
      <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
      <model type='virtio'/>
      <driver queues='4'/>
</interface>

Signed-off-by: Maxime Leroy <maxime.leroy@xxxxxxxxx>
Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 docs/formatdomain.html.in                                 | 11 +++++++++--
 src/qemu/qemu_command.c                                   | 15 ++++++++++++++-
 ...stuser.args => qemuxml2argv-net-vhostuser-multiq.args} |  6 +++++-
 ...hostuser.xml => qemuxml2argv-net-vhostuser-multiq.xml} |  6 ++++++
 tests/qemuxml2argvtest.c                                  |  3 +++
 5 files changed, 37 insertions(+), 4 deletions(-)
 copy tests/qemuxml2argvdata/{qemuxml2argv-net-vhostuser.args => qemuxml2argv-net-vhostuser-multiq.args} (75%)
 copy tests/qemuxml2argvdata/{qemuxml2argv-net-vhostuser.xml => qemuxml2argv-net-vhostuser-multiq.xml} (87%)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 72ad54cee188..85238a16af8d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4260,7 +4260,8 @@ qemu-kvm -net nic,model=? /dev/null
         type='virtio'/&gt;</code>, multiple packet processing queues can be
         created; each queue will potentially be handled by a different
         processor, resulting in much higher throughput.
-        <span class="since">Since 1.0.6 (QEMU and KVM only)</span>
+        <span class="since">Since 1.0.6 (QEMU and KVM only) and for vhost-user
+          since 1.2.17</span>
       </dd>
       <dt><code>host</code> offloading options</dt>
       <dd>
@@ -4581,9 +4582,15 @@ qemu-kvm -net nic,model=? /dev/null
   &lt;devices&gt;
     &lt;interface type='vhostuser'&gt;
       &lt;mac address='52:54:00:3b:83:1a'/&gt;
-      &lt;source type='unix' path='/tmp/vhost.sock' mode='server'/&gt;
+      &lt;source type='unix' path='/tmp/vhost1.sock' mode='server'/&gt;
       &lt;model type='virtio'/&gt;
     &lt;/interface&gt;
+    &lt;interface type='vhostuser'&gt;
+      &lt;mac address='52:54:00:3b:83:1b'/&gt;
+      &lt;source type='unix' path='/tmp/vhost2.sock' mode='client'/&gt;
+      &lt;model type='virtio'/&gt;
+      &lt;driver queues='5'/&gt;
+    &lt;/interface&gt;
   &lt;/devices&gt;
   ...</pre>

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 61faa576e11b..f805f6700e71 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8089,6 +8089,7 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
 {
     virBuffer chardev_buf = VIR_BUFFER_INITIALIZER;
     virBuffer netdev_buf = VIR_BUFFER_INITIALIZER;
+    unsigned int queues = 1;

Why setting queues to 1 and not to net->driver.virtio.queues directly ?


Oh, you're right, I didn't write it from scratch, I just renamed it.
I'm amending the patch right now.

     char *nic = NULL;

     if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
@@ -8126,13 +8127,25 @@ qemuBuildVhostuserCommandLine(virCommandPtr cmd,
     virBufferAsprintf(&netdev_buf, "type=vhost-user,id=host%s,chardev=char%s",
                       net->info.alias, net->info.alias);

+    queues = net->driver.virtio.queues;
+    if (queues) {

I know it's never set to 1 thanks to your patch: "conf: Ignore
multiqueue with one queue."

Anyway I think we should check if queues is superior to 1 for
improving code readability.


It seems more readable to me if you just check whether there is
anything to setup (treating it as a bool) and then just setting up
what needs to be done.  I'm OK with changing it back to (queues > 1).

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

Attachment: signature.asc
Description: PGP signature

--
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]