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:
Sebastien Boeuf
2020-08-11 16:05:06 +02:00
parent fd48779a0d
commit aa57762c4f
17 changed files with 162 additions and 54 deletions

View File

@@ -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(())