mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Acknowledge a device being paused
Using the Rust Barrier mechanism, this patch forces each virtio device to acknowledge they've been correctly paused before going further. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -205,6 +205,13 @@ macro_rules! virtio_pausable_trait_inner {
|
||||
pause_evt
|
||||
.write(1)
|
||||
.map_err(|e| MigratableError::Pause(e.into()))?;
|
||||
|
||||
// Wait for all threads to acknowledge the pause before going
|
||||
// any further. This is exclusively performed when pause_evt
|
||||
// eventfd is Some(), as this means the virtio device has been
|
||||
// activated. One specific case where the device can be paused
|
||||
// while it hasn't been yet activated is snapshot/restore.
|
||||
self.paused_sync.wait();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user