提交 ce37df91 编写于 作者: P Paolo Bonzini 提交者: Michael Roth

virtio: always use handle_aio_output if registered

Commit ad07cd69 ("virtio-scsi: always use dataplane path if ioeventfd is
active", 2016-10-30) and 9ffe337c ("virtio-blk: always use dataplane
path if ioeventfd is active", 2016-10-30) broke the virtio 1.0
indirect access registers.

The indirect access registers bypass the ioeventfd, so that virtio-blk
and virtio-scsi now repeatedly try to initialize dataplane instead of
triggering the guest->host EventNotifier.  Detect the situation by
checking vq->handle_aio_output; if it is not NULL, trigger the
EventNotifier, which is how the device expects to get notifications
and in fact the only thread-safe manner to deliver them.

Fixes: ad07cd69
Fixes: 9ffe337c
Cc: qemu-stable@nongnu.org
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit e49a6618)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 dc35a137
...@@ -1256,7 +1256,18 @@ static void virtio_queue_notify_vq(VirtQueue *vq) ...@@ -1256,7 +1256,18 @@ static void virtio_queue_notify_vq(VirtQueue *vq)
void virtio_queue_notify(VirtIODevice *vdev, int n) void virtio_queue_notify(VirtIODevice *vdev, int n)
{ {
virtio_queue_notify_vq(&vdev->vq[n]); VirtQueue *vq = &vdev->vq[n];
if (unlikely(!vq->vring.desc || vdev->broken)) {
return;
}
trace_virtio_queue_notify(vdev, vq - vdev->vq, vq);
if (vq->handle_aio_output) {
event_notifier_set(&vq->host_notifier);
} else if (vq->handle_output) {
vq->handle_output(vdev, vq);
}
} }
uint16_t virtio_queue_vector(VirtIODevice *vdev, int n) uint16_t virtio_queue_vector(VirtIODevice *vdev, int n)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册