mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: restore KVM clock before resuming vCPUs
Reorder resume() to: set_clock, device_manager.resume, cpu_manager.resume. This matches the inverse of pause() which correctly saves the clock before pausing vCPUs. Signed-off-by: CMGS <ilskdw@gmail.com>
This commit is contained in:
+3
-1
@@ -3111,7 +3111,8 @@ impl Pausable for Vm {
|
|||||||
.valid_transition(new_state)
|
.valid_transition(new_state)
|
||||||
.map_err(|e| MigratableError::Resume(anyhow!("Invalid transition: {e:?}")))?;
|
.map_err(|e| MigratableError::Resume(anyhow!("Invalid transition: {e:?}")))?;
|
||||||
|
|
||||||
self.cpu_manager.lock().unwrap().resume()?;
|
// Restore KVM clock BEFORE vCPUs start running, so they see correct
|
||||||
|
// TSC/kvmclock from the first instruction after resume.
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
{
|
{
|
||||||
if let Some(clock) = &self.saved_clock {
|
if let Some(clock) = &self.saved_clock {
|
||||||
@@ -3128,6 +3129,7 @@ impl Pausable for Vm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.device_manager.lock().unwrap().resume()?;
|
self.device_manager.lock().unwrap().resume()?;
|
||||||
|
self.cpu_manager.lock().unwrap().resume()?;
|
||||||
|
|
||||||
// And we're back to the Running state.
|
// And we're back to the Running state.
|
||||||
self.state = new_state;
|
self.state = new_state;
|
||||||
|
|||||||
Reference in New Issue
Block a user