mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Use a weak reference to the AddressManager
Storing a strong reference to the AddressManager behind the DeviceRelocation trait results in a cyclic reference count. Use a weak reference to break that dependency. Signed-off-by: Rob Bradford <robert.bradford@intel.com> Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
149b61b213
commit
3e819ac797
@@ -34,6 +34,8 @@ use std::os::unix::fs::OpenOptionsExt;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::ptr::null_mut;
|
||||
use std::result;
|
||||
#[cfg(feature = "pci_support")]
|
||||
use std::sync::Weak;
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
#[cfg(feature = "pci_support")]
|
||||
use vfio::{VfioDevice, VfioDmaMapping, VfioPciDevice, VfioPciError};
|
||||
@@ -536,7 +538,10 @@ impl DeviceManager {
|
||||
#[cfg(feature = "pci_support")]
|
||||
{
|
||||
let pci_root = PciRoot::new(None);
|
||||
let mut pci_bus = PciBus::new(pci_root, address_manager.clone());
|
||||
let mut pci_bus = PciBus::new(
|
||||
pci_root,
|
||||
Arc::downgrade(&address_manager) as Weak<dyn DeviceRelocation>,
|
||||
);
|
||||
|
||||
let (mut iommu_device, iommu_mapping) = if vm_info.vm_cfg.iommu {
|
||||
let (device, mapping) =
|
||||
|
||||
Reference in New Issue
Block a user