Re: [Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-30 Thread Jason Wang
Anthony Liguori writes:
  On 04/20/2011 10:33 PM, Jason Wang wrote:
   Krishna Kumar2 writes:
   Thanks Jason!
 
   So I can use my virtio-net guest driver and test with this patch?
   Please provide the script you use to start MQ guest.
 
  
   Yes and thanks. Following is a simple script may help you start macvtap mq
   guest.
  
   qemu_path=./qemu-system-x86_64
   img_path=/home/kvm_autotest_root/images/mq.qcow2
   vtap_dev=/dev/tap104
   mac=96:88:12:1C:27:83
   smp=2
   mq=4
  
   for i in `seq $mq`
   do
vtap+= -netdev tap,id=hn$i,fd=$((i+100)) $((i+100))$vtap_dev
  
  So you are basically dup()'ing the tap device.
  
  Does this actually improve performance at all?
  

The script maybe not clear. It works only for macvtap (tap does not have
multiqueue support and I plan to add it). A macvtap device needs to be created
first by ip command.

The multiqueue was achieved by opening the macvtap device many times. Each time
 the user open to macvtap device, a new queue (sock) was created. Then macvtap
 device then can forward the packets to different sock/fd based on their RX
 queue of physical nics. So the fd could be used to registered as a backend for
 vhost/qemu.

Performance improvement is expected when using smp guest with mq virtio-net and
mq nic.

  Regards,
  
  Anthony Liguori
  


-- 
Jason Wang



Re: [Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-29 Thread Anthony Liguori

On 04/20/2011 10:33 PM, Jason Wang wrote:

Krishna Kumar2 writes:
Thanks Jason!
  
So I can use my virtio-net guest driver and test with this patch?
Please provide the script you use to start MQ guest.
  

Yes and thanks. Following is a simple script may help you start macvtap mq
guest.

qemu_path=./qemu-system-x86_64
img_path=/home/kvm_autotest_root/images/mq.qcow2
vtap_dev=/dev/tap104
mac=96:88:12:1C:27:83
smp=2
mq=4

for i in `seq $mq`
do
 vtap+= -netdev tap,id=hn$i,fd=$((i+100)) $((i+100))$vtap_dev


So you are basically dup()'ing the tap device.

Does this actually improve performance at all?

Regards,

Anthony Liguori


 netdev+=hn$i#
done

eval $qemu_path $img_path $vtap -device 
virtio-net-pci,queues=$mq,netdev=$netdev,mac=$mac,vectors=32 -enable-kvm -smp $smp


Regards,
  
- KK
  
Jason Wangjasow...@redhat.com  wrote on 04/20/2011 02:03:07 PM:
  
  Jason Wangjasow...@redhat.com
  04/20/2011 02:03 PM

  To

  Krishna Kumar2/India/IBM@IBMIN, k...@vger.kernel.org, m...@redhat.com,
  net...@vger.kernel.org, ru...@rustcorp.com.au, qemu-
  de...@nongnu.org, anth...@codemonkey.ws

  cc

  Subject

  [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

  Inspired by Krishna's patch
(http://www.spinics.net/lists/kvm/msg52098.html
  ) and
  Michael's suggestions.  The following series adds the multiqueue support
for
  qemu and enable it for virtio-net (both userspace and vhost).

  The aim for this series is to simplified the management and achieve the
same
  performacne with less codes.

  Follows are the differences between this series and Krishna's:

  - Add the multiqueue support for qemu and also for userspace virtio-net
  - Instead of hacking the vhost module to manipulate kthreads, this patch
just
  implement the userspace based multiqueues and thus can re-use the
  existed vhost kernel-side codes without any modification.
  - Use 1:1 mapping between TX/RX pairs and vhost kthread because the
  implementation is based on usersapce.
  - The cli is also changed to make the mgmt easier, the -netdev option of
qdev
  can now accpet more than one ids. You can start a multiqueue virtio-net
device
  through:
  ./qemu-system-x86_64 -netdev tap,id=hn0,vhost=on,fd=X -netdev
  tap,id=hn0,vhost=on,fd=Y -device
virtio-net-pci,netdev=hn0#hn1,queues=2 ...

  The series is very primitive and still need polished.

  Suggestions are welcomed.
  ---

  Jason Wang (2):
net: Add multiqueue support
virtio-net: add multiqueue support


   hw/qdev-properties.c |   37 -
   hw/qdev.h|3
   hw/vhost.c   |   26 ++-
   hw/vhost.h   |1
   hw/vhost_net.c   |7 +
   hw/vhost_net.h   |2
   hw/virtio-net.c  |  409 +++
  +--
   hw/virtio-net.h  |2
   hw/virtio-pci.c  |1
   hw/virtio.h  |1
   net.c|   34 +++-
   net.h|   15 +-
   12 files changed, 353 insertions(+), 185 deletions(-)

  --
  Jason Wang
  






[Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-27 Thread Jason Wang
Jason Wang writes:
  Inspired by Krishna's patch (http://www.spinics.net/lists/kvm/msg52098.html) 
  and
  Michael's suggestions.  The following series adds the multiqueue support for
  qemu and enable it for virtio-net (both userspace and vhost).
  
  The aim for this series is to simplified the management and achieve the same
  performacne with less codes.
  
  Follows are the differences between this series and Krishna's:
  
  - Add the multiqueue support for qemu and also for userspace virtio-net
  - Instead of hacking the vhost module to manipulate kthreads, this patch just
  implement the userspace based multiqueues and thus can re-use the existed 
  vhost kernel-side codes without any modification.
  - Use 1:1 mapping between TX/RX pairs and vhost kthread because the
  implementation is based on usersapce.
  - The cli is also changed to make the mgmt easier, the -netdev option of qdev
  can now accpet more than one ids. You can start a multiqueue virtio-net 
  device
  through:
  ./qemu-system-x86_64 -netdev tap,id=hn0,vhost=on,fd=X -netdev
  tap,id=hn0,vhost=on,fd=Y -device virtio-net-pci,netdev=hn0#hn1,queues=2 ...
  

Hi anthony:

Have any comments about this series (cli, codes, ...)?

Thanks.

  The series is very primitive and still need polished.
  
  Suggestions are welcomed.
  ---
  
  Jason Wang (2):
net: Add multiqueue support
virtio-net: add multiqueue support
  
  
   hw/qdev-properties.c |   37 -
   hw/qdev.h|3 
   hw/vhost.c   |   26 ++-
   hw/vhost.h   |1 
   hw/vhost_net.c   |7 +
   hw/vhost_net.h   |2 
   hw/virtio-net.c  |  409 
  --
   hw/virtio-net.h  |2 
   hw/virtio-pci.c  |1 
   hw/virtio.h  |1 
   net.c|   34 +++-
   net.h|   15 +-
   12 files changed, 353 insertions(+), 185 deletions(-)
  
  -- 
  Jason Wang
  --
  To unsubscribe from this list: send the line unsubscribe netdev in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-20 Thread Jason Wang
Inspired by Krishna's patch (http://www.spinics.net/lists/kvm/msg52098.html) and
Michael's suggestions.  The following series adds the multiqueue support for
qemu and enable it for virtio-net (both userspace and vhost).

The aim for this series is to simplified the management and achieve the same
performacne with less codes.

Follows are the differences between this series and Krishna's:

- Add the multiqueue support for qemu and also for userspace virtio-net
- Instead of hacking the vhost module to manipulate kthreads, this patch just
implement the userspace based multiqueues and thus can re-use the existed vhost 
kernel-side codes without any modification.
- Use 1:1 mapping between TX/RX pairs and vhost kthread because the
implementation is based on usersapce.
- The cli is also changed to make the mgmt easier, the -netdev option of qdev
can now accpet more than one ids. You can start a multiqueue virtio-net device
through:
./qemu-system-x86_64 -netdev tap,id=hn0,vhost=on,fd=X -netdev
tap,id=hn0,vhost=on,fd=Y -device virtio-net-pci,netdev=hn0#hn1,queues=2 ...

The series is very primitive and still need polished.

Suggestions are welcomed.
---

Jason Wang (2):
  net: Add multiqueue support
  virtio-net: add multiqueue support


 hw/qdev-properties.c |   37 -
 hw/qdev.h|3 
 hw/vhost.c   |   26 ++-
 hw/vhost.h   |1 
 hw/vhost_net.c   |7 +
 hw/vhost_net.h   |2 
 hw/virtio-net.c  |  409 --
 hw/virtio-net.h  |2 
 hw/virtio-pci.c  |1 
 hw/virtio.h  |1 
 net.c|   34 +++-
 net.h|   15 +-
 12 files changed, 353 insertions(+), 185 deletions(-)

-- 
Jason Wang



Re: [Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-20 Thread Krishna Kumar2
Thanks Jason!

So I can use my virtio-net guest driver and test with this patch?
Please provide the script you use to start MQ guest.

Regards,

- KK

Jason Wang jasow...@redhat.com wrote on 04/20/2011 02:03:07 PM:

 Jason Wang jasow...@redhat.com
 04/20/2011 02:03 PM

 To

 Krishna Kumar2/India/IBM@IBMIN, k...@vger.kernel.org, m...@redhat.com,
 net...@vger.kernel.org, ru...@rustcorp.com.au, qemu-
 de...@nongnu.org, anth...@codemonkey.ws

 cc

 Subject

 [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

 Inspired by Krishna's patch
(http://www.spinics.net/lists/kvm/msg52098.html
 ) and
 Michael's suggestions.  The following series adds the multiqueue support
for
 qemu and enable it for virtio-net (both userspace and vhost).

 The aim for this series is to simplified the management and achieve the
same
 performacne with less codes.

 Follows are the differences between this series and Krishna's:

 - Add the multiqueue support for qemu and also for userspace virtio-net
 - Instead of hacking the vhost module to manipulate kthreads, this patch
just
 implement the userspace based multiqueues and thus can re-use the
 existed vhost kernel-side codes without any modification.
 - Use 1:1 mapping between TX/RX pairs and vhost kthread because the
 implementation is based on usersapce.
 - The cli is also changed to make the mgmt easier, the -netdev option of
qdev
 can now accpet more than one ids. You can start a multiqueue virtio-net
device
 through:
 ./qemu-system-x86_64 -netdev tap,id=hn0,vhost=on,fd=X -netdev
 tap,id=hn0,vhost=on,fd=Y -device
virtio-net-pci,netdev=hn0#hn1,queues=2 ...

 The series is very primitive and still need polished.

 Suggestions are welcomed.
 ---

 Jason Wang (2):
   net: Add multiqueue support
   virtio-net: add multiqueue support


  hw/qdev-properties.c |   37 -
  hw/qdev.h|3
  hw/vhost.c   |   26 ++-
  hw/vhost.h   |1
  hw/vhost_net.c   |7 +
  hw/vhost_net.h   |2
  hw/virtio-net.c  |  409 +++
 +--
  hw/virtio-net.h  |2
  hw/virtio-pci.c  |1
  hw/virtio.h  |1
  net.c|   34 +++-
  net.h|   15 +-
  12 files changed, 353 insertions(+), 185 deletions(-)

 --
 Jason Wang




Re: [Qemu-devel] [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)

2011-04-20 Thread Jason Wang
Krishna Kumar2 writes:
  Thanks Jason!
  
  So I can use my virtio-net guest driver and test with this patch?
  Please provide the script you use to start MQ guest.
  

Yes and thanks. Following is a simple script may help you start macvtap mq
guest.

qemu_path=./qemu-system-x86_64
img_path=/home/kvm_autotest_root/images/mq.qcow2
vtap_dev=/dev/tap104
mac=96:88:12:1C:27:83
smp=2
mq=4

for i in `seq $mq`
do
vtap+= -netdev tap,id=hn$i,fd=$((i+100)) $((i+100))$vtap_dev
netdev+=hn$i#
done

eval $qemu_path $img_path $vtap -device 
virtio-net-pci,queues=$mq,netdev=$netdev,mac=$mac,vectors=32 -enable-kvm -smp 
$smp


  Regards,
  
  - KK
  
  Jason Wang jasow...@redhat.com wrote on 04/20/2011 02:03:07 PM:
  
   Jason Wang jasow...@redhat.com
   04/20/2011 02:03 PM
  
   To
  
   Krishna Kumar2/India/IBM@IBMIN, k...@vger.kernel.org, m...@redhat.com,
   net...@vger.kernel.org, ru...@rustcorp.com.au, qemu-
   de...@nongnu.org, anth...@codemonkey.ws
  
   cc
  
   Subject
  
   [RFC PATCH 0/2] Multiqueue support for qemu(virtio-net)
  
   Inspired by Krishna's patch
  (http://www.spinics.net/lists/kvm/msg52098.html
   ) and
   Michael's suggestions.  The following series adds the multiqueue support
  for
   qemu and enable it for virtio-net (both userspace and vhost).
  
   The aim for this series is to simplified the management and achieve the
  same
   performacne with less codes.
  
   Follows are the differences between this series and Krishna's:
  
   - Add the multiqueue support for qemu and also for userspace virtio-net
   - Instead of hacking the vhost module to manipulate kthreads, this patch
  just
   implement the userspace based multiqueues and thus can re-use the
   existed vhost kernel-side codes without any modification.
   - Use 1:1 mapping between TX/RX pairs and vhost kthread because the
   implementation is based on usersapce.
   - The cli is also changed to make the mgmt easier, the -netdev option of
  qdev
   can now accpet more than one ids. You can start a multiqueue virtio-net
  device
   through:
   ./qemu-system-x86_64 -netdev tap,id=hn0,vhost=on,fd=X -netdev
   tap,id=hn0,vhost=on,fd=Y -device
  virtio-net-pci,netdev=hn0#hn1,queues=2 ...
  
   The series is very primitive and still need polished.
  
   Suggestions are welcomed.
   ---
  
   Jason Wang (2):
 net: Add multiqueue support
 virtio-net: add multiqueue support
  
  
hw/qdev-properties.c |   37 -
hw/qdev.h|3
hw/vhost.c   |   26 ++-
hw/vhost.h   |1
hw/vhost_net.c   |7 +
hw/vhost_net.h   |2
hw/virtio-net.c  |  409 +++
   +--
hw/virtio-net.h  |2
hw/virtio-pci.c  |1
hw/virtio.h  |1
net.c|   34 +++-
net.h|   15 +-
12 files changed, 353 insertions(+), 185 deletions(-)
  
   --
   Jason Wang