From 6329219749e63b329b10f7101db48caf64109301 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Wed, 18 Mar 2020 13:50:14 +0100 Subject: [PATCH] vm-virtio: queue: Use a SeqCst fence on get_used_event On x86_64, a hint to the compiler is not enough, we need to issue a MFENCE instruction. Replace the Acquire fence with a SeqCst one. Without this, it's still possible to miss an used_event update, leading to the omission of a notification, possibly stalling the vring. Signed-off-by: Sergio Lopez --- vm-virtio/src/queue.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm-virtio/src/queue.rs b/vm-virtio/src/queue.rs index ed28b6384..14a14a8d4 100644 --- a/vm-virtio/src/queue.rs +++ b/vm-virtio/src/queue.rs @@ -597,7 +597,7 @@ impl Queue { }; // This fence ensures we're seeing the latest update from the guest. - fence(Ordering::Acquire); + fence(Ordering::SeqCst); match mem.read_obj::(used_event_addr) { Ok(ret) => Some(Wrapping(ret)), Err(_) => None,