build: Upgrade vm-memory crates and its consumers

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2023-11-07 11:37:23 -08:00 committed by Rob Bradford
parent d4a163dd39
commit 4d7a4c598a
25 changed files with 179 additions and 188 deletions

79
Cargo.lock generated
View File

@ -118,7 +118,7 @@ dependencies = [
"versionize", "versionize",
"versionize_derive", "versionize_derive",
"vm-fdt", "vm-fdt",
"vm-memory 0.12.2", "vm-memory",
"vm-migration", "vm-migration",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -339,7 +339,7 @@ dependencies = [
"versionize_derive", "versionize_derive",
"virtio-bindings", "virtio-bindings",
"virtio-queue", "virtio-queue",
"vm-memory 0.12.2", "vm-memory",
"vm-virtio", "vm-virtio",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -447,7 +447,7 @@ dependencies = [
"thiserror", "thiserror",
"tpm", "tpm",
"tracer", "tracer",
"vm-memory 0.12.2", "vm-memory",
"vmm", "vmm",
"vmm-sys-util", "vmm-sys-util",
"wait-timeout", "wait-timeout",
@ -587,7 +587,7 @@ dependencies = [
"versionize_derive", "versionize_derive",
"vm-allocator", "vm-allocator",
"vm-device", "vm-device",
"vm-memory 0.12.2", "vm-memory",
"vm-migration", "vm-migration",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -974,7 +974,7 @@ dependencies = [
"serde_with", "serde_with",
"thiserror", "thiserror",
"vfio-ioctls", "vfio-ioctls",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -1155,11 +1155,11 @@ dependencies = [
[[package]] [[package]]
name = "linux-loader" name = "linux-loader"
version = "0.9.1" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1db6a725c8000971f83fa93ed7ee1b600e55a1471a2a653379d3c84f72effdcf" checksum = "132a531b85b3a164012ab682c72f8f2cce7757f187be5f60782fd2b4cda9cb34"
dependencies = [ dependencies = [
"vm-memory 0.12.2", "vm-memory",
] ]
[[package]] [[package]]
@ -1300,7 +1300,7 @@ dependencies = [
"versionize_derive", "versionize_derive",
"virtio-bindings", "virtio-bindings",
"virtio-queue", "virtio-queue",
"vm-memory 0.12.2", "vm-memory",
"vm-virtio", "vm-virtio",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -1487,7 +1487,7 @@ dependencies = [
"vfio_user", "vfio_user",
"vm-allocator", "vm-allocator",
"vm-device", "vm-device",
"vm-memory 0.12.2", "vm-memory",
"vm-migration", "vm-migration",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -2305,14 +2305,14 @@ dependencies = [
"mshv-ioctls", "mshv-ioctls",
"thiserror", "thiserror",
"vfio-bindings", "vfio-bindings",
"vm-memory 0.13.1", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
[[package]] [[package]]
name = "vfio_user" name = "vfio_user"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/rust-vmm/vfio-user?branch=main#2d96b90a7279547356ad8f83aaa3115ad5497302" source = "git+https://github.com/rust-vmm/vfio-user?branch=main#6c72e997e61d9e84b8ee691ad63ece6c717cf5aa"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"libc", "libc",
@ -2322,34 +2322,34 @@ dependencies = [
"serde_json", "serde_json",
"thiserror", "thiserror",
"vfio-bindings", "vfio-bindings",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
[[package]] [[package]]
name = "vhost" name = "vhost"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61957aeb36daf0b00b87fff9c10dd28a161bd35ab157553d340d183b3d8756e6" checksum = "289adfce099c71f8310f895932ccd978f352ca494ea47496dbe20d4241888b82"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.1",
"libc", "libc",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
[[package]] [[package]]
name = "vhost-user-backend" name = "vhost-user-backend"
version = "0.10.1" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab069cdedaf18a0673766eb0a07a0f4ee3ed1b8e17fbfe4aafe5b988e2de1d01" checksum = "61255322e3ebe93fb77d9f6d99577eca7089bbea4174076c5353a8024a463061"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"vhost", "vhost",
"virtio-bindings", "virtio-bindings",
"virtio-queue", "virtio-queue",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -2368,7 +2368,7 @@ dependencies = [
"vhost-user-backend", "vhost-user-backend",
"virtio-bindings", "virtio-bindings",
"virtio-queue", "virtio-queue",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -2386,15 +2386,15 @@ dependencies = [
"vhost", "vhost",
"vhost-user-backend", "vhost-user-backend",
"virtio-bindings", "virtio-bindings",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
[[package]] [[package]]
name = "virtio-bindings" name = "virtio-bindings"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c18d7b74098a946470ea265b5bacbbf877abc3373021388454de0d47735a5b98" checksum = "878bcb1b2812a10c30d53b0ed054999de3d98f25ece91fc173973f9c57aaae86"
[[package]] [[package]]
name = "virtio-devices" name = "virtio-devices"
@ -2424,7 +2424,7 @@ dependencies = [
"virtio-queue", "virtio-queue",
"vm-allocator", "vm-allocator",
"vm-device", "vm-device",
"vm-memory 0.12.2", "vm-memory",
"vm-migration", "vm-migration",
"vm-virtio", "vm-virtio",
"vmm-sys-util", "vmm-sys-util",
@ -2432,13 +2432,13 @@ dependencies = [
[[package]] [[package]]
name = "virtio-queue" name = "virtio-queue"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35aca00da06841bd99162c381ec65893cace23ca0fb89254302cfe4bec4c300f" checksum = "73a01db2cfb6c4b9bc20608b1336263d16714ea8db05de9fec2a254e076f9385"
dependencies = [ dependencies = [
"log", "log",
"virtio-bindings", "virtio-bindings",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -2448,7 +2448,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"arch", "arch",
"libc", "libc",
"vm-memory 0.12.2", "vm-memory",
] ]
[[package]] [[package]]
@ -2460,7 +2460,7 @@ dependencies = [
"serde", "serde",
"thiserror", "thiserror",
"vfio-ioctls", "vfio-ioctls",
"vm-memory 0.12.2", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
] ]
@ -2469,24 +2469,13 @@ name = "vm-fdt"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/rust-vmm/vm-fdt?branch=main#77212bd0d62913e445c89376bcbbecd595afc5b1" source = "git+https://github.com/rust-vmm/vm-fdt?branch=main#77212bd0d62913e445c89376bcbbecd595afc5b1"
[[package]]
name = "vm-memory"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dc276f0d00c17b9aeb584da0f1e1c673df0d183cc2539e3636ec8cbc5eae99b"
dependencies = [
"arc-swap",
"libc",
"thiserror",
"winapi",
]
[[package]] [[package]]
name = "vm-memory" name = "vm-memory"
version = "0.13.1" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5376c9ee5ebe2103a310d8241936cfb93c946734b0479a4fa5bdf7a64abbacd8" checksum = "5376c9ee5ebe2103a310d8241936cfb93c946734b0479a4fa5bdf7a64abbacd8"
dependencies = [ dependencies = [
"arc-swap",
"libc", "libc",
"thiserror", "thiserror",
"winapi", "winapi",
@ -2502,7 +2491,7 @@ dependencies = [
"thiserror", "thiserror",
"versionize", "versionize",
"versionize_derive", "versionize_derive",
"vm-memory 0.12.2", "vm-memory",
] ]
[[package]] [[package]]
@ -2511,7 +2500,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"log", "log",
"virtio-queue", "virtio-queue",
"vm-memory 0.12.2", "vm-memory",
] ]
[[package]] [[package]]
@ -2559,7 +2548,7 @@ dependencies = [
"virtio-queue", "virtio-queue",
"vm-allocator", "vm-allocator",
"vm-device", "vm-device",
"vm-memory 0.12.2", "vm-memory",
"vm-migration", "vm-migration",
"vm-virtio", "vm-virtio",
"vmm-sys-util", "vmm-sys-util",

View File

@ -47,7 +47,7 @@ tpm = { path = "tpm"}
tracer = { path = "tracer" } tracer = { path = "tracer" }
vmm = { path = "vmm" } vmm = { path = "vmm" }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"
vm-memory = "0.12.2" vm-memory = "0.13.1"
zbus = { version = "3.11.1", optional = true } zbus = { version = "3.11.1", optional = true }
# List of patched crates # List of patched crates

View File

@ -14,14 +14,14 @@ anyhow = "1.0.75"
byteorder = "1.4.3" byteorder = "1.4.3"
hypervisor = { path = "../hypervisor" } hypervisor = { path = "../hypervisor" }
libc = "0.2.147" libc = "0.2.147"
linux-loader = { version = "0.9.1", features = ["elf", "bzimage", "pe"] } linux-loader = { version = "0.10.0", features = ["elf", "bzimage", "pe"] }
log = "0.4.17" log = "0.4.17"
serde = { version = "1.0.168", features = ["rc", "derive"] } serde = { version = "1.0.168", features = ["rc", "derive"] }
thiserror = "1.0.40" thiserror = "1.0.40"
uuid = "1.3.4" uuid = "1.3.4"
versionize = "0.1.10" versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-bitmap"] }
vm-migration = { path = "../vm-migration" } vm-migration = { path = "../vm-migration" }
vmm-sys-util = { version = "0.11.0", features = ["with-serde"] } vmm-sys-util = { version = "0.11.0", features = ["with-serde"] }

View File

@ -21,7 +21,7 @@ uuid = { version = "1.3.4", features = ["v4"] }
versionize = "0.1.10" versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] } virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] }
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -21,7 +21,7 @@ versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
vm-allocator = { path = "../vm-allocator" } vm-allocator = { path = "../vm-allocator" }
vm-device = { path = "../vm-device" } vm-device = { path = "../vm-device" }
vm-memory = "0.12.2" vm-memory = "0.13.1"
vm-migration = { path = "../vm-migration" } vm-migration = { path = "../vm-migration" }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

28
fuzz/Cargo.lock generated
View File

@ -507,9 +507,9 @@ dependencies = [
[[package]] [[package]]
name = "linux-loader" name = "linux-loader"
version = "0.9.1" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1db6a725c8000971f83fa93ed7ee1b600e55a1471a2a653379d3c84f72effdcf" checksum = "132a531b85b3a164012ab682c72f8f2cce7757f187be5f60782fd2b4cda9cb34"
dependencies = [ dependencies = [
"vm-memory", "vm-memory",
] ]
@ -917,7 +917,7 @@ dependencies = [
[[package]] [[package]]
name = "vfio-bindings" name = "vfio-bindings"
version = "0.4.0" version = "0.4.0"
source = "git+https://github.com/rust-vmm/vfio?branch=main#847b0aa504ac6367efe42ba7e96a2d050737d4f0" source = "git+https://github.com/rust-vmm/vfio?branch=main#59c604fa6e42080f0a47c124ba29454fe4cb7475"
dependencies = [ dependencies = [
"vmm-sys-util", "vmm-sys-util",
] ]
@ -925,7 +925,7 @@ dependencies = [
[[package]] [[package]]
name = "vfio-ioctls" name = "vfio-ioctls"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/rust-vmm/vfio?branch=main#847b0aa504ac6367efe42ba7e96a2d050737d4f0" source = "git+https://github.com/rust-vmm/vfio?branch=main#59c604fa6e42080f0a47c124ba29454fe4cb7475"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"kvm-bindings", "kvm-bindings",
@ -941,7 +941,7 @@ dependencies = [
[[package]] [[package]]
name = "vfio_user" name = "vfio_user"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/rust-vmm/vfio-user?branch=main#2d96b90a7279547356ad8f83aaa3115ad5497302" source = "git+https://github.com/rust-vmm/vfio-user?branch=main#6c72e997e61d9e84b8ee691ad63ece6c717cf5aa"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"libc", "libc",
@ -957,11 +957,11 @@ dependencies = [
[[package]] [[package]]
name = "vhost" name = "vhost"
version = "0.8.1" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61957aeb36daf0b00b87fff9c10dd28a161bd35ab157553d340d183b3d8756e6" checksum = "289adfce099c71f8310f895932ccd978f352ca494ea47496dbe20d4241888b82"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.1",
"libc", "libc",
"vm-memory", "vm-memory",
"vmm-sys-util", "vmm-sys-util",
@ -969,9 +969,9 @@ dependencies = [
[[package]] [[package]]
name = "virtio-bindings" name = "virtio-bindings"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c18d7b74098a946470ea265b5bacbbf877abc3373021388454de0d47735a5b98" checksum = "878bcb1b2812a10c30d53b0ed054999de3d98f25ece91fc173973f9c57aaae86"
[[package]] [[package]]
name = "virtio-devices" name = "virtio-devices"
@ -1009,9 +1009,9 @@ dependencies = [
[[package]] [[package]]
name = "virtio-queue" name = "virtio-queue"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35aca00da06841bd99162c381ec65893cace23ca0fb89254302cfe4bec4c300f" checksum = "73a01db2cfb6c4b9bc20608b1336263d16714ea8db05de9fec2a254e076f9385"
dependencies = [ dependencies = [
"log", "log",
"virtio-bindings", "virtio-bindings",
@ -1048,9 +1048,9 @@ source = "git+https://github.com/rust-vmm/vm-fdt?branch=main#c5a99ab71b130435927
[[package]] [[package]]
name = "vm-memory" name = "vm-memory"
version = "0.12.2" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dc276f0d00c17b9aeb584da0f1e1c673df0d183cc2539e3636ec8cbc5eae99b" checksum = "5376c9ee5ebe2103a310d8241936cfb93c946734b0479a4fa5bdf7a64abbacd8"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"libc", "libc",

View File

@ -14,16 +14,16 @@ devices = { path = "../devices" }
epoll = "4.3.1" epoll = "4.3.1"
libc = "0.2.150" libc = "0.2.150"
libfuzzer-sys = "0.4.7" libfuzzer-sys = "0.4.7"
linux-loader = { version = "0.9.1", features = ["elf", "bzimage", "pe"] } linux-loader = { version = "0.10.0", features = ["elf", "bzimage", "pe"] }
micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" } micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" }
net_util = { path = "../net_util" } net_util = { path = "../net_util" }
once_cell = "1.18.0" once_cell = "1.18.0"
seccompiler = "0.4.0" seccompiler = "0.4.0"
virtio-devices = { path = "../virtio-devices" } virtio-devices = { path = "../virtio-devices" }
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vmm = { path = "../vmm" } vmm = { path = "../vmm" }
vmm-sys-util = "0.11.2" vmm-sys-util = "0.11.2"
vm-memory = "0.12.2" vm-memory = "0.13.1"
vm-device = { path = "../vm-device" } vm-device = { path = "../vm-device" }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }

View File

@ -25,7 +25,7 @@ mshv-ioctls = { git = "https://github.com/rust-vmm/mshv", branch = "main", optio
serde = { version = "1.0.168", features = ["rc", "derive"] } serde = { version = "1.0.168", features = ["rc", "derive"] }
serde_with = { version = "3.4.0", default-features = false, features = ["macros"] } serde_with = { version = "3.4.0", default-features = false, features = ["macros"] }
vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false } vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false }
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic"] }
vmm-sys-util = { version = "0.11.0", features = ["with-serde"] } vmm-sys-util = { version = "0.11.0", features = ["with-serde"] }
thiserror = "1.0.40" thiserror = "1.0.40"

View File

@ -16,8 +16,8 @@ thiserror = "1.0.40"
versionize = "0.1.10" versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
virtio-bindings = "0.2.0" virtio-bindings = "0.2.0"
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -26,5 +26,5 @@ versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
vm-allocator = { path = "../vm-allocator" } vm-allocator = { path = "../vm-allocator" }
vm-device = { path = "../vm-device" } vm-device = { path = "../vm-device" }
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
vm-migration = { path = "../vm-migration" } vm-migration = { path = "../vm-migration" }

View File

@ -13,10 +13,9 @@ epoll = "4.3.3"
libc = "0.2.147" libc = "0.2.147"
log = "0.4.17" log = "0.4.17"
option_parser = { path = "../option_parser" } option_parser = { path = "../option_parser" }
vhost = { version = "0.8.1", features = ["vhost-user-slave"] } vhost = { version = "0.9.0", features = ["vhost-user-backend"] }
vhost-user-backend = "0.10.1" vhost-user-backend = "0.11.0"
virtio-bindings = "0.2.0" virtio-bindings = "0.2.0"
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-memory = "0.12.2" vm-memory = "0.13.1"
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -299,9 +299,10 @@ impl VhostUserBlkBackend {
} }
} }
impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, AtomicBitmap> impl VhostUserBackendMut for VhostUserBlkBackend {
for VhostUserBlkBackend type Bitmap = AtomicBitmap;
{ type Vring = VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>;
fn num_queues(&self) -> usize { fn num_queues(&self) -> usize {
self.config.num_queues as usize self.config.num_queues as usize
} }
@ -350,7 +351,7 @@ impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, Atomic
evset: EventSet, evset: EventSet,
vrings: &[VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>], vrings: &[VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>],
thread_id: usize, thread_id: usize,
) -> VhostUserBackendResult<bool> { ) -> VhostUserBackendResult<()> {
if evset != EventSet::IN { if evset != EventSet::IN {
return Err(Error::HandleEventNotEpollIn.into()); return Err(Error::HandleEventNotEpollIn.into());
} }
@ -394,7 +395,7 @@ impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, Atomic
thread.process_queue(&mut vring); thread.process_queue(&mut vring);
} }
Ok(false) Ok(())
} }
_ => Err(Error::HandleEventUnknownEvent.into()), _ => Err(Error::HandleEventUnknownEvent.into()),
} }

View File

@ -13,9 +13,9 @@ libc = "0.2.147"
log = "0.4.17" log = "0.4.17"
net_util = { path = "../net_util" } net_util = { path = "../net_util" }
option_parser = { path = "../option_parser" } option_parser = { path = "../option_parser" }
vhost = { version = "0.8.1", features = ["vhost-user-slave"] } vhost = { version = "0.9.0", features = ["vhost-user-backend"] }
vhost-user-backend = "0.10.1" vhost-user-backend = "0.11.0"
virtio-bindings = "0.2.0" virtio-bindings = "0.2.0"
vm-memory = "0.12.2" vm-memory = "0.13.1"
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -158,9 +158,10 @@ impl VhostUserNetBackend {
} }
} }
impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, AtomicBitmap> impl VhostUserBackendMut for VhostUserNetBackend {
for VhostUserNetBackend type Bitmap = AtomicBitmap;
{ type Vring = VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>;
fn num_queues(&self) -> usize { fn num_queues(&self) -> usize {
self.num_queues self.num_queues
} }
@ -203,7 +204,7 @@ impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, Atomic
_evset: EventSet, _evset: EventSet,
vrings: &[VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>], vrings: &[VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>],
thread_id: usize, thread_id: usize,
) -> VhostUserBackendResult<bool> { ) -> VhostUserBackendResult<()> {
let mut thread = self.threads[thread_id].lock().unwrap(); let mut thread = self.threads[thread_id].lock().unwrap();
match device_event { match device_event {
0 => { 0 => {
@ -245,7 +246,7 @@ impl VhostUserBackendMut<VringRwLock<GuestMemoryAtomic<GuestMemoryMmap>>, Atomic
_ => return Err(Error::HandleEventUnknownEvent.into()), _ => return Err(Error::HandleEventUnknownEvent.into()),
} }
Ok(false) Ok(())
} }
fn exit_event(&self, thread_index: usize) -> Option<EventFd> { fn exit_event(&self, thread_index: usize) -> Option<EventFd> {

View File

@ -27,12 +27,12 @@ serial_buffer = { path = "../serial_buffer" }
thiserror = "1.0.40" thiserror = "1.0.40"
versionize = "0.1.10" versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
vhost = { version = "0.8.1", features = ["vhost-user-master", "vhost-user-slave", "vhost-kern", "vhost-vdpa"] } vhost = { version = "0.9.0", features = ["vhost-user-frontend", "vhost-user-backend", "vhost-kern", "vhost-vdpa"] }
virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] } virtio-bindings = { version = "0.2.0", features = ["virtio-v5_0_0"] }
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-allocator = { path = "../vm-allocator" } vm-allocator = { path = "../vm-allocator" }
vm-device = { path = "../vm-device" } vm-device = { path = "../vm-device" }
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
vm-migration = { path = "../vm-migration" } vm-migration = { path = "../vm-migration" }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -23,7 +23,7 @@ use vhost::vhost_user::message::{
VhostUserConfigFlags, VhostUserProtocolFeatures, VhostUserVirtioFeatures, VhostUserConfigFlags, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
VHOST_USER_CONFIG_OFFSET, VHOST_USER_CONFIG_OFFSET,
}; };
use vhost::vhost_user::{MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler}; use vhost::vhost_user::{FrontendReqHandler, VhostUserFrontend, VhostUserFrontendReqHandler};
use virtio_bindings::virtio_blk::{ use virtio_bindings::virtio_blk::{
VIRTIO_BLK_F_BLK_SIZE, VIRTIO_BLK_F_CONFIG_WCE, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_BLK_SIZE, VIRTIO_BLK_F_CONFIG_WCE, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_FLUSH,
VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_SEG_MAX,
@ -50,8 +50,8 @@ pub struct State {
impl VersionMapped for State {} impl VersionMapped for State {}
struct SlaveReqHandler {} struct BackendReqHandler {}
impl VhostUserMasterReqHandler for SlaveReqHandler {} impl VhostUserFrontendReqHandler for BackendReqHandler {}
pub struct Blk { pub struct Blk {
common: VirtioCommon, common: VirtioCommon,
@ -294,7 +294,7 @@ impl VirtioDevice for Blk {
self.common.activate(&queues, &interrupt_cb)?; self.common.activate(&queues, &interrupt_cb)?;
self.guest_memory = Some(mem.clone()); self.guest_memory = Some(mem.clone());
let slave_req_handler: Option<MasterReqHandler<SlaveReqHandler>> = None; let backend_req_handler: Option<FrontendReqHandler<BackendReqHandler>> = None;
// Run a dedicated thread for handling potential reconnections with // Run a dedicated thread for handling potential reconnections with
// the backend. // the backend.
@ -305,7 +305,7 @@ impl VirtioDevice for Blk {
queues, queues,
interrupt_cb, interrupt_cb,
self.common.acked_features, self.common.acked_features,
slave_req_handler, backend_req_handler,
kill_evt, kill_evt,
pause_evt, pause_evt,
)?; )?;

View File

@ -22,11 +22,11 @@ use std::thread;
use versionize::{VersionMap, Versionize, VersionizeResult}; use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize; use versionize_derive::Versionize;
use vhost::vhost_user::message::{ use vhost::vhost_user::message::{
VhostUserFSSlaveMsg, VhostUserFSSlaveMsgFlags, VhostUserProtocolFeatures, VhostUserFSBackendMsg, VhostUserFSBackendMsgFlags, VhostUserProtocolFeatures,
VhostUserVirtioFeatures, VHOST_USER_FS_SLAVE_ENTRIES, VhostUserVirtioFeatures, VHOST_USER_FS_BACKEND_ENTRIES,
}; };
use vhost::vhost_user::{ use vhost::vhost_user::{
HandlerResult, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler, FrontendReqHandler, HandlerResult, VhostUserFrontend, VhostUserFrontendReqHandler,
}; };
use virtio_queue::Queue; use virtio_queue::Queue;
use vm_memory::{ use vm_memory::{
@ -48,19 +48,19 @@ pub struct State {
pub config: VirtioFsConfig, pub config: VirtioFsConfig,
pub acked_protocol_features: u64, pub acked_protocol_features: u64,
pub vu_num_queues: usize, pub vu_num_queues: usize,
pub slave_req_support: bool, pub backend_req_support: bool,
} }
impl VersionMapped for State {} impl VersionMapped for State {}
struct SlaveReqHandler { struct BackendReqHandler {
cache_offset: GuestAddress, cache_offset: GuestAddress,
cache_size: u64, cache_size: u64,
mmap_cache_addr: u64, mmap_cache_addr: u64,
mem: GuestMemoryAtomic<GuestMemoryMmap>, mem: GuestMemoryAtomic<GuestMemoryMmap>,
} }
impl SlaveReqHandler { impl BackendReqHandler {
// Make sure request is within cache range // Make sure request is within cache range
fn is_req_valid(&self, offset: u64, len: u64) -> bool { fn is_req_valid(&self, offset: u64, len: u64) -> bool {
let end = match offset.checked_add(len) { let end = match offset.checked_add(len) {
@ -72,16 +72,16 @@ impl SlaveReqHandler {
} }
} }
impl VhostUserMasterReqHandler for SlaveReqHandler { impl VhostUserFrontendReqHandler for BackendReqHandler {
fn handle_config_change(&self) -> HandlerResult<u64> { fn handle_config_change(&self) -> HandlerResult<u64> {
debug!("handle_config_change"); debug!("handle_config_change");
Ok(0) Ok(0)
} }
fn fs_slave_map(&self, fs: &VhostUserFSSlaveMsg, fd: &dyn AsRawFd) -> HandlerResult<u64> { fn fs_backend_map(&self, fs: &VhostUserFSBackendMsg, fd: &dyn AsRawFd) -> HandlerResult<u64> {
debug!("fs_slave_map"); debug!("fs_backend_map");
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES { for i in 0..VHOST_USER_FS_BACKEND_ENTRIES {
let offset = fs.cache_offset[i]; let offset = fs.cache_offset[i];
let len = fs.len[i]; let len = fs.len[i];
@ -115,10 +115,10 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
Ok(0) Ok(0)
} }
fn fs_slave_unmap(&self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> { fn fs_backend_unmap(&self, fs: &VhostUserFSBackendMsg) -> HandlerResult<u64> {
debug!("fs_slave_unmap"); debug!("fs_backend_unmap");
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES { for i in 0..VHOST_USER_FS_BACKEND_ENTRIES {
let mut len = fs.len[i]; let mut len = fs.len[i];
// Ignore if the length is 0. // Ignore if the length is 0.
@ -126,7 +126,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
continue; continue;
} }
// Need to handle a special case where the slave ask for the unmapping // Need to handle a special case where the backend ask for the unmapping
// of the entire mapping. // of the entire mapping.
let offset = if len == 0xffff_ffff_ffff_ffff { let offset = if len == 0xffff_ffff_ffff_ffff {
len = self.cache_size; len = self.cache_size;
@ -159,10 +159,10 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
Ok(0) Ok(0)
} }
fn fs_slave_sync(&self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> { fn fs_backend_sync(&self, fs: &VhostUserFSBackendMsg) -> HandlerResult<u64> {
debug!("fs_slave_sync"); debug!("fs_backend_sync");
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES { for i in 0..VHOST_USER_FS_BACKEND_ENTRIES {
let offset = fs.cache_offset[i]; let offset = fs.cache_offset[i];
let len = fs.len[i]; let len = fs.len[i];
@ -187,11 +187,11 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
Ok(0) Ok(0)
} }
fn fs_slave_io(&self, fs: &VhostUserFSSlaveMsg, fd: &dyn AsRawFd) -> HandlerResult<u64> { fn fs_backend_io(&self, fs: &VhostUserFSBackendMsg, fd: &dyn AsRawFd) -> HandlerResult<u64> {
debug!("fs_slave_io"); debug!("fs_backend_io");
let mut done: u64 = 0; let mut done: u64 = 0;
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES { for i in 0..VHOST_USER_FS_BACKEND_ENTRIES {
// Ignore if the length is 0. // Ignore if the length is 0.
if fs.len[i] == 0 { if fs.len[i] == 0 {
continue; continue;
@ -230,8 +230,8 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
}; };
while len > 0 { while len > 0 {
let ret = if (fs.flags[i] & VhostUserFSSlaveMsgFlags::MAP_W) let ret = if (fs.flags[i] & VhostUserFSBackendMsgFlags::MAP_W)
== VhostUserFSSlaveMsgFlags::MAP_W == VhostUserFSBackendMsgFlags::MAP_W
{ {
debug!("write: foffset={}, len={}", foffset, len); debug!("write: foffset={}, len={}", foffset, len);
// SAFETY: FFI call with valid arguments // SAFETY: FFI call with valid arguments
@ -298,7 +298,7 @@ pub struct Fs {
// Hold ownership of the memory that is allocated for the device // Hold ownership of the memory that is allocated for the device
// which will be automatically dropped when the device is dropped // which will be automatically dropped when the device is dropped
cache: Option<(VirtioSharedMemoryList, MmapRegion)>, cache: Option<(VirtioSharedMemoryList, MmapRegion)>,
slave_req_support: bool, backend_req_support: bool,
seccomp_action: SeccompAction, seccomp_action: SeccompAction,
guest_memory: Option<GuestMemoryAtomic<GuestMemoryMmap>>, guest_memory: Option<GuestMemoryAtomic<GuestMemoryMmap>>,
epoll_thread: Option<thread::JoinHandle<()>>, epoll_thread: Option<thread::JoinHandle<()>>,
@ -321,7 +321,7 @@ impl Fs {
iommu: bool, iommu: bool,
state: Option<State>, state: Option<State>,
) -> Result<Fs> { ) -> Result<Fs> {
let mut slave_req_support = false; let mut backend_req_support = false;
// Calculate the actual number of queues needed. // Calculate the actual number of queues needed.
let num_queues = NUM_QUEUE_OFFSET + req_num_queues; let num_queues = NUM_QUEUE_OFFSET + req_num_queues;
@ -335,7 +335,7 @@ impl Fs {
acked_protocol_features, acked_protocol_features,
vu_num_queues, vu_num_queues,
config, config,
slave_req_support, backend_req_support,
paused, paused,
) = if let Some(state) = state { ) = if let Some(state) = state {
info!("Restoring vhost-user-fs {}", id); info!("Restoring vhost-user-fs {}", id);
@ -351,7 +351,7 @@ impl Fs {
state.acked_protocol_features, state.acked_protocol_features,
state.vu_num_queues, state.vu_num_queues,
state.config, state.config,
state.slave_req_support, state.backend_req_support,
true, true,
) )
} else { } else {
@ -363,10 +363,10 @@ impl Fs {
| VhostUserProtocolFeatures::REPLY_ACK | VhostUserProtocolFeatures::REPLY_ACK
| VhostUserProtocolFeatures::INFLIGHT_SHMFD | VhostUserProtocolFeatures::INFLIGHT_SHMFD
| VhostUserProtocolFeatures::LOG_SHMFD; | VhostUserProtocolFeatures::LOG_SHMFD;
let slave_protocol_features = let backend_protocol_features =
VhostUserProtocolFeatures::SLAVE_REQ | VhostUserProtocolFeatures::SLAVE_SEND_FD; VhostUserProtocolFeatures::BACKEND_REQ | VhostUserProtocolFeatures::BACKEND_SEND_FD;
if cache.is_some() { if cache.is_some() {
avail_protocol_features |= slave_protocol_features; avail_protocol_features |= backend_protocol_features;
} }
let (acked_features, acked_protocol_features) = let (acked_features, acked_protocol_features) =
@ -389,10 +389,10 @@ impl Fs {
return Err(Error::BadQueueNum); return Err(Error::BadQueueNum);
} }
if acked_protocol_features & slave_protocol_features.bits() if acked_protocol_features & backend_protocol_features.bits()
== slave_protocol_features.bits() == backend_protocol_features.bits()
{ {
slave_req_support = true; backend_req_support = true;
} }
// Create virtio-fs device configuration. // Create virtio-fs device configuration.
@ -411,7 +411,7 @@ impl Fs {
acked_protocol_features, acked_protocol_features,
num_queues, num_queues,
config, config,
slave_req_support, backend_req_support,
false, false,
) )
}; };
@ -437,7 +437,7 @@ impl Fs {
id, id,
config, config,
cache, cache,
slave_req_support, backend_req_support,
seccomp_action, seccomp_action,
guest_memory: None, guest_memory: None,
epoll_thread: None, epoll_thread: None,
@ -453,7 +453,7 @@ impl Fs {
config: self.config, config: self.config,
acked_protocol_features: self.vu_common.acked_protocol_features, acked_protocol_features: self.vu_common.acked_protocol_features,
vu_num_queues: self.vu_common.vu_num_queues, vu_num_queues: self.vu_common.vu_num_queues,
slave_req_support: self.slave_req_support, backend_req_support: self.backend_req_support,
} }
} }
} }
@ -507,10 +507,10 @@ impl VirtioDevice for Fs {
self.common.activate(&queues, &interrupt_cb)?; self.common.activate(&queues, &interrupt_cb)?;
self.guest_memory = Some(mem.clone()); self.guest_memory = Some(mem.clone());
// Initialize slave communication. // Initialize backend communication.
let slave_req_handler = if self.slave_req_support { let backend_req_handler = if self.backend_req_support {
if let Some(cache) = self.cache.as_ref() { if let Some(cache) = self.cache.as_ref() {
let vu_master_req_handler = Arc::new(SlaveReqHandler { let vu_frontend_req_handler = Arc::new(BackendReqHandler {
cache_offset: cache.0.addr, cache_offset: cache.0.addr,
cache_size: cache.0.len, cache_size: cache.0.len,
mmap_cache_addr: cache.0.host_addr, mmap_cache_addr: cache.0.host_addr,
@ -518,8 +518,8 @@ impl VirtioDevice for Fs {
}); });
let mut req_handler = let mut req_handler =
MasterReqHandler::new(vu_master_req_handler).map_err(|e| { FrontendReqHandler::new(vu_frontend_req_handler).map_err(|e| {
ActivateError::VhostUserFsSetup(Error::MasterReqHandlerCreation(e)) ActivateError::VhostUserFsSetup(Error::FrontendReqHandlerCreation(e))
})?; })?;
if self.vu_common.acked_protocol_features if self.vu_common.acked_protocol_features
@ -546,7 +546,7 @@ impl VirtioDevice for Fs {
queues, queues,
interrupt_cb, interrupt_cb,
self.common.acked_features, self.common.acked_features,
slave_req_handler, backend_req_handler,
kill_evt, kill_evt,
pause_evt, pause_evt,
)?; )?;

View File

@ -17,7 +17,7 @@ use versionize::Versionize;
use vhost::vhost_user::message::{ use vhost::vhost_user::message::{
VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
}; };
use vhost::vhost_user::{MasterReqHandler, VhostUserMasterReqHandler}; use vhost::vhost_user::{FrontendReqHandler, VhostUserFrontendReqHandler};
use vhost::Error as VhostError; use vhost::Error as VhostError;
use virtio_queue::Error as QueueError; use virtio_queue::Error as QueueError;
use virtio_queue::Queue; use virtio_queue::Queue;
@ -61,8 +61,8 @@ pub enum Error {
MemoryRegions(MmapError), MemoryRegions(MmapError),
#[error("Failed removing socket path: {0}")] #[error("Failed removing socket path: {0}")]
RemoveSocketPath(io::Error), RemoveSocketPath(io::Error),
#[error("Failed to create master: {0}")] #[error("Failed to create frontend: {0}")]
VhostUserCreateMaster(VhostError), VhostUserCreateFrontend(VhostError),
#[error("Failed to open vhost device: {0}")] #[error("Failed to open vhost device: {0}")]
VhostUserOpen(VhostError), VhostUserOpen(VhostError),
#[error("Connection to socket failed")] #[error("Connection to socket failed")]
@ -105,10 +105,10 @@ pub enum Error {
VhostIrqRead(io::Error), VhostIrqRead(io::Error),
#[error("Failed to read vhost eventfd: {0}")] #[error("Failed to read vhost eventfd: {0}")]
VhostUserMemoryRegion(MmapError), VhostUserMemoryRegion(MmapError),
#[error("Failed to create the master request handler from slave: {0}")] #[error("Failed to create the frontend request handler from backend: {0}")]
MasterReqHandlerCreation(vhost::vhost_user::Error), FrontendReqHandlerCreation(vhost::vhost_user::Error),
#[error("Set slave request fd failed: {0}")] #[error("Set backend request fd failed: {0}")]
VhostUserSetSlaveRequestFd(vhost::Error), VhostUserSetBackendRequestFd(vhost::Error),
#[error("Add memory region failed: {0}")] #[error("Add memory region failed: {0}")]
VhostUserAddMemReg(VhostError), VhostUserAddMemReg(VhostError),
#[error("Failed getting the configuration: {0}")] #[error("Failed getting the configuration: {0}")]
@ -155,7 +155,7 @@ pub const DEFAULT_VIRTIO_FEATURES: u64 = 1 << VIRTIO_F_RING_INDIRECT_DESC
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits(); | VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
const HUP_CONNECTION_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 1; const HUP_CONNECTION_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 1;
const SLAVE_REQ_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 2; const BACKEND_REQ_EVENT: u16 = EPOLL_HELPER_EVENT_LAST + 2;
#[derive(Default)] #[derive(Default)]
pub struct Inflight { pub struct Inflight {
@ -163,7 +163,7 @@ pub struct Inflight {
pub fd: Option<std::fs::File>, pub fd: Option<std::fs::File>,
} }
pub struct VhostUserEpollHandler<S: VhostUserMasterReqHandler> { pub struct VhostUserEpollHandler<S: VhostUserFrontendReqHandler> {
pub vu: Arc<Mutex<VhostUserHandle>>, pub vu: Arc<Mutex<VhostUserHandle>>,
pub mem: GuestMemoryAtomic<GuestMemoryMmap>, pub mem: GuestMemoryAtomic<GuestMemoryMmap>,
pub kill_evt: EventFd, pub kill_evt: EventFd,
@ -174,11 +174,11 @@ pub struct VhostUserEpollHandler<S: VhostUserMasterReqHandler> {
pub acked_protocol_features: u64, pub acked_protocol_features: u64,
pub socket_path: String, pub socket_path: String,
pub server: bool, pub server: bool,
pub slave_req_handler: Option<MasterReqHandler<S>>, pub backend_req_handler: Option<FrontendReqHandler<S>>,
pub inflight: Option<Inflight>, pub inflight: Option<Inflight>,
} }
impl<S: VhostUserMasterReqHandler> VhostUserEpollHandler<S> { impl<S: VhostUserFrontendReqHandler> VhostUserEpollHandler<S> {
pub fn run( pub fn run(
&mut self, &mut self,
paused: Arc<AtomicBool>, paused: Arc<AtomicBool>,
@ -191,8 +191,8 @@ impl<S: VhostUserMasterReqHandler> VhostUserEpollHandler<S> {
epoll::Events::EPOLLHUP, epoll::Events::EPOLLHUP,
)?; )?;
if let Some(slave_req_handler) = &self.slave_req_handler { if let Some(backend_req_handler) = &self.backend_req_handler {
helper.add_event(slave_req_handler.as_raw_fd(), SLAVE_REQ_EVENT)?; helper.add_event(backend_req_handler.as_raw_fd(), BACKEND_REQ_EVENT)?;
} }
helper.run(paused, paused_sync, self)?; helper.run(paused, paused_sync, self)?;
@ -231,7 +231,7 @@ impl<S: VhostUserMasterReqHandler> VhostUserEpollHandler<S> {
&self.virtio_interrupt, &self.virtio_interrupt,
self.acked_features, self.acked_features,
self.acked_protocol_features, self.acked_protocol_features,
&self.slave_req_handler, &self.backend_req_handler,
self.inflight.as_mut(), self.inflight.as_mut(),
) )
.map_err(|e| { .map_err(|e| {
@ -255,7 +255,7 @@ impl<S: VhostUserMasterReqHandler> VhostUserEpollHandler<S> {
} }
} }
impl<S: VhostUserMasterReqHandler> EpollHelperHandler for VhostUserEpollHandler<S> { impl<S: VhostUserFrontendReqHandler> EpollHelperHandler for VhostUserEpollHandler<S> {
fn handle_event( fn handle_event(
&mut self, &mut self,
helper: &mut EpollHelper, helper: &mut EpollHelper,
@ -271,9 +271,9 @@ impl<S: VhostUserMasterReqHandler> EpollHelperHandler for VhostUserEpollHandler<
)) ))
})?; })?;
} }
SLAVE_REQ_EVENT => { BACKEND_REQ_EVENT => {
if let Some(slave_req_handler) = self.slave_req_handler.as_mut() { if let Some(backend_req_handler) = self.backend_req_handler.as_mut() {
slave_req_handler.handle_request().map_err(|e| { backend_req_handler.handle_request().map_err(|e| {
EpollHelperError::HandleEvent(anyhow!( EpollHelperError::HandleEvent(anyhow!(
"Failed to handle request from vhost-user backend: {:?}", "Failed to handle request from vhost-user backend: {:?}",
e e
@ -304,13 +304,13 @@ pub struct VhostUserCommon {
impl VhostUserCommon { impl VhostUserCommon {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn activate<T: VhostUserMasterReqHandler>( pub fn activate<T: VhostUserFrontendReqHandler>(
&mut self, &mut self,
mem: GuestMemoryAtomic<GuestMemoryMmap>, mem: GuestMemoryAtomic<GuestMemoryMmap>,
queues: Vec<(usize, Queue, EventFd)>, queues: Vec<(usize, Queue, EventFd)>,
interrupt_cb: Arc<dyn VirtioInterrupt>, interrupt_cb: Arc<dyn VirtioInterrupt>,
acked_features: u64, acked_features: u64,
slave_req_handler: Option<MasterReqHandler<T>>, backend_req_handler: Option<FrontendReqHandler<T>>,
kill_evt: EventFd, kill_evt: EventFd,
pause_evt: EventFd, pause_evt: EventFd,
) -> std::result::Result<VhostUserEpollHandler<T>, ActivateError> { ) -> std::result::Result<VhostUserEpollHandler<T>, ActivateError> {
@ -337,7 +337,7 @@ impl VhostUserCommon {
.collect(), .collect(),
&interrupt_cb, &interrupt_cb,
acked_features, acked_features,
&slave_req_handler, &backend_req_handler,
inflight.as_mut(), inflight.as_mut(),
) )
.map_err(ActivateError::VhostUserSetup)?; .map_err(ActivateError::VhostUserSetup)?;
@ -353,7 +353,7 @@ impl VhostUserCommon {
acked_protocol_features: self.acked_protocol_features, acked_protocol_features: self.acked_protocol_features,
socket_path: self.socket_path.clone(), socket_path: self.socket_path.clone(),
server: self.server, server: self.server,
slave_req_handler, backend_req_handler,
inflight, inflight,
}) })
} }

View File

@ -20,7 +20,7 @@ use std::vec::Vec;
use versionize::{VersionMap, Versionize, VersionizeResult}; use versionize::{VersionMap, Versionize, VersionizeResult};
use versionize_derive::Versionize; use versionize_derive::Versionize;
use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures}; use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
use vhost::vhost_user::{MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler}; use vhost::vhost_user::{FrontendReqHandler, VhostUserFrontend, VhostUserFrontendReqHandler};
use virtio_bindings::virtio_net::{ use virtio_bindings::virtio_net::{
VIRTIO_NET_F_CSUM, VIRTIO_NET_F_CTRL_VQ, VIRTIO_NET_F_GUEST_CSUM, VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_CSUM, VIRTIO_NET_F_CTRL_VQ, VIRTIO_NET_F_GUEST_CSUM, VIRTIO_NET_F_GUEST_ECN,
VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, VIRTIO_NET_F_GUEST_UFO,
@ -49,8 +49,8 @@ pub struct State {
impl VersionMapped for State {} impl VersionMapped for State {}
struct SlaveReqHandler {} struct BackendReqHandler {}
impl VhostUserMasterReqHandler for SlaveReqHandler {} impl VhostUserFrontendReqHandler for BackendReqHandler {}
pub struct Net { pub struct Net {
common: VirtioCommon, common: VirtioCommon,
@ -342,7 +342,7 @@ impl VirtioDevice for Net {
self.ctrl_queue_epoll_thread = Some(epoll_threads.remove(0)); self.ctrl_queue_epoll_thread = Some(epoll_threads.remove(0));
} }
let slave_req_handler: Option<MasterReqHandler<SlaveReqHandler>> = None; let backend_req_handler: Option<FrontendReqHandler<BackendReqHandler>> = None;
// The backend acknowledged features must not contain VIRTIO_NET_F_MAC // The backend acknowledged features must not contain VIRTIO_NET_F_MAC
// since we don't expect the backend to handle it. // since we don't expect the backend to handle it.
@ -357,7 +357,7 @@ impl VirtioDevice for Net {
queues, queues,
interrupt_cb, interrupt_cb,
backend_acked_features, backend_acked_features,
slave_req_handler, backend_req_handler,
kill_evt, kill_evt,
pause_evt, pause_evt,
)?; )?;

View File

@ -20,7 +20,9 @@ use vhost::vhost_kern::vhost_binding::{VHOST_F_LOG_ALL, VHOST_VRING_F_LOG};
use vhost::vhost_user::message::{ use vhost::vhost_user::message::{
VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures, VhostUserHeaderFlag, VhostUserInflight, VhostUserProtocolFeatures, VhostUserVirtioFeatures,
}; };
use vhost::vhost_user::{Master, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler}; use vhost::vhost_user::{
Frontend, FrontendReqHandler, VhostUserFrontend, VhostUserFrontendReqHandler,
};
use vhost::{VhostBackend, VhostUserDirtyLogRegion, VhostUserMemoryRegionInfo, VringConfigData}; use vhost::{VhostBackend, VhostUserDirtyLogRegion, VhostUserMemoryRegionInfo, VringConfigData};
use virtio_queue::{Descriptor, Queue, QueueT}; use virtio_queue::{Descriptor, Queue, QueueT};
use vm_memory::{ use vm_memory::{
@ -47,7 +49,7 @@ struct VringInfo {
#[derive(Clone)] #[derive(Clone)]
pub struct VhostUserHandle { pub struct VhostUserHandle {
vu: Master, vu: Frontend,
ready: bool, ready: bool,
supports_migration: bool, supports_migration: bool,
shm_log: Option<Arc<MmapRegion>>, shm_log: Option<Arc<MmapRegion>>,
@ -148,13 +150,13 @@ impl VhostUserHandle {
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn setup_vhost_user<S: VhostUserMasterReqHandler>( pub fn setup_vhost_user<S: VhostUserFrontendReqHandler>(
&mut self, &mut self,
mem: &GuestMemoryMmap, mem: &GuestMemoryMmap,
queues: Vec<(usize, Queue, EventFd)>, queues: Vec<(usize, Queue, EventFd)>,
virtio_interrupt: &Arc<dyn VirtioInterrupt>, virtio_interrupt: &Arc<dyn VirtioInterrupt>,
acked_features: u64, acked_features: u64,
slave_req_handler: &Option<MasterReqHandler<S>>, backend_req_handler: &Option<FrontendReqHandler<S>>,
inflight: Option<&mut Inflight>, inflight: Option<&mut Inflight>,
) -> Result<()> { ) -> Result<()> {
self.vu self.vu
@ -266,10 +268,10 @@ impl VhostUserHandle {
self.enable_vhost_user_vrings(self.queue_indexes.clone(), true)?; self.enable_vhost_user_vrings(self.queue_indexes.clone(), true)?;
if let Some(slave_req_handler) = slave_req_handler { if let Some(backend_req_handler) = backend_req_handler {
self.vu self.vu
.set_slave_request_fd(&slave_req_handler.get_tx_raw_fd()) .set_backend_request_fd(&backend_req_handler.get_tx_raw_fd())
.map_err(Error::VhostUserSetSlaveRequestFd)?; .map_err(Error::VhostUserSetBackendRequestFd)?;
} }
self.vrings_info = Some(vrings_info); self.vrings_info = Some(vrings_info);
@ -333,14 +335,14 @@ impl VhostUserHandle {
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>( pub fn reinitialize_vhost_user<S: VhostUserFrontendReqHandler>(
&mut self, &mut self,
mem: &GuestMemoryMmap, mem: &GuestMemoryMmap,
queues: Vec<(usize, Queue, EventFd)>, queues: Vec<(usize, Queue, EventFd)>,
virtio_interrupt: &Arc<dyn VirtioInterrupt>, virtio_interrupt: &Arc<dyn VirtioInterrupt>,
acked_features: u64, acked_features: u64,
acked_protocol_features: u64, acked_protocol_features: u64,
slave_req_handler: &Option<MasterReqHandler<S>>, backend_req_handler: &Option<FrontendReqHandler<S>>,
inflight: Option<&mut Inflight>, inflight: Option<&mut Inflight>,
) -> Result<()> { ) -> Result<()> {
self.set_protocol_features_vhost_user(acked_features, acked_protocol_features)?; self.set_protocol_features_vhost_user(acked_features, acked_protocol_features)?;
@ -350,7 +352,7 @@ impl VhostUserHandle {
queues, queues,
virtio_interrupt, virtio_interrupt,
acked_features, acked_features,
slave_req_handler, backend_req_handler,
inflight, inflight,
) )
} }
@ -372,7 +374,7 @@ impl VhostUserHandle {
let (stream, _) = listener.accept().map_err(Error::AcceptConnection)?; let (stream, _) = listener.accept().map_err(Error::AcceptConnection)?;
Ok(VhostUserHandle { Ok(VhostUserHandle {
vu: Master::from_stream(stream, num_queues), vu: Frontend::from_stream(stream, num_queues),
ready: false, ready: false,
supports_migration: false, supports_migration: false,
shm_log: None, shm_log: None,
@ -385,7 +387,7 @@ impl VhostUserHandle {
// Retry connecting for a full minute // Retry connecting for a full minute
let err = loop { let err = loop {
let err = match Master::connect(socket_path, num_queues) { let err = match Frontend::connect(socket_path, num_queues) {
Ok(m) => { Ok(m) => {
return Ok(VhostUserHandle { return Ok(VhostUserHandle {
vu: m, vu: m,
@ -414,7 +416,7 @@ impl VhostUserHandle {
} }
} }
pub fn socket_handle(&mut self) -> &mut Master { pub fn socket_handle(&mut self) -> &mut Frontend {
&mut self.vu &mut self.vu
} }

View File

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
libc = "0.2.147" libc = "0.2.147"
vm-memory = "0.12.2" vm-memory = "0.13.1"
[target.'cfg(target_arch = "aarch64")'.dependencies] [target.'cfg(target_arch = "aarch64")'.dependencies]
arch = { path = "../arch" } arch = { path = "../arch" }

View File

@ -15,6 +15,5 @@ hypervisor = { path = "../hypervisor" }
thiserror = "1.0.40" thiserror = "1.0.40"
serde = { version = "1.0.168", features = ["rc", "derive"] } serde = { version = "1.0.168", features = ["rc", "derive"] }
vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false } vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false }
vm-memory = { version = "0.12.2", features = ["backend-mmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap"] }
vmm-sys-util = "0.11.0" vmm-sys-util = "0.11.0"

View File

@ -11,4 +11,4 @@ serde = { version = "1.0.168", features = ["rc", "derive"] }
serde_json = "1.0.107" serde_json = "1.0.107"
versionize = "0.1.10" versionize = "0.1.10"
versionize_derive = "0.1.4" versionize_derive = "0.1.4"
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic"] }

View File

@ -9,5 +9,5 @@ default = []
[dependencies] [dependencies]
log = "0.4.17" log = "0.4.17"
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }

View File

@ -34,7 +34,7 @@ gdbstub = { version = "0.6.4", optional = true }
gdbstub_arch = { version = "0.2.4", optional = true } gdbstub_arch = { version = "0.2.4", optional = true }
hypervisor = { path = "../hypervisor" } hypervisor = { path = "../hypervisor" }
libc = "0.2.147" libc = "0.2.147"
linux-loader = { version = "0.9.1", features = ["elf", "bzimage", "pe"] } linux-loader = { version = "0.10.0", features = ["elf", "bzimage", "pe"] }
log = "0.4.17" log = "0.4.17"
micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" } micro_http = { git = "https://github.com/firecracker-microvm/micro-http", branch = "main" }
net_util = { path = "../net_util" } net_util = { path = "../net_util" }
@ -54,10 +54,10 @@ versionize_derive = "0.1.4"
vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false } vfio-ioctls = { git = "https://github.com/rust-vmm/vfio", branch = "main", default-features = false }
vfio_user = { git = "https://github.com/rust-vmm/vfio-user", branch = "main" } vfio_user = { git = "https://github.com/rust-vmm/vfio-user", branch = "main" }
virtio-devices = { path = "../virtio-devices" } virtio-devices = { path = "../virtio-devices" }
virtio-queue = "0.9.0" virtio-queue = "0.10.0"
vm-allocator = { path = "../vm-allocator" } vm-allocator = { path = "../vm-allocator" }
vm-device = { path = "../vm-device" } vm-device = { path = "../vm-device" }
vm-memory = { version = "0.12.2", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } vm-memory = { version = "0.13.1", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] }
vm-migration = { path = "../vm-migration" } vm-migration = { path = "../vm-migration" }
vm-virtio = { path = "../vm-virtio" } vm-virtio = { path = "../vm-virtio" }
vmm-sys-util = { version = "0.11.0", features = ["with-serde"] } vmm-sys-util = { version = "0.11.0", features = ["with-serde"] }