[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v2 07/13] vhost: Avoid re-set masked notifier in shadow vq
From: |
Eugenio Pérez |
Subject: |
[RFC v2 07/13] vhost: Avoid re-set masked notifier in shadow vq |
Date: |
Mon, 15 Mar 2021 20:48:36 +0100 |
Since all the shadow virtqueue device is done in software, we can avoid
the write syscall.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-shadow-virtqueue.c
b/hw/virtio/vhost-shadow-virtqueue.c
index 8f6ffa729a..b6bab438d6 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -41,6 +41,9 @@ typedef struct VhostShadowVirtqueue {
* set when the masked notifier has no uses
*/
QemuEvent is_free;
+
+ /* Avoid re-sending signals */
+ bool signaled;
} masked_notifier;
/* Virtio queue shadowing */
@@ -81,7 +84,8 @@ static void vhost_shadow_vq_handle_call_no_test(EventNotifier
*n)
unsigned n = virtio_get_queue_index(svq->vq);
virtio_queue_invalidate_signalled_used(svq->vdev, n);
virtio_notify_irqfd(svq->vdev, svq->vq);
- } else {
+ } else if (!svq->masked_notifier.signaled) {
+ svq->masked_notifier.signaled = true;
event_notifier_set(svq->masked_notifier.n);
}
@@ -110,6 +114,7 @@ static void vhost_shadow_vq_handle_call(EventNotifier *n)
*/
void vhost_shadow_vq_mask(VhostShadowVirtqueue *svq, EventNotifier *masked)
{
+ svq->masked_notifier.signaled = false;
qatomic_store_release(&svq->masked_notifier.n, masked);
}
--
2.27.0
- Re: [RFC v2 04/13] vhost: Add x-vhost-enable-shadow-vq qmp, (continued)
- [RFC v2 06/13] vhost: Route host->guest notification through shadow virtqueue, Eugenio Pérez, 2021/03/15
- [RFC v2 08/13] virtio: Add vhost_shadow_vq_get_vring_addr, Eugenio Pérez, 2021/03/15
- [RFC v2 07/13] vhost: Avoid re-set masked notifier in shadow vq,
Eugenio Pérez <=
- [RFC v2 09/13] virtio: Add virtio_queue_full, Eugenio Pérez, 2021/03/15
- [RFC v2 10/13] vhost: add vhost_kernel_set_vring_enable, Eugenio Pérez, 2021/03/15
[RFC v2 12/13] vhost: Check for device VRING_USED_F_NO_NOTIFY at shadow virtqueue kick, Eugenio Pérez, 2021/03/15
[RFC v2 11/13] vhost: Shadow virtqueue buffers forwarding, Eugenio Pérez, 2021/03/15