From 2532c07b3947720aa3528305ae023e3944175c38 Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Sun, 17 Apr 2022 11:05:48 +0900 Subject: [PATCH] vmm_vhost: fix the VFIO implementation of set_nonblocking() The set_nonblocking() implementation of the VFIO Listener was marked as unimplemented and caused a crash. However, given that accept() on a VFIO listener never blocks, it is just as safe to mark the operation as successful, since the behavior of accept() won't be impacted and it will behave properly both in blocking and non-blocking modes. Removing this panic will allow us to safely use the Listener's interface set_nonblocking() method in generic code. BUG=b:229554679 TEST=vhost-user console device works. TEST=vvu console device works. Change-Id: Ibbde7bcd048505fc3a84eb4881a74285bae6bf54 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591111 Reviewed-by: Keiichi Watanabe Tested-by: kokoro Commit-Queue: Alexandre Courbot --- third_party/vmm_vhost/src/connection/vfio.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/vmm_vhost/src/connection/vfio.rs b/third_party/vmm_vhost/src/connection/vfio.rs index 48eaea1bc4..bc2b5d6c20 100644 --- a/third_party/vmm_vhost/src/connection/vfio.rs +++ b/third_party/vmm_vhost/src/connection/vfio.rs @@ -88,7 +88,8 @@ impl ListenerTrait for Listener { } fn set_nonblocking(&self, _block: bool) -> Result<()> { - unimplemented!("set_nonblocking"); + // `accept` will never block on a VFIO connection. + Ok(()) } }