vm-virtio: queue: hint that get_used_event should be inlined

get_used_event is used from vhost_user_backend:needs_notification to
check whether an interrupt must be sent to the guest to notify there
are new items in the queue. Shorten the update window by asking the
the compiler to inline this method, so a write won't slip between the
read of the memory contents and the actual check.

Signed-off-by: Sergio Lopez <slp@redhat.com>
This commit is contained in:
Sergio Lopez 2020-03-10 05:37:23 -04:00 committed by Rob Bradford
parent 401e1d2489
commit 536323d9fb

View File

@ -548,6 +548,7 @@ impl Queue {
}
/// Return the value present in the used_event field of the avail ring.
#[inline(always)]
pub fn get_used_event(&self, mem: &GuestMemoryMmap) -> Option<Wrapping<u16>> {
let avail_ring = self.avail_ring;
let used_event_addr =