mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 12:09:31 +00:00
devices: virtio: improve the comment on a memory fence in Queue::peek
Improve the comment on why a fence is necessary in the middle of `Queue::peek` so that it gets clearer. BUG=b:258630435 TEST=`./tools/dev_container ./tools/presubmit` passed Change-Id: I63f80975e6d04665948a6036998e7ed6e24be64c Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4045661 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
parent
59530f1e1a
commit
984a2f7c8b
1 changed files with 3 additions and 1 deletions
|
@ -628,7 +628,9 @@ impl Queue {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// so that following read from the descriptor doesn't pass get_avail_index
|
// This fence ensures that subsequent reads from the descriptor do not
|
||||||
|
// get reordered and happen only after fetching the available_index and
|
||||||
|
// checking that there is a slot available.
|
||||||
fence(Ordering::SeqCst);
|
fence(Ordering::SeqCst);
|
||||||
|
|
||||||
let desc_idx_addr_offset = 4 + (u64::from(self.next_avail.0 % queue_size) * 2);
|
let desc_idx_addr_offset = 4 + (u64::from(self.next_avail.0 % queue_size) * 2);
|
||||||
|
|
Loading…
Reference in a new issue