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@redhat.com Cc: Gleb Natapov gleb@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)); }