From 579a9f5320242d73e0220735c42df9adfb0a5d83 Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Wed, 6 Jul 2016 10:24:33 -0700 Subject: [PATCH] lkl: save vm_notify in virtio virtio avail event is set to the end of the virtio ring. In TCP_RR, whenever a packet is received, the avail idx is increamented and a vm_notify is called. This commit can save vm_notify until there is no available buffer in vring. No obvious diff in netperf numbers. Signed-off-by: Yuan Liu --- tools/lkl/lib/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lkl/lib/virtio.c b/tools/lkl/lib/virtio.c index a5c041f85d8be2..373353000aa8de 100644 --- a/tools/lkl/lib/virtio.c +++ b/tools/lkl/lib/virtio.c @@ -207,14 +207,14 @@ void virtio_process_queue(struct virtio_dev *dev, uint32_t qidx) if (dev->ops->acquire_queue) dev->ops->acquire_queue(dev, qidx); - virtio_set_avail_event(q, q->avail->idx); - while (q->last_avail_idx != le16toh(q->avail->idx)) { /* Make sure following loads happens after loading q->avail->idx. */ __sync_synchronize(); if (virtio_process_one(dev, q, q->last_avail_idx) < 0) break; + if (q->last_avail_idx == le16toh(q->avail->idx)) + virtio_set_avail_event(q, q->avail->idx); } if (dev->ops->release_queue)