From 8509e2229c3e954383e031c7e519bf8e769043e6 Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Wed, 9 Jun 2021 22:50:55 +0900 Subject: [PATCH] vhost_user_devices: Remove O_NONBLOCK from given kick FD Remove O_NONBLOCK from kick FD as uring_executor assumes so. Otherwise, we may get EAGAIN when we read a value. This patch is needed to use QEMU as a vmm. BUG=b:190450677 TEST=run QEMU and vhost-user-net-devices with uring_executor Change-Id: I8dc533c824909eb0298e4264f45d7a62998ebc6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2950028 Tested-by: kokoro Commit-Queue: Keiichi Watanabe Reviewed-by: Chirantan Ekbote --- Cargo.lock | 1 + vhost_user_devices/Cargo.toml | 1 + vhost_user_devices/src/lib.rs | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b2b8be9301..69027f0399 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1171,6 +1171,7 @@ dependencies = [ "once_cell", "remain", "sync", + "sys_util", "tempfile", "thiserror", "virtio_sys", diff --git a/vhost_user_devices/Cargo.toml b/vhost_user_devices/Cargo.toml index 71d5596c22..0aae93cec5 100644 --- a/vhost_user_devices/Cargo.toml +++ b/vhost_user_devices/Cargo.toml @@ -32,6 +32,7 @@ net_util = { path = "../net_util", optional = true } once_cell = "1.7.2" remain = "*" sync = { path = "../sync" } +sys_util = { path = "../sys_util" } thiserror = "*" virtio_sys = { path = "../virtio_sys", optional = true } vm_memory = { path = "../vm_memory" } diff --git a/vhost_user_devices/src/lib.rs b/vhost_user_devices/src/lib.rs index 40985a8587..13a4a8714b 100644 --- a/vhost_user_devices/src/lib.rs +++ b/vhost_user_devices/src/lib.rs @@ -56,6 +56,7 @@ use cros_async::{AsyncError, AsyncWrapper, Executor}; use devices::virtio::{Queue, SignalableInterrupt}; use remain::sorted; use sync::Mutex; +use sys_util::clear_fd_flags; use thiserror::Error as ThisError; use vm_memory::{GuestAddress, GuestMemory, MemoryRegion}; use vmm_vhost::vhost_user::message::{ @@ -475,6 +476,14 @@ impl VhostUserSlaveReqHandlerMut for DeviceRequestHandler