mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices, vmm: Always restore virtio devices in paused state
Following the new restore design, it is not appropriate to set every virtio device threads into a paused state after they've been started. This is why we remove the line of code pausing the devices only after they've been restored, and replace it with a small patch in every virtio device implementation. When a virtio device is created as part of a restored VM, the associated "paused" boolean is set to true. This ensures the corresponding thread will be directly parked when being started, avoiding the thread to be in a different state than the one it was on the source VM during the snapshot. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -628,13 +628,15 @@ impl Console {
|
||||
exit_evt: EventFd,
|
||||
state: Option<ConsoleState>,
|
||||
) -> io::Result<(Console, Arc<ConsoleResizer>)> {
|
||||
let (avail_features, acked_features, config, in_buffer) = if let Some(state) = state {
|
||||
let (avail_features, acked_features, config, in_buffer, paused) = if let Some(state) = state
|
||||
{
|
||||
info!("Restoring virtio-console {}", id);
|
||||
(
|
||||
state.avail_features,
|
||||
state.acked_features,
|
||||
state.config,
|
||||
state.in_buffer.into(),
|
||||
true,
|
||||
)
|
||||
} else {
|
||||
let mut avail_features = 1u64 << VIRTIO_F_VERSION_1 | 1u64 << VIRTIO_CONSOLE_F_SIZE;
|
||||
@@ -647,6 +649,7 @@ impl Console {
|
||||
0,
|
||||
VirtioConsoleConfig::default(),
|
||||
VecDeque::new(),
|
||||
false,
|
||||
)
|
||||
};
|
||||
|
||||
@@ -670,6 +673,7 @@ impl Console {
|
||||
acked_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
min_queues: NUM_QUEUES as u16,
|
||||
paused: Arc::new(AtomicBool::new(paused)),
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user