guest->host host->guest || cpu utilization throughput vmexits || 01-tx-notifies-disabled-for-longer 02-flush-in-io-thread 03-catch-more-io 04-no-tx-timer 05-drop-mutex
From: Mark McLoughlinIf you're interested, the nasty scripts I used to generate these are hereSubject: [PATCH] kvm: qemu: virtio_net: remove the tx timer Signed-off-by: Mark McLoughlin --- qemu/hw/virtio-net.c | 42 +++--------------------------------------- 1 files changed, 3 insertions(+), 39 deletions(-) diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 32a93ba..8a7efd9 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -35,8 +35,6 @@ #define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ #define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ -#define TX_TIMER_INTERVAL 150000 /* 150 us */ - /* The config defining mac address (6 bytes) */ struct virtio_net_config { @@ -68,8 +66,6 @@ typedef struct VirtIONet VirtQueue *rx_vq; VirtQueue *tx_vq; VLANClientState *vc; - QEMUTimer *tx_timer; - int tx_timer_active; QEMUBH *tx_bh; int tx_bh_scheduled; } VirtIONet; @@ -278,30 +274,9 @@ static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) if (n->tx_bh_scheduled) return; - if (n->tx_timer_active) { - qemu_del_timer(n->tx_timer); - n->tx_timer_active = 0; - qemu_bh_schedule(n->tx_bh); - n->tx_bh_scheduled = 1; - } else { - qemu_mod_timer(n->tx_timer, - qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); - n->tx_timer_active = 1; - vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; - } -} - -static void virtio_net_tx_timer(void *opaque) -{ - VirtIONet *n = opaque; - - n->tx_timer_active = 0; - - if (virtio_net_flush_tx(n, n->tx_vq, 1)) { - n->tx_vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; - qemu_bh_schedule(n->tx_bh); - n->tx_bh_scheduled = 1; - } + vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; + qemu_bh_schedule(n->tx_bh); + n->tx_bh_scheduled = 1; } static void virtio_net_tx_bh(void *opaque) @@ -324,7 +299,6 @@ static void virtio_net_save(QEMUFile *f, void *opaque) virtio_save(&n->vdev, f); qemu_put_buffer(f, n->mac, 6); - qemu_put_be32(f, n->tx_timer_active); } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) @@ -337,12 +311,6 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) virtio_load(&n->vdev, f); qemu_get_buffer(f, n->mac, 6); - n->tx_timer_active = qemu_get_be32(f); - - if (n->tx_timer_active) { - qemu_mod_timer(n->tx_timer, - qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); - } return 0; } @@ -351,8 +319,6 @@ static int virtio_net_uninit(PCIDevice *dev) { VirtIONet *n = (VirtIONet *)dev; - qemu_del_timer(n->tx_timer); - qemu_free_timer(n->tx_timer); qemu_bh_delete(n->tx_bh); return 0; @@ -379,8 +345,6 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) n->vc = qemu_new_vlan_client(nd->vlan, virtio_net_receive, virtio_net_can_receive, n); - n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); - n->tx_timer_active = 0; n->tx_bh = qemu_bh_new(virtio_net_tx_bh, n); n->tx_bh_scheduled = 0; -- 1.6.0.1