virtio/vhost: drop unnecessary VHOST_SET_VRING call
PATCH 1/1 virtio/vhost: drop unnecessary VHOST_SET_VRING call
No need to send VHOST_SET_VRING_CALL to backend before the negotiation with the guest is finished.
--- hw/virtio/vhost.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
hw/virtio/vhost.c +1 -12
@@ -875,24 +875,13 @@ static void vhost_eventfd_del(MemoryListener *listener,static int vhost_virtqueue_init (struct vhost_dev *dev,struct vhost_virtqueue *vq,int n) { -struct vhost_vring_file file = { - .index = n, - };int r =event_notifier_init (&vq->masked_notifier,0 ); +if (r <0 ) {return r; } - file.fd =event_notifier_get_fd (&vq->masked_notifier); - r = dev->vhost_ops->vhost_call (dev,VHOST_SET_VRING_CALL , &file); -if (r) { - r = -errno; - goto fail_call; - }return 0 ; -fail_call: -event_notifier_cleanup (&vq->masked_notifier); -return r; }static void vhost_virtqueue_cleanup (struct vhost_virtqueue *vq)
Signature · 1 line
2.1.0
Quoted 4 lines · Marcel Apfelbaum
No need to send
VHOST_SET_VRING_CALLto backend before the negotiation with the guest is finished.Signed-off-by Marcel Apfelbaum <[email protected]>
Well - we do need to set it to the masked notifier initially to avoid losing events. You can't just drop it - need to move this call somewhere else.
Quoted 36 lines
--- hw/virtio/vhost.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)hw/virtio/vhost.c +1
-12@@ -875,24 +875,13 @@ static void vhost_eventfd_del(MemoryListener *listener,static int vhost_virtqueue_init (struct vhost_dev *dev,struct vhost_virtqueue *vq,int n) { -struct vhost_vring_file file = { - .index = n, - };int r =event_notifier_init (&vq->masked_notifier,0 ); +if (r <0 ) {return r; } - file.fd =event_notifier_get_fd (&vq->masked_notifier); - r = dev->vhost_ops->vhost_call (dev,VHOST_SET_VRING_CALL , &file); -if (r) { - r = -errno; - goto fail_call; - }return 0 ; -fail_call: -event_notifier_cleanup (&vq->masked_notifier); -return r; }static void vhost_virtqueue_cleanup (struct vhost_virtqueue *vq)Signature · 1 line
2.1.0
Quoted 9 lines · Michael S. Tsirkin
Quoted 4 lines · Marcel Apfelbaum
No need to send
VHOST_SET_VRING_CALLto backend before the negotiation with the guest is finished.Signed-off-by Marcel Apfelbaum <[email protected]>Well - we do need to set it to the masked notifier initially to avoid losing events. You can't just drop it - need to move this call somewhere else.
What do we need to set?
I just dropped the call to VHOST_SET_VRING_CALL.
Thanks,
Marcel
Quoted 37 lines
Quoted 37 lines
--- hw/virtio/vhost.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)hw/virtio/vhost.c +1
-13@@ -875,24 +875,13 @@ static void vhost_eventfd_del(MemoryListener *listener,static int vhost_virtqueue_init (struct vhost_dev *dev,struct vhost_virtqueue *vq,int n) { -struct vhost_vring_file file = { - .index = n, - };int r =event_notifier_init (&vq->masked_notifier,0 ); +if (r <0 ) {return r; } - file.fd =event_notifier_get_fd (&vq->masked_notifier); - r = dev->vhost_ops->vhost_call (dev,VHOST_SET_VRING_CALL , &file); -if (r) { - r = -errno; - goto fail_call; - }return 0 ; -fail_call: -event_notifier_cleanup (&vq->masked_notifier); -return r; }static void vhost_virtqueue_cleanup (struct vhost_virtqueue *vq) --2.1.0
Quoted 7 lines · Marcel Apfelbaum
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines · Marcel Apfelbaum
No need to send
VHOST_SET_VRING_CALLto backend before the negotiation with the guest is finished.Signed-off-by Marcel Apfelbaum <[email protected]>
Quoted 8 lines
Quoted 3 lines
Well - we do need to set it to the masked notifier initially to avoid losing events. You can't just drop it - need to move this call somewhere else.
What do we need to set?
I just dropped the call toVHOST_SET_VRING_CALL.Thanks,
Marcel
We use two eventfds: masked and unmasked one.
We switch dynamically dependent on msi mask value. Code assumes we start out masked, so we need to match that.
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
--- hw/virtio/vhost.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)hw/virtio/vhost.c +1
-13@@ -875,24 +875,13 @@ static void vhost_eventfd_del(MemoryListener *listener,static int vhost_virtqueue_init (struct vhost_dev *dev,struct vhost_virtqueue *vq,int n) { -struct vhost_vring_file file = { - .index = n, - };int r =event_notifier_init (&vq->masked_notifier,0 ); +if (r <0 ) {return r; } - file.fd =event_notifier_get_fd (&vq->masked_notifier); - r = dev->vhost_ops->vhost_call (dev,VHOST_SET_VRING_CALL , &file); -if (r) { - r = -errno; - goto fail_call; - }return 0 ; -fail_call: -event_notifier_cleanup (&vq->masked_notifier); -return r; }static void vhost_virtqueue_cleanup (struct vhost_virtqueue *vq) --2.1.0