From 2594731840dc3125e5b6bb191b493c209ff9cf10 Mon Sep 17 00:00:00 2001 From: Richard Otap Date: Thu, 10 Nov 2022 09:42:34 -0800 Subject: [PATCH] devices: virtio: vsock: Use async event without reset When receiving guest data, we wait on an event after writing them out to the named pipe so that we know that the write has completed. This resets the event. Then we call `GetOverlappedResult` with `bWait` set. While this does behave correctly because `GetOverlappedResult` checks the internal status of the request before waiting, there's no need to have the event get reset here. BUG: b:255635953 TEST: Built and ran crosvm downstream. Change-Id: Ic031821dda1e7ae696dfafa812afa4c0b6cff0ec Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4062049 Reviewed-by: Noah Gold Commit-Queue: Richard Otap --- devices/src/virtio/vsock/vsock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devices/src/virtio/vsock/vsock.rs b/devices/src/virtio/vsock/vsock.rs index 370b50e38c..f512dd1c06 100644 --- a/devices/src/virtio/vsock/vsock.rs +++ b/devices/src/virtio/vsock/vsock.rs @@ -745,7 +745,7 @@ impl Worker { // always be negligible, but will sometimes be non-zero in cases where // traffic is high on the NamedPipe, especially a duplex pipe. if let Ok(cloned_event) = write_completed_event.try_clone() { - if let Ok(async_event) = EventAsync::new(cloned_event, ex) { + if let Ok(async_event) = EventAsync::new_without_reset(cloned_event, ex) { let _ = async_event.next_val().await; } else { error!(