]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Add vhost-net support
authorSasha Levin <levinsasha928@gmail.com>
Wed, 16 Nov 2011 12:24:36 +0000 (14:24 +0200)
committerPekka Enberg <penberg@kernel.org>
Wed, 16 Nov 2011 19:20:22 +0000 (21:20 +0200)
commit4b0ee1b76a3fa1b323503a1cd72b271b418ec238
tree7d7108b6014f9a85aa0810e02cca92e36e0cec39
parentde82fc3e6fb8e2524aa08c757c3876b9a94e1cc7
kvm tools: Add vhost-net support

This patch adds support to using the vhost-net device when using a tap backed
virtio-net device.

Activating vhost-net is done by appending a 'vhost=1' flag to the net device
configuration. For example:

'kvm run -n mode=tap,vhost=1'

This improves performance as follows:

  Short version
  ------------------

  TCP Throughput: +29%
  UDP Throughput: +10%
  TCP Latency: -15%
  UDP Latency: -12%

  Long version
  ------------------

  MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
  192.168.33.4 (192.168.33.4) port 0 AF_INET
  Recv   Send    Send
  Socket Socket  Message  Elapsed
  Size   Size    Size     Time     Throughput
  bytes  bytes   bytes    secs.    10^6bits/sec

   87380  16384  16384    10.00    4895.04

  MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
  192.168.33.4 (192.168.33.4) port 0 AF_INET
  Socket  Message  Elapsed      Messages
  Size    Size     Time         Okay Errors   Throughput
  bytes   bytes    secs            #      #   10^6bits/sec

  229376   65507   10.00      125287      0    6565.60
  229376           10.00      106910           5602.57

  MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
  to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
  Local /Remote
  Socket Size   Request  Resp.   Elapsed  Trans.
  Send   Recv   Size     Size    Time     Rate
  bytes  Bytes  bytes    bytes   secs.    per sec

  16384  87380  1        1       10.00    14811.55

  MIGRATED UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
  to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
  Local /Remote
  Socket Size   Request  Resp.   Elapsed  Trans.
  Send   Recv   Size     Size    Time     Rate
  bytes  Bytes  bytes    bytes   secs.    per sec

  229376 229376 1        1       10.00    16000.44
  229376 229376

  After:

  MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
  192.168.33.4 (192.168.33.4) port 0 AF_INET
  Recv   Send    Send
  Socket Socket  Message  Elapsed
  Size   Size    Size     Time     Throughput
  bytes  bytes   bytes    secs.    10^6bits/sec

   87380  16384  16384    10.00    6340.74

  MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
  192.168.33.4 (192.168.33.4) port 0 AF_INET
  Socket  Message  Elapsed      Messages
  Size    Size     Time         Okay Errors   Throughput
  bytes   bytes    secs            #      #   10^6bits/sec

  229376   65507   10.00      131478      0    6890.09
  229376           10.00      118136           6190.90

  MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
  to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
  Local /Remote
  Socket Size   Request  Resp.   Elapsed  Trans.
  Send   Recv   Size     Size    Time     Rate
  bytes  Bytes  bytes    bytes   secs.    per sec

  16384  87380  1        1       10.00    17126.10

  MIGRATED UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
  to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
  Local /Remote
  Socket Size   Request  Resp.   Elapsed  Trans.
  Send   Recv   Size     Size    Time     Rate
  bytes  Bytes  bytes    bytes   secs.    per sec

229376 229376 1        1       10.00    17944.51
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-run.c
tools/kvm/include/kvm/virtio-net.h
tools/kvm/virtio/net.c