mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-26 06:32:44 +00:00
build(deps): bump the rust-vmm group across 2 directories with 6 updates
Bumps the rust-vmm group with 6 updates in the / directory: | Package | From | To | | --- | --- | --- | | [vhost](https://github.com/rust-vmm/vhost) | `0.14.0` | `0.15.0` | | [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.20.0` | `0.21.0` | | [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.16.0` | `0.17.0` | | [vm-memory](https://github.com/rust-vmm/vm-memory) | `0.16.2` | `0.17.1` | | [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) | `0.14.0` | `0.15.0` | | [virtio-vsock](https://github.com/rust-vmm/vm-virtio) | `0.10.0` | `0.11.0` | Bumps the rust-vmm group with 5 updates in the /staging directory: | Package | From | To | | --- | --- | --- | | [vhost](https://github.com/rust-vmm/vhost) | `0.14.0` | `0.15.0` | | [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.20.0` | `0.21.0` | | [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.16.0` | `0.17.0` | | [vm-memory](https://github.com/rust-vmm/vm-memory) | `0.16.2` | `0.17.1` | | [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) | `0.14.0` | `0.15.0` | Updates `vhost` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0) Updates `vhost-user-backend` from 0.20.0 to 0.21.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0) Updates `virtio-queue` from 0.16.0 to 0.17.0 - [Release notes](https://github.com/rust-vmm/vm-virtio/releases) - [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0) Updates `vm-memory` from 0.16.2 to 0.17.1 - [Release notes](https://github.com/rust-vmm/vm-memory/releases) - [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1) Updates `vmm-sys-util` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases) - [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0) Updates `virtio-vsock` from 0.10.0 to 0.11.0 - [Release notes](https://github.com/rust-vmm/vm-virtio/releases) - [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-vsock-v0.10.0...virtio-vsock-v0.11.0) Updates `vhost` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0) Updates `vhost-user-backend` from 0.20.0 to 0.21.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0) Updates `virtio-queue` from 0.16.0 to 0.17.0 - [Release notes](https://github.com/rust-vmm/vm-virtio/releases) - [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0) Updates `vm-memory` from 0.16.2 to 0.17.1 - [Release notes](https://github.com/rust-vmm/vm-memory/releases) - [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1) Updates `vmm-sys-util` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases) - [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0) Updates `vhost` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0) Updates `vhost-user-backend` from 0.20.0 to 0.21.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0) Updates `virtio-queue` from 0.16.0 to 0.17.0 - [Release notes](https://github.com/rust-vmm/vm-virtio/releases) - [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0) Updates `vm-memory` from 0.16.2 to 0.17.1 - [Release notes](https://github.com/rust-vmm/vm-memory/releases) - [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1) Updates `vmm-sys-util` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases) - [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0) Updates `vhost` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0) Updates `vhost-user-backend` from 0.20.0 to 0.21.0 - [Release notes](https://github.com/rust-vmm/vhost/releases) - [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0) Updates `virtio-queue` from 0.16.0 to 0.17.0 - [Release notes](https://github.com/rust-vmm/vm-virtio/releases) - [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0) Updates `vm-memory` from 0.16.2 to 0.17.1 - [Release notes](https://github.com/rust-vmm/vm-memory/releases) - [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1) Updates `vmm-sys-util` from 0.14.0 to 0.15.0 - [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases) - [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: vhost dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost-user-backend dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: virtio-queue dependency-version: 0.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vm-memory dependency-version: 0.17.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vmm-sys-util dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: virtio-vsock dependency-version: 0.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost-user-backend dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: virtio-queue dependency-version: 0.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vm-memory dependency-version: 0.17.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vmm-sys-util dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost-user-backend dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: virtio-queue dependency-version: 0.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vm-memory dependency-version: 0.17.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vmm-sys-util dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vhost-user-backend dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: virtio-queue dependency-version: 0.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vm-memory dependency-version: 0.17.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm - dependency-name: vmm-sys-util dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: rust-vmm ... Signed-off-by: dependabot[bot] <support@github.com> SG: adapted code to the new changes in vhost-user-backend and vm-memory: - used EventConsumer & EventNotifier instead of EventFd for exit_event - removed vm_memory::Error::InvalidGuestRegion - included vm_memory::Bytes needed for read_volatile_from Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
parent
5e83c07f87
commit
9040bcb726
27
Cargo.lock
generated
27
Cargo.lock
generated
@ -1994,9 +1994,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "vhost"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a4dcad85a129d97d5d4b2f3c47a4affdeedd76bdcd02094bcb5d9b76cac2d05"
|
||||
checksum = "c76d90ce3c6b37d610a5304c9a445cfff580cf8b4b9fd02fb256aaf68552c28a"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"libc 0.2.177",
|
||||
@ -2276,9 +2276,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-backend"
|
||||
version = "0.20.0"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e183205a9ba7cb9c47fcb0fc0a07fc295a110efbb11ab78ad0d793b0a38a7bde"
|
||||
checksum = "783587813a59c42c36519a6e12bb31eb2d7fa517377428252ba4cc2312584243"
|
||||
dependencies = [
|
||||
"libc 0.2.177",
|
||||
"log",
|
||||
@ -2319,10 +2319,11 @@ checksum = "804f498a26d5a63be7bbb8bdcd3869c3f286c4c4a17108905276454da0caf8cb"
|
||||
|
||||
[[package]]
|
||||
name = "virtio-queue"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb0479158f863e59323771a1f684d843962f76960b86fecfec2bfa9c8f0f9180"
|
||||
checksum = "e358084f32ed165fddb41d98ff1b7ff3c08b9611d8d6114a1b422e2e85688baf"
|
||||
dependencies = [
|
||||
"libc 0.2.177",
|
||||
"log",
|
||||
"virtio-bindings",
|
||||
"vm-memory",
|
||||
@ -2331,9 +2332,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "virtio-vsock"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e49ff39d455ce92f01a910cb11b01e54b61c6f3b5d308a144c86044b39955b79"
|
||||
checksum = "8e7822f0d005c2451d4cdbb42cc9581cabb42a0fb64347efe5492fa548e8931a"
|
||||
dependencies = [
|
||||
"virtio-bindings",
|
||||
"virtio-queue",
|
||||
@ -2342,23 +2343,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vm-memory"
|
||||
version = "0.16.2"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd5e56d48353c5f54ef50bd158a0452fc82f5383da840f7b8efc31695dd3b9d"
|
||||
checksum = "f39348a049689cabd3377cdd9182bf526ec76a6f823b79903896452e9d7a7380"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"bitflags 2.10.0",
|
||||
"libc 0.2.177",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.17",
|
||||
"vmm-sys-util",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vmm-sys-util"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d21f366bf22bfba3e868349978766a965cbe628c323d58e026be80b8357ab789"
|
||||
checksum = "506c62fdf617a5176827c2f9afbcf1be155b03a9b4bf9617a60dbc07e3a1642f"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"libc 0.2.177",
|
||||
|
||||
23
staging/Cargo.lock
generated
23
staging/Cargo.lock
generated
@ -805,9 +805,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vhost"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a4dcad85a129d97d5d4b2f3c47a4affdeedd76bdcd02094bcb5d9b76cac2d05"
|
||||
checksum = "c76d90ce3c6b37d610a5304c9a445cfff580cf8b4b9fd02fb256aaf68552c28a"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"libc",
|
||||
@ -843,9 +843,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vhost-user-backend"
|
||||
version = "0.20.0"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e183205a9ba7cb9c47fcb0fc0a07fc295a110efbb11ab78ad0d793b0a38a7bde"
|
||||
checksum = "783587813a59c42c36519a6e12bb31eb2d7fa517377428252ba4cc2312584243"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
@ -864,10 +864,11 @@ checksum = "804f498a26d5a63be7bbb8bdcd3869c3f286c4c4a17108905276454da0caf8cb"
|
||||
|
||||
[[package]]
|
||||
name = "virtio-queue"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb0479158f863e59323771a1f684d843962f76960b86fecfec2bfa9c8f0f9180"
|
||||
checksum = "e358084f32ed165fddb41d98ff1b7ff3c08b9611d8d6114a1b422e2e85688baf"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"virtio-bindings",
|
||||
"vm-memory",
|
||||
@ -876,23 +877,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vm-memory"
|
||||
version = "0.16.2"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd5e56d48353c5f54ef50bd158a0452fc82f5383da840f7b8efc31695dd3b9d"
|
||||
checksum = "f39348a049689cabd3377cdd9182bf526ec76a6f823b79903896452e9d7a7380"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"bitflags 2.10.0",
|
||||
"libc",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.17",
|
||||
"vmm-sys-util",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vmm-sys-util"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d21f366bf22bfba3e868349978766a965cbe628c323d58e026be80b8357ab789"
|
||||
checksum = "506c62fdf617a5176827c2f9afbcf1be155b03a9b4bf9617a60dbc07e3a1642f"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"libc",
|
||||
|
||||
@ -26,17 +26,17 @@ log = "0.4"
|
||||
libc = "0.2.177"
|
||||
thiserror = "2.0"
|
||||
futures-executor = { version = "0.3", features = ["thread-pool"] }
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.0"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
v4l2r = { git = "https://github.com/Gnurou/v4l2r", rev = "110fd77", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
rstest = "0.26.1"
|
||||
tempfile = "3.23.0"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.0", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
@ -20,7 +20,7 @@ use virtio_queue::DescriptorChain;
|
||||
use vm_memory::{ByteValued, GuestMemoryAtomic, GuestMemoryLoadGuard, GuestMemoryMmap, Le32};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{vhu_video_thread::VhostUserVideoThread, video_backends};
|
||||
@ -127,7 +127,8 @@ unsafe impl ByteValued for VirtioVideoConfig {}
|
||||
pub(crate) struct VuVideoBackend {
|
||||
config: VirtioVideoConfig,
|
||||
pub threads: Vec<Mutex<VhostUserVideoThread>>,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
}
|
||||
|
||||
impl VuVideoBackend {
|
||||
@ -137,6 +138,8 @@ impl VuVideoBackend {
|
||||
video_backend,
|
||||
video_path,
|
||||
)?));
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| VuVideoError::EventFdError)?;
|
||||
Ok(Self {
|
||||
config: VirtioVideoConfig {
|
||||
version: 0.into(),
|
||||
@ -145,7 +148,8 @@ impl VuVideoBackend {
|
||||
device_name: [0; 32],
|
||||
},
|
||||
threads: vec![Mutex::new(VhostUserVideoThread::new(backend.clone())?)],
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| VuVideoError::EventFdError)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -259,8 +263,10 @@ impl VhostUserBackendMut for VuVideoBackend {
|
||||
buf[offset..offset + size].to_vec()
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,7 +350,8 @@ pub mod tests {
|
||||
|
||||
let exit = backend.exit_event(0);
|
||||
assert!(exit.is_some());
|
||||
exit.unwrap().write(1).unwrap();
|
||||
let (_, notifier) = exit.unwrap();
|
||||
notifier.notify().unwrap();
|
||||
for queue in COMMAND_Q..VIDEO_EVENT {
|
||||
// Skip exit event
|
||||
if queue == NUM_QUEUES as u16 {
|
||||
|
||||
@ -21,14 +21,14 @@ log = "0.4"
|
||||
thiserror = "2.0"
|
||||
queues = "1.0.2"
|
||||
socketcan = "3.5.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
@ -27,7 +27,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -103,7 +103,8 @@ pub(crate) struct VhostUserCanBackend {
|
||||
controller: Arc<RwLock<CanController>>,
|
||||
acked_features: u64,
|
||||
event_idx: bool,
|
||||
pub(crate) exit_event: EventFd,
|
||||
exit_consumer: EventConsumer,
|
||||
exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -111,11 +112,15 @@ type CanDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<(
|
||||
|
||||
impl VhostUserCanBackend {
|
||||
pub(crate) fn new(controller: Arc<RwLock<CanController>>) -> Result<Self> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
|
||||
Ok(VhostUserCanBackend {
|
||||
controller,
|
||||
event_idx: false,
|
||||
acked_features: 0x0,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -719,8 +724,10 @@ impl VhostUserBackendMut for VhostUserCanBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,17 +23,17 @@ env_logger = "0.11"
|
||||
epoll = "4.4"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -29,6 +29,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
};
|
||||
|
||||
@ -140,7 +141,8 @@ pub struct VhostUserConsoleBackend {
|
||||
pub stream: Option<Box<dyn ReadWrite + Send + Sync>>,
|
||||
pub rx_event: EventFd,
|
||||
pub rx_ctrl_event: EventFd,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -151,6 +153,8 @@ impl VhostUserConsoleBackend {
|
||||
pub const NUM_QUEUES: u16 = 4;
|
||||
|
||||
pub fn new(max_queue_size: usize, controller: Arc<RwLock<ConsoleController>>) -> Result<Self> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
Ok(Self {
|
||||
max_queue_size,
|
||||
controller,
|
||||
@ -168,7 +172,8 @@ impl VhostUserConsoleBackend {
|
||||
listener: None,
|
||||
rx_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
rx_ctrl_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -515,7 +520,7 @@ impl VhostUserConsoleBackend {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let exit_event_fd = self.exit_event.as_raw_fd();
|
||||
let exit_event_fd = self.exit_consumer.as_raw_fd();
|
||||
vring_worker
|
||||
.register_listener(
|
||||
exit_event_fd,
|
||||
@ -850,8 +855,10 @@ impl VhostUserBackendMut for VhostUserConsoleBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,17 +21,17 @@ env_logger = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[target.'cfg(target_env = "gnu")'.dependencies]
|
||||
libgpiod = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
@ -29,7 +29,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -160,7 +160,8 @@ pub(crate) struct VhostUserGpioBackend<D: GpioDevice> {
|
||||
controller: Arc<GpioController<D>>,
|
||||
handles: Arc<RwLock<Vec<Option<JoinHandle<()>>>>>,
|
||||
event_idx: bool,
|
||||
pub(crate) exit_event: EventFd,
|
||||
pub(crate) exit_consumer: EventConsumer,
|
||||
pub(crate) exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -172,11 +173,14 @@ impl<D: GpioDevice> VhostUserGpioBackend<D> {
|
||||
let mut handles: Vec<Option<JoinHandle<()>>> = Vec::new();
|
||||
handles.resize_with(controller.num_gpios() as usize, || None);
|
||||
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
Ok(VhostUserGpioBackend {
|
||||
controller: Arc::new(controller),
|
||||
handles: Arc::new(RwLock::new(handles)),
|
||||
event_idx: false,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -499,8 +503,10 @@ impl<D: 'static + GpioDevice + Sync + Send> VhostUserBackendMut for VhostUserGpi
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,12 +29,12 @@ log = "0.4"
|
||||
rutabaga_gfx = "0.1.75"
|
||||
thiserror = "2.0.17"
|
||||
virglrenderer = {version = "0.1.2", optional = true }
|
||||
vhost = { version = "0.14.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15.0", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16.0"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14.0"
|
||||
virtio-queue = "0.17.0"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15.0"
|
||||
bitflags = "2.10.0"
|
||||
|
||||
[dev-dependencies]
|
||||
@ -42,5 +42,5 @@ assert_matches = "1.5"
|
||||
mockall = "0.13.0"
|
||||
rusty-fork = "0.3.1"
|
||||
tempfile = "3.23"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
@ -69,7 +69,8 @@ use virtio_queue::{QueueOwnedT, Reader, Writer};
|
||||
use vm_memory::{ByteValued, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryMmap, Le32};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
eventfd::EventFd,
|
||||
};
|
||||
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
@ -140,7 +141,8 @@ struct VhostUserGpuBackendInner {
|
||||
virtio_cfg: VirtioGpuConfig,
|
||||
event_idx_enabled: bool,
|
||||
gpu_backend: Option<GpuBackend>,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
gpu_config: GpuConfig,
|
||||
}
|
||||
@ -160,6 +162,9 @@ impl VhostUserGpuBackend {
|
||||
gpu_config.capsets(),
|
||||
gpu_config.flags()
|
||||
);
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
|
||||
let inner = VhostUserGpuBackendInner {
|
||||
virtio_cfg: VirtioGpuConfig {
|
||||
events_read: 0.into(),
|
||||
@ -169,7 +174,8 @@ impl VhostUserGpuBackend {
|
||||
},
|
||||
event_idx_enabled: false,
|
||||
gpu_backend: None,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
gpu_config,
|
||||
};
|
||||
@ -712,8 +718,11 @@ impl VhostUserBackend for VhostUserGpuBackend {
|
||||
self.inner.lock().unwrap().get_config(offset, size)
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.inner.lock().unwrap().exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let inner = self.inner.lock().unwrap();
|
||||
let consumer = inner.exit_consumer.try_clone().ok()?;
|
||||
let notifier = inner.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
|
||||
fn handle_event(
|
||||
|
||||
@ -20,17 +20,17 @@ env_logger = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -27,7 +27,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::i2c::*;
|
||||
@ -105,7 +105,8 @@ unsafe impl ByteValued for VirtioI2cInHdr {}
|
||||
pub(crate) struct VhostUserI2cBackend<D: I2cDevice> {
|
||||
i2c_map: Arc<I2cMap<D>>,
|
||||
event_idx: bool,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryLoadGuard<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -113,10 +114,13 @@ type I2cDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<(
|
||||
|
||||
impl<D: I2cDevice> VhostUserI2cBackend<D> {
|
||||
pub fn new(i2c_map: Arc<I2cMap<D>>) -> Result<Self> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
Ok(VhostUserI2cBackend {
|
||||
i2c_map,
|
||||
event_idx: false,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -355,8 +359,10 @@ impl<D: 'static + I2cDevice + Sync + Send> VhostUserBackendMut for VhostUserI2cB
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,19 +22,19 @@ log = "0.4"
|
||||
rand = "0.9.2"
|
||||
tempfile = "3.23"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
evdev = "0.13"
|
||||
nix = { version = "0.30", features = ["ioctl"] }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -23,7 +23,7 @@ use virtio_queue::QueueT;
|
||||
use vm_memory::{ByteValued, Bytes, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryMmap};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::input::*;
|
||||
@ -124,7 +124,8 @@ impl From<VuInputError> for io::Error {
|
||||
pub(crate) struct VuInputBackend<T: InputDevice> {
|
||||
event_idx: bool,
|
||||
ev_dev: T,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
select: u8,
|
||||
subsel: u8,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
@ -133,10 +134,13 @@ pub(crate) struct VuInputBackend<T: InputDevice> {
|
||||
|
||||
impl<T: InputDevice> VuInputBackend<T> {
|
||||
pub fn new(ev_dev: T) -> std::result::Result<Self, std::io::Error> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| VuInputError::EventFdError)?;
|
||||
Ok(VuInputBackend {
|
||||
event_idx: false,
|
||||
ev_dev,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| VuInputError::EventFdError)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
select: 0,
|
||||
subsel: 0,
|
||||
mem: None,
|
||||
@ -425,8 +429,10 @@ impl<T: 'static + InputDevice + Sync + Send> VhostUserBackendMut for VuInputBack
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,17 +21,17 @@ log = "0.4"
|
||||
rand = "0.9.2"
|
||||
tempfile = "3.23"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -22,12 +22,12 @@ use virtio_bindings::bindings::{
|
||||
};
|
||||
use virtio_queue::{DescriptorChain, QueueOwnedT};
|
||||
use vm_memory::{
|
||||
GuestAddressSpace, GuestMemory, GuestMemoryAtomic, GuestMemoryLoadGuard, GuestMemoryMmap,
|
||||
Bytes, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryLoadGuard, GuestMemoryMmap,
|
||||
ReadVolatile,
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
const QUEUE_SIZE: usize = 1024;
|
||||
@ -90,7 +90,8 @@ pub(crate) struct VuRngBackend<T: ReadVolatile> {
|
||||
event_idx: bool,
|
||||
timer: VuRngTimerConfig,
|
||||
rng_source: Arc<Mutex<T>>,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -101,11 +102,14 @@ impl<T: ReadVolatile> VuRngBackend<T> {
|
||||
period_ms: u128,
|
||||
max_bytes: usize,
|
||||
) -> std::result::Result<Self, std::io::Error> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| VuRngError::EventFdError)?;
|
||||
Ok(VuRngBackend {
|
||||
event_idx: false,
|
||||
rng_source,
|
||||
timer: VuRngTimerConfig::new(period_ms, max_bytes),
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| VuRngError::EventFdError)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -284,8 +288,10 @@ impl<T: 'static + ReadVolatile + Sync + Send> VhostUserBackendMut for VuRngBacke
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,16 +15,16 @@ env_logger = "0.11"
|
||||
itertools = "0.14"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -26,7 +26,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -96,7 +96,8 @@ type ScmiDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<
|
||||
|
||||
pub struct VuScmiBackend {
|
||||
event_idx: bool,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
/// Event vring and descriptors serve for asynchronous responses and
|
||||
/// notifications. They are obtained from the driver and we store them
|
||||
@ -138,9 +139,12 @@ impl VuScmiBackend {
|
||||
None => return Result::Err(VuScmiError::UnknownDeviceRequested(name.clone())),
|
||||
};
|
||||
}
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| VuScmiError::EventFdFailed)?;
|
||||
Ok(Self {
|
||||
event_idx: false,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| VuScmiError::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
event_vring: None,
|
||||
event_descriptors: vec![],
|
||||
@ -539,9 +543,11 @@ impl VhostUserBackendMut for VuScmiBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
debug!("Exit event called");
|
||||
self.exit_event.try_clone().ok()
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,17 +20,17 @@ env_logger = "0.11"
|
||||
epoll = "4.4"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
tempfile = "3.23.0"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -19,7 +19,7 @@ use virtio_queue::QueueOwnedT;
|
||||
use vm_memory::{GuestAddressSpace, GuestMemoryAtomic, GuestMemoryLoadGuard, GuestMemoryMmap};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -39,7 +39,8 @@ pub struct VhostUserScsiBackend {
|
||||
event_idx: bool,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
targets: Vec<Box<dyn Target>>,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
}
|
||||
|
||||
impl Default for VhostUserScsiBackend {
|
||||
@ -50,11 +51,15 @@ impl Default for VhostUserScsiBackend {
|
||||
|
||||
impl VhostUserScsiBackend {
|
||||
pub fn new() -> Self {
|
||||
let (exit_consumer, exit_notifier) =
|
||||
new_event_consumer_and_notifier(EventFlag::NONBLOCK).expect("Creating exit event");
|
||||
|
||||
Self {
|
||||
event_idx: false,
|
||||
mem: None,
|
||||
targets: Vec::new(),
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).expect("Creating exit eventfd"),
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,8 +327,10 @@ impl VhostUserBackendMut for VhostUserScsiBackend {
|
||||
panic!("Access to configuration space is not supported.");
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
Some(self.exit_event.try_clone().expect("Cloning exit eventfd"))
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@ where
|
||||
.addr()
|
||||
.0
|
||||
.checked_add(u64::from(self.offset))
|
||||
.ok_or(io::Error::other(vm_memory::Error::InvalidGuestRegion))?,
|
||||
.ok_or(io::Error::other("Guest address overflow"))?,
|
||||
),
|
||||
)
|
||||
.map_err(io::Error::other)?;
|
||||
|
||||
@ -22,12 +22,12 @@ clap = { version = "4.5", features = ["derive"] }
|
||||
env_logger = "0.11"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
# Make alsa and pipewire backends available only on gnu
|
||||
[target.'cfg(target_env = "gnu")'.dependencies]
|
||||
@ -40,8 +40,8 @@ gst-audio = {package = "gstreamer-audio", version = "0.24.2", optional = true, f
|
||||
[dev-dependencies]
|
||||
rstest = "0.26.1"
|
||||
tempfile = "3.23"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[target.'cfg(target_env = "gnu")'.dev-dependencies]
|
||||
rand = { version = "0.9.2" }
|
||||
|
||||
@ -22,7 +22,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -486,7 +486,8 @@ impl VhostUserSoundThread {
|
||||
pub struct VhostUserSoundBackend {
|
||||
pub threads: Vec<RwLock<VhostUserSoundThread>>,
|
||||
virtio_cfg: VirtioSoundConfig,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
audio_backend: RwLock<Box<dyn AudioBackend + Send + Sync>>,
|
||||
}
|
||||
|
||||
@ -567,6 +568,9 @@ impl VhostUserSoundBackend {
|
||||
|
||||
let audio_backend = alloc_audio_backend(config.audio_backend, streams)?;
|
||||
|
||||
let (exit_consumer, exit_notifier) =
|
||||
new_event_consumer_and_notifier(EventFlag::NONBLOCK).map_err(Error::EventFdCreate)?;
|
||||
|
||||
Ok(Self {
|
||||
threads,
|
||||
virtio_cfg: VirtioSoundConfig {
|
||||
@ -575,13 +579,14 @@ impl VhostUserSoundBackend {
|
||||
chmaps: 1.into(),
|
||||
controls: 0.into(),
|
||||
},
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(Error::EventFdCreate)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
audio_backend: RwLock::new(audio_backend),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_exit_event(&self) {
|
||||
self.exit_event.write(1).unwrap();
|
||||
self.exit_notifier.notify().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,8 +673,10 @@ impl VhostUserBackend for VhostUserSoundBackend {
|
||||
vec
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
@ -982,7 +989,8 @@ mod tests {
|
||||
|
||||
let exit = backend.exit_event(0);
|
||||
assert!(exit.is_some());
|
||||
exit.unwrap().write(1).unwrap();
|
||||
let (_, notifier) = exit.unwrap();
|
||||
notifier.notify().unwrap();
|
||||
|
||||
backend
|
||||
.handle_event(CONTROL_QUEUE_IDX, EventSet::IN, &vrings, 0)
|
||||
|
||||
@ -21,18 +21,18 @@ env_logger = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
bitflags = "2.10.0"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -27,7 +27,7 @@ use vm_memory::{
|
||||
};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::spi::*;
|
||||
@ -137,7 +137,8 @@ unsafe impl ByteValued for VirtioSpiConfig {}
|
||||
pub(crate) struct VhostUserSpiBackend<D: SpiDevice> {
|
||||
spi_ctrl: Arc<SpiController<D>>,
|
||||
event_idx: bool,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -145,10 +146,13 @@ type SpiDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<(
|
||||
|
||||
impl<D: SpiDevice> VhostUserSpiBackend<D> {
|
||||
pub fn new(spi_ctrl: Arc<SpiController<D>>) -> Result<Self> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
Ok(VhostUserSpiBackend {
|
||||
spi_ctrl,
|
||||
event_idx: false,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -482,8 +486,10 @@ impl<D: 'static + SpiDevice + Sync + Send> VhostUserBackendMut for VhostUserSpiB
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,17 +20,17 @@ env_logger = "0.11"
|
||||
libc = "0.2"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
vm-memory = { version = "0.17.1", features = ["backend-mmap", "backend-atomic"] }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -19,7 +19,7 @@ use virtio_queue::{DescriptorChain, QueueOwnedT};
|
||||
use vm_memory::{GuestAddressSpace, GuestMemoryAtomic, GuestMemoryLoadGuard, GuestMemoryMmap};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
};
|
||||
|
||||
use crate::FooInfo;
|
||||
@ -53,7 +53,8 @@ impl From<Error> for std::io::Error {
|
||||
pub struct VhostUserFooBackend {
|
||||
info: FooInfo,
|
||||
event_idx: bool,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
mem: Option<GuestMemoryLoadGuard<GuestMemoryMmap>>,
|
||||
}
|
||||
|
||||
@ -61,10 +62,14 @@ type FooDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<(
|
||||
|
||||
impl VhostUserFooBackend {
|
||||
pub fn new(info: FooInfo) -> Result<Self> {
|
||||
let (exit_consumer, exit_notifier) = new_event_consumer_and_notifier(EventFlag::NONBLOCK)
|
||||
.map_err(|_| Error::EventFdFailed)?;
|
||||
|
||||
Ok(VhostUserFooBackend {
|
||||
info,
|
||||
event_idx: false,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(|_| Error::EventFdFailed)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
mem: None,
|
||||
})
|
||||
}
|
||||
@ -214,8 +219,10 @@ impl VhostUserBackendMut for VhostUserFooBackend {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,13 +21,13 @@ env_logger = "0.11"
|
||||
epoll = "4.4.0"
|
||||
log = "0.4"
|
||||
thiserror = "2.0"
|
||||
vhost = { version = "0.14", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.20"
|
||||
vhost = { version = "0.15", features = ["vhost-user-backend"] }
|
||||
vhost-user-backend = "0.21"
|
||||
virtio-bindings = "0.2.5"
|
||||
virtio-queue = "0.16"
|
||||
virtio-vsock = "0.10"
|
||||
vm-memory = "0.16.1"
|
||||
vmm-sys-util = "0.14"
|
||||
virtio-queue = "0.17"
|
||||
virtio-vsock = "0.11"
|
||||
vm-memory = "0.17.1"
|
||||
vmm-sys-util = "0.15"
|
||||
figment = { version = "0.10.19", features = ["yaml"] }
|
||||
vsock = { version = "0.5.0", optional = true }
|
||||
libc = { version = "0.2.177", optional = true }
|
||||
@ -35,7 +35,7 @@ serde = { version = "1", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5"
|
||||
virtio-queue = { version = "0.16", features = ["test-utils"] }
|
||||
virtio-queue = { version = "0.17", features = ["test-utils"] }
|
||||
tempfile = "3.23.0"
|
||||
|
||||
[lints]
|
||||
|
||||
@ -18,7 +18,8 @@ use virtio_bindings::bindings::{
|
||||
use vm_memory::{ByteValued, GuestMemoryAtomic, GuestMemoryMmap, Le64};
|
||||
use vmm_sys_util::{
|
||||
epoll::EventSet,
|
||||
eventfd::{EventFd, EFD_NONBLOCK},
|
||||
event::{new_event_consumer_and_notifier, EventConsumer, EventFlag, EventNotifier},
|
||||
eventfd::EventFd,
|
||||
};
|
||||
|
||||
use crate::{thread_backend::RawPktsQ, vhu_vsock_thread::*};
|
||||
@ -258,7 +259,8 @@ pub(crate) struct VhostUserVsockBackend {
|
||||
queue_size: usize,
|
||||
pub threads: Vec<Mutex<VhostUserVsockThread>>,
|
||||
queues_per_thread: Vec<u64>,
|
||||
pub exit_event: EventFd,
|
||||
pub exit_consumer: EventConsumer,
|
||||
pub exit_notifier: EventNotifier,
|
||||
}
|
||||
|
||||
impl VhostUserVsockBackend {
|
||||
@ -272,6 +274,9 @@ impl VhostUserVsockBackend {
|
||||
)?);
|
||||
let queues_per_thread = vec![QUEUE_MASK];
|
||||
|
||||
let (exit_consumer, exit_notifier) =
|
||||
new_event_consumer_and_notifier(EventFlag::NONBLOCK).map_err(Error::EventFdCreate)?;
|
||||
|
||||
Ok(Self {
|
||||
config: VirtioVsockConfig {
|
||||
guest_cid: From::from(config.get_guest_cid()),
|
||||
@ -279,7 +284,8 @@ impl VhostUserVsockBackend {
|
||||
queue_size: config.get_queue_size(),
|
||||
threads: vec![thread],
|
||||
queues_per_thread,
|
||||
exit_event: EventFd::new(EFD_NONBLOCK).map_err(Error::EventFdCreate)?,
|
||||
exit_consumer,
|
||||
exit_notifier,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -390,8 +396,10 @@ impl VhostUserBackend for VhostUserVsockBackend {
|
||||
self.queues_per_thread.clone()
|
||||
}
|
||||
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<EventFd> {
|
||||
self.exit_event.try_clone().ok()
|
||||
fn exit_event(&self, _thread_index: usize) -> Option<(EventConsumer, EventNotifier)> {
|
||||
let consumer = self.exit_consumer.try_clone().ok()?;
|
||||
let notifier = self.exit_notifier.try_clone().ok()?;
|
||||
Some((consumer, notifier))
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +455,8 @@ mod tests {
|
||||
|
||||
let exit = backend.exit_event(0);
|
||||
assert!(exit.is_some());
|
||||
exit.unwrap().write(1).unwrap();
|
||||
let (_, notifier) = exit.unwrap();
|
||||
notifier.notify().unwrap();
|
||||
|
||||
let ret = backend.handle_event(RX_QUEUE_EVENT, EventSet::IN, &vrings, 0);
|
||||
ret.unwrap();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user