mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: cleanup &Mutex parameters
In [0] we refactored some Arc<Mutex<T>> parameters to &Mutex<T>> to satisfy clippy's needless_pass_by_value lint. Nevertheless, this is also not so idiomatic, so as a follow-up, we put the responsibility to lock objects to the caller side (only where this is not strictly needed by the callee). While on it, I also tried to pass vm_config directly into pre_create_console_devices() which would clean up some code, but then we have interleaving mutable and immutable borrows of the Vmm, which are denied by the borrow checker. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
4592f37bcf
commit
6bda6541be
+3
-4
@@ -2390,16 +2390,15 @@ impl Vm {
|
||||
for vcpu in vcpus {
|
||||
let guest_memory = &self.memory_manager.lock().as_ref().unwrap().guest_memory();
|
||||
let boot_setup = entry_point.map(|e| (e, guest_memory));
|
||||
let mut vcpu = vcpu.lock().unwrap();
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.configure_vcpu(&vcpu, boot_setup)
|
||||
.configure_vcpu(&mut vcpu, boot_setup)
|
||||
.map_err(Error::CpuManager)?;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
vcpu.lock()
|
||||
.unwrap()
|
||||
.set_gic_redistributor_addr(redist_addr[2], redist_addr[3])
|
||||
vcpu.set_gic_redistributor_addr(redist_addr[2], redist_addr[3])
|
||||
.map_err(Error::CpuManager)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user