Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vhost-user-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- [[#339]](https://github.com/rust-vmm/vhost/pull/339) Add support for `GET_SHMEM_CONFIG` message

### Changed
- [[316](https://github.com/rust-vmm/vhost/pull/316)] Use mio to replace Epoll. Expose event_loop::EventSet.

### Deprecated
### Fixed

Expand Down
1 change: 1 addition & 0 deletions vhost-user-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ postcopy = ["vhost/postcopy", "userfaultfd"]
libc = "0.2.39"
log = "0.4.17"
userfaultfd = { version = "0.9.0", optional = true }
mio = { version = "1.0.4", features = ["os-poll", "os-ext"] }
vhost = { path = "../vhost", version = "0.15.0", features = ["vhost-user-backend"] }
virtio-bindings = { workspace = true }
virtio-queue = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion vhost-user-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
pub fn new(name: String, backend: S, atomic_mem: GuestMemoryAtomic<GuestMemoryMmap<B>>) -> Result<Self>;
pub fn start(&mut self, listener: Listener) -> Result<()>;
pub fn wait(&mut self) -> Result<()>;
pub fn get_epoll_handlers(&self) -> Vec<Arc<VringEpollHandler<S, V, B>>>;
pub fn get_poll_handlers(&self) -> Vec<Arc<VringPollHandler<S, V, B>>>;
}
```

Expand Down
17 changes: 9 additions & 8 deletions vhost-user-backend/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ use vhost::vhost_user::message::{
};
use vhost::vhost_user::Backend;
use vm_memory::bitmap::Bitmap;
use vmm_sys_util::epoll::EventSet;
use vmm_sys_util::event::{EventConsumer, EventNotifier};

use vhost::vhost_user::GpuBackend;

use super::vring::VringT;
use super::GM;

use crate::EventSet;

/// Trait with interior mutability for vhost user backend servers to implement concrete services.
///
/// To support multi-threading and asynchronous IO, we enforce `Send + Sync` bound.
Expand Down Expand Up @@ -144,7 +145,7 @@ pub trait VhostUserBackend: Send + Sync {
/// do with events happening on custom listeners.
fn handle_event(
&self,
device_event: u16,
device_event: usize,
evset: EventSet,
vrings: &[Self::Vring],
thread_id: usize,
Expand Down Expand Up @@ -295,7 +296,7 @@ pub trait VhostUserBackendMut: Send + Sync {
/// do with events happening on custom listeners.
fn handle_event(
&mut self,
device_event: u16,
device_event: usize,
evset: EventSet,
vrings: &[Self::Vring],
thread_id: usize,
Expand Down Expand Up @@ -404,7 +405,7 @@ impl<T: VhostUserBackend> VhostUserBackend for Arc<T> {

fn handle_event(
&self,
device_event: u16,
device_event: usize,
evset: EventSet,
vrings: &[Self::Vring],
thread_id: usize,
Expand Down Expand Up @@ -497,7 +498,7 @@ impl<T: VhostUserBackendMut> VhostUserBackend for Mutex<T> {

fn handle_event(
&self,
device_event: u16,
device_event: usize,
evset: EventSet,
vrings: &[Self::Vring],
thread_id: usize,
Expand Down Expand Up @@ -593,7 +594,7 @@ impl<T: VhostUserBackendMut> VhostUserBackend for RwLock<T> {

fn handle_event(
&self,
device_event: u16,
device_event: usize,
evset: EventSet,
vrings: &[Self::Vring],
thread_id: usize,
Expand Down Expand Up @@ -741,7 +742,7 @@ pub mod tests {

fn handle_event(
&mut self,
_device_event: u16,
_device_event: usize,
_evset: EventSet,
_vrings: &[VringRwLock],
_thread_id: usize,
Expand Down Expand Up @@ -828,7 +829,7 @@ pub mod tests {

let vring = VringRwLock::new(mem, 0x1000).unwrap();
backend
.handle_event(0x1, EventSet::IN, &[vring], 0)
.handle_event(0x1, EventSet::Readable, &[vring], 0)
.unwrap();

backend.reset_device();
Expand Down
Loading