Merge pull request #5950 from openanolis/upcall_fea

runtime-rs: add dbs-upcall feature
This commit is contained in:
Bin Liu 2023-01-04 16:20:40 +08:00 committed by GitHub
commit e2c7e5f172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 1 deletions

View File

@ -492,6 +492,13 @@ impl Vm {
.map_err(StopMicrovmError::DeviceManager) .map_err(StopMicrovmError::DeviceManager)
} }
/// Remove upcall client when the VM is destoryed.
#[cfg(feature = "dbs-upcall")]
pub fn remove_upcall(&mut self) -> std::result::Result<(), StopMicrovmError> {
self.upcall_client = None;
Ok(())
}
/// Reset the console into canonical mode. /// Reset the console into canonical mode.
pub fn reset_console(&self) -> std::result::Result<(), DeviceMgrError> { pub fn reset_console(&self) -> std::result::Result<(), DeviceMgrError> {
self.device_manager.reset_console() self.device_manager.reset_console()

View File

@ -162,6 +162,11 @@ impl Vmm {
warn!("failed to remove devices: {:?}", e); warn!("failed to remove devices: {:?}", e);
} }
#[cfg(feature = "dbs-upcall")]
if let Err(e) = vm.remove_upcall() {
warn!("failed to remove upcall: {:?}", e);
}
if let Err(e) = vm.reset_console() { if let Err(e) = vm.reset_console() {
warn!("Cannot set canonical mode for the terminal. {:?}", e); warn!("Cannot set canonical mode for the terminal. {:?}", e);
} }
@ -174,6 +179,8 @@ impl Vmm {
if let Err(e) = mgr.exit_all_vcpus() { if let Err(e) = mgr.exit_all_vcpus() {
warn!("Failed to exit vcpu thread. {:?}", e); warn!("Failed to exit vcpu thread. {:?}", e);
} }
#[cfg(feature = "dbs-upcall")]
mgr.set_upcall_channel(None);
} }
Err(e) => warn!("Failed to get vcpu manager {:?}", e), Err(e) => warn!("Failed to get vcpu manager {:?}", e),
} }

View File

@ -661,6 +661,20 @@ dependencies = [
"mio", "mio",
] ]
[[package]]
name = "dbs-upcall"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2fa8b67657cd71779eaceea1b5fa989b62a1be629a07be8498417772e5a8d35"
dependencies = [
"anyhow",
"dbs-utils",
"dbs-virtio-devices",
"log",
"thiserror",
"timerfd",
]
[[package]] [[package]]
name = "dbs-utils" name = "dbs-utils"
version = "0.2.1" version = "0.2.1"
@ -753,6 +767,7 @@ dependencies = [
"dbs-device", "dbs-device",
"dbs-interrupt", "dbs-interrupt",
"dbs-legacy-devices", "dbs-legacy-devices",
"dbs-upcall",
"dbs-utils", "dbs-utils",
"dbs-virtio-devices", "dbs-virtio-devices",
"kvm-bindings", "kvm-bindings",

View File

@ -30,6 +30,6 @@ kata-types = { path = "../../../libs/kata-types" }
logging = { path = "../../../libs/logging" } logging = { path = "../../../libs/logging" }
shim-interface = { path = "../../../libs/shim-interface" } shim-interface = { path = "../../../libs/shim-interface" }
dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs"] } dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs","dbs-upcall"] }
[features] [features]