vmm: Break the cyclic dependency between DeviceManager and IO bus

By inserting the DeviceManager on the IO bus, we introduced some cyclic
dependency:

  DeviceManager ---> AddressManager ---> Bus ---> BusDevice
        ^                                             |
        |                                             |
        +---------------------------------------------+

This cycle needs to be broken by inserting a Weak reference instead of
an Arc (considered as a strong reference).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-02-28 18:11:34 +01:00
committed by Rob Bradford
parent c1af13efeb
commit d47f733e51
3 changed files with 34 additions and 12 deletions
+1 -1
View File
@@ -507,7 +507,7 @@ impl CpuManager {
let cpu_manager = Arc::new(Mutex::new(CpuManager {
boot_vcpus,
max_vcpus,
io_bus: Arc::downgrade(&device_manager.io_bus().clone()),
io_bus: Arc::downgrade(&device_manager.io_bus()),
mmio_bus: device_manager.mmio_bus().clone(),
ioapic: device_manager.ioapic().clone(),
vm_memory: guest_memory,