mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vm-virtio: Fix update_avail_event() memory ordering
We should use full memory barrier to ensure both guest and us can see the correct avail_idx and avail_event_idx. Something like this pattern: VM: CLH: update vring.avail->idx update avail_event_idx mb() mb() read avail_event_idx read vring.avail->idx Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
This commit is contained in:
parent
79a2afe44e
commit
72b736153e
@ -607,8 +607,8 @@ impl Queue {
|
||||
None => warn!("Can't update avail_event"),
|
||||
}
|
||||
|
||||
// This fence ensures the guest sees the value we've just written.
|
||||
fence(Ordering::Release);
|
||||
// This fence ensures both guest and us see the correct value (avail idx and avail event)
|
||||
fence(Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Return the value present in the used_event field of the avail ring.
|
||||
|
Loading…
Reference in New Issue
Block a user