[libvirt] [PATCH 4/4] qemu: add multiqueue vhost-user support
Martin Kletzander
mkletzan at redhat.com
Thu Jun 4 16:59:13 UTC 2015
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 at redhat.com> wrote:
>> From: Maxime Leroy <maxime.leroy at 6wind.com>
>>
>> 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 at 6wind.com>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>> 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'/></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
>> <devices>
>> <interface type='vhostuser'>
>> <mac address='52:54:00:3b:83:1a'/>
>> - <source type='unix' path='/tmp/vhost.sock' mode='server'/>
>> + <source type='unix' path='/tmp/vhost1.sock' mode='server'/>
>> <model type='virtio'/>
>> </interface>
>> + <interface type='vhostuser'>
>> + <mac address='52:54:00:3b:83:1b'/>
>> + <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
>> + <model type='virtio'/>
>> + <driver queues='5'/>
>> + </interface>
>> </devices>
>> ...</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 at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150604/1ab83bdb/attachment-0001.sig>
More information about the libvir-list
mailing list