virtio-devices: pci: Improve debugging for activation barriers

On the CI we are seeing issues with the activation barriers not being released:

cloud-hypervisor: 12.452434193s: INFO:vmm/src/vm.rs:413 -- Waiting for barrier
cloud-hypervisor: 12.452499794s: INFO:virtio-devices/src/block.rs:382 -- Changing cache mode to writeback
cloud-hypervisor: 12.452605195s: INFO:vmm/src/vm.rs:413 -- Waiting for barrier
cloud-hypervisor: 12.452684596s: INFO:virtio-devices/src/transport/pci_device.rs:671 -- Waiting for barrier
cloud-hypervisor: 12.452708196s: INFO:virtio-devices/src/transport/pci_device.rs:673 -- Barrier released
cloud-hypervisor: 12.452717596s: INFO:vmm/src/vm.rs:415 -- Barrier released

Add some debugging to try and identify the vause of this issue.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-12-16 18:00:48 +00:00
parent ee537d9bde
commit e8c72b1b01

View File

@ -30,8 +30,8 @@ use std::cmp;
use std::io::Write;
use std::num::Wrapping;
use std::result;
use std::sync::atomic::{AtomicU16, AtomicUsize, Ordering};
use std::sync::{atomic::AtomicBool, Arc, Barrier, Mutex};
use std::sync::atomic::{AtomicBool, AtomicU16, AtomicUsize, Ordering};
use std::sync::{Arc, Barrier, Mutex};
use vm_allocator::SystemAllocator;
use vm_device::interrupt::{
InterruptIndex, InterruptManager, InterruptSourceGroup, MsiIrqGroupConfig,
@ -668,9 +668,9 @@ impl VirtioPciDevice {
)
.expect("Failed to activate device");
self.device_activated.store(true, Ordering::SeqCst);
info!("Waiting for barrier");
info!("{}: Waiting for barrier", self.id);
self.activate_barrier.wait();
info!("Barrier released");
info!("{}: Barrier released", self.id);
}
}
}
@ -1018,6 +1018,7 @@ impl PciDevice for VirtioPciDevice {
// Try and activate the device if the driver status has changed
if self.needs_activation() {
info!("{}: Needs activation; returning barrier", self.id);
self.activate_evt.write(1).ok();
return Some(self.activate_barrier.clone());
}