[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v3 09/29] vhost: Avoid re-set masked notifier in shadow vq
From: |
Eugenio Pérez |
Subject: |
[RFC v3 09/29] vhost: Avoid re-set masked notifier in shadow vq |
Date: |
Wed, 19 May 2021 18:28:43 +0200 |
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 7d76e271a5..c22acb4605 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -35,6 +35,9 @@ typedef struct VhostShadowVirtqueue {
/* (Possible) masked notifier */
struct {
EventNotifier *n;
+
+ /* Avoid re-sending signals */
+ bool signaled;
} masked_notifier;
/* Virtio queue shadowing */
@@ -70,7 +73,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);
}
}
@@ -93,6 +97,7 @@ static void vhost_shadow_vq_handle_call(EventNotifier *n)
*/
void vhost_shadow_vq_mask(VhostShadowVirtqueue *svq, EventNotifier *masked)
{
+ svq->masked_notifier.signaled = false;
svq->masked_notifier.n = masked;
}
--
2.27.0
- [RFC v3 03/29] vhost: Add VhostShadowVirtqueue, (continued)
- [RFC v3 03/29] vhost: Add VhostShadowVirtqueue, Eugenio Pérez, 2021/05/19
- [RFC v3 05/29] virtio: Add VIRTIO_F_QUEUE_STATE, Eugenio Pérez, 2021/05/19
- [RFC v3 04/29] vhost: Add x-vhost-enable-shadow-vq qmp, Eugenio Pérez, 2021/05/19
- [RFC v3 06/29] virtio-net: Honor VIRTIO_CONFIG_S_DEVICE_STOPPED, Eugenio Pérez, 2021/05/19
- [RFC v3 07/29] vhost: Route guest->host notification through shadow virtqueue, Eugenio Pérez, 2021/05/19
- [RFC v3 08/29] vhost: Route host->guest notification through shadow virtqueue, Eugenio Pérez, 2021/05/19
- [RFC v3 09/29] vhost: Avoid re-set masked notifier in shadow vq,
Eugenio Pérez <=
- [RFC v3 10/29] virtio: Add vhost_shadow_vq_get_vring_addr, Eugenio Pérez, 2021/05/19
- [RFC v3 11/29] vhost: Add vhost_vring_pause operation, Eugenio Pérez, 2021/05/19
- [RFC v3 12/29] vhost: add vhost_kernel_vring_pause, Eugenio Pérez, 2021/05/19
- [RFC v3 13/29] vhost: Add vhost_get_iova_range operation, Eugenio Pérez, 2021/05/19
- [RFC v3 14/29] vhost: add vhost_has_limited_iova_range, Eugenio Pérez, 2021/05/19
- [RFC v3 15/29] vhost: Add enable_custom_iommu to VhostOps, Eugenio Pérez, 2021/05/19