[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v4 4/4] drivers/virtio: Memory barrier before notifying host on virtqueue updates



Before notifying the virtio backend on the host we should make
sure that the virtqueue index update operation actually happened.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 plat/drivers/include/virtio/virtqueue.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plat/drivers/include/virtio/virtqueue.h 
b/plat/drivers/include/virtio/virtqueue.h
index a4181f57..f8b36348 100644
--- a/plat/drivers/include/virtio/virtqueue.h
+++ b/plat/drivers/include/virtio/virtqueue.h
@@ -233,6 +233,13 @@ static inline void virtqueue_host_notify(struct virtqueue 
*vq)
 {
        UK_ASSERT(vq);
 
+       /*
+        * Before notifying the virtio backend on the host we should make sure
+        * that the virtqueue index update operation happened. Note that this
+        * function is declared as inline.
+        */
+       mb();
+
        if (vq->vq_notify_host && virtqueue_notify_enabled(vq)) {
                uk_pr_debug("notify queue %d\n", vq->queue_id);
                vq->vq_notify_host(vq->vdev, vq->queue_id);
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.