[SeaBIOS] [PATCH] virtio: remove NO_NOTIFY optimization

Michael S. Tsirkin mst at redhat.com
Thu May 20 15:24:48 CEST 2010


NO_NOTIFY is an optimization to reduce the number of exits,
but using it requires careful synchronization with host,
forcing read/write ordering for the CPU. Otherwise we
risk not kicking a host when it is waiting for more buffers,
resulting in a deadlock.

Let's just always kick, it's way simpler.

Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
Cc: Gleb Natapov <gleb at redhat.com>
---

The following is compile-tested only. Gleb, could you
try it out please?

 src/virtio-ring.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/virtio-ring.c b/src/virtio-ring.c
index 7565688..493d8b5 100644
--- a/src/virtio-ring.c
+++ b/src/virtio-ring.c
@@ -143,12 +143,10 @@ void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
 {
     struct vring *vr = &vq->vring;
     struct vring_avail *avail = GET_FLATPTR(vr->avail);
-    struct vring_used *used = GET_FLATPTR(vq->vring.used);
 
     wmb();
     SET_FLATPTR(avail->idx, GET_FLATPTR(avail->idx) + num_added);
 
     mb();
-    if (!(GET_FLATPTR(used->flags) & VRING_USED_F_NO_NOTIFY))
-        vp_notify(ioaddr, GET_FLATPTR(vq->queue_index));
+    vp_notify(ioaddr, GET_FLATPTR(vq->queue_index));
 }
-- 
1.7.1.12.g42b7f



More information about the SeaBIOS mailing list