mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: refactor vCPU save/restore code in restoring VM
Similarly as the VM booting process, on AArch64 systems, the vCPUs should be created before the creation of GIC. This commit refactors the vCPU save/restore code to achieve the above-mentioned restoring order. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
+19
-10
@@ -1513,6 +1513,17 @@ impl Snapshottable for Vm {
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(cpu_manager_snapshot) = snapshot.snapshots.get(CPU_MANAGER_SNAPSHOT_ID) {
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.restore(*cpu_manager_snapshot.clone())?;
|
||||
} else {
|
||||
return Err(MigratableError::Restore(anyhow!(
|
||||
"Missing CPU manager snapshot"
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(device_manager_snapshot) = snapshot.snapshots.get(DEVICE_MANAGER_SNAPSHOT_ID) {
|
||||
self.device_manager
|
||||
.lock()
|
||||
@@ -1524,16 +1535,14 @@ impl Snapshottable for Vm {
|
||||
)));
|
||||
}
|
||||
|
||||
if let Some(cpu_manager_snapshot) = snapshot.snapshots.get(CPU_MANAGER_SNAPSHOT_ID) {
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.restore(*cpu_manager_snapshot.clone())?;
|
||||
} else {
|
||||
return Err(MigratableError::Restore(anyhow!(
|
||||
"Missing CPU manager snapshot"
|
||||
)));
|
||||
}
|
||||
// Now we can start all vCPUs from here.
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.start_restored_vcpus()
|
||||
.map_err(|e| {
|
||||
MigratableError::Restore(anyhow!("Cannot start restored vCPUs: {:#?}", e))
|
||||
})?;
|
||||
|
||||
if self
|
||||
.device_manager
|
||||
|
||||
Reference in New Issue
Block a user