mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-27 05:43:43 +00:00
wl: avoid inserting empty virtio queue entries
The kernel driver currently short circuits the check for empty queue entries if the entry arrives empty. Ordinarily the check is run every time data is taken out of a queue entry and would recycle the entry once empty. The short circuiting is being fixed in the kernel, but this device change fixes the unnecessary empty queue entries from happening in the first place. BUG=chromium:791724 TEST=test code from the BUG Change-Id: I5b72aac843def052bfe1234dfbde236274ae02bb Reviewed-on: https://chromium-review.googlesource.com/974883 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
parent
63be8cb9d3
commit
5fc80ebd71
1 changed files with 5 additions and 0 deletions
|
@ -642,6 +642,11 @@ impl WlState {
|
|||
Some(vfd) => vfd.recv(&mut self.scm, &mut self.in_file_queue)?,
|
||||
None => return Ok(()),
|
||||
};
|
||||
// Short-circuit the empty recv case to avoid putting empty recv commands into the virtio
|
||||
// queue.
|
||||
if self.in_file_queue.is_empty() && buf.is_empty() {
|
||||
return Ok(())
|
||||
}
|
||||
for file in self.in_file_queue.drain(..) {
|
||||
self.vfds
|
||||
.insert(self.next_vfd_id, WlVfd::from_file(self.vm.clone(), file)?);
|
||||
|
|
Loading…
Reference in a new issue