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
1 change: 1 addition & 0 deletions vhost-user-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
### Changed
- [[#308](https://github.com/rust-vmm/vhost/pull/308)] Replace Eventfd with EventNotifier/EventConsumer.
- [[#321](https://github.com/rust-vmm/vhost/pull/321)] Don't take ownership of listener in `VhostUserDaemon::start`.
- [[316]](https://github.com/rust-vmm/vhost/pull/316) Use mio to replace Epoll. Expose event_loop::EventSet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [[316]](https://github.com/rust-vmm/vhost/pull/316) Use mio to replace Epoll. Expose event_loop::EventSet.
- [[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 @@ -16,6 +16,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.14.0", features = ["vhost-user-backend"] }
virtio-bindings = { workspace = true }
virtio-queue = { workspace = true }
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 @@ -288,7 +289,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 @@ -390,7 +391,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 @@ -479,7 +480,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 @@ -571,7 +572,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 @@ -711,7 +712,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 @@ -798,7 +799,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