summaryrefslogtreecommitdiff
path: root/hw/virtio-net.c
diff options
context:
space:
mode:
authormst@redhat.com <mst@redhat.com>2011-02-01 22:13:42 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-02-01 16:50:44 -0600
commit5430a28fe452907c9e1b2097e073bc1ea4b29f39 (patch)
tree066db9fdbac5a5ddca922b5d282161e9b6141b0e /hw/virtio-net.c
parentf157ed202e51dc2492b201dc34ed28e89c973fb7 (diff)
downloadqemu-5430a28fe452907c9e1b2097e073bc1ea4b29f39.tar.gz
vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the io thread when it's set/cleared, so vhost-net causes more context switches and higher CPU utilization than userspace virtio which handles networking in the same thread. We'll need to fix this by adding level irq support in kvm irqfd, for now disable vhost-net in these configurations. Added a vhostforce flag to force vhost-net back on. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r--hw/virtio-net.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 161f11445f..671d952921 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -119,7 +119,11 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
return;
}
if (!n->vhost_started) {
- int r = vhost_net_start(tap_get_vhost_net(n->nic->nc.peer), &n->vdev);
+ int r;
+ if (!vhost_net_query(tap_get_vhost_net(n->nic->nc.peer), &n->vdev)) {
+ return;
+ }
+ r = vhost_net_start(tap_get_vhost_net(n->nic->nc.peer), &n->vdev);
if (r < 0) {
error_report("unable to start vhost net: %d: "
"falling back on userspace virtio", -r);