mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 08:21:15 +00:00
vmm: cpu: Create vCPUs before the DeviceManager
Moving the creation of the vCPUs before the DeviceManager gets created will allow for the aarch64 vGIC to be created before the DeviceManager as well in a follow up patch. The end goal being to adopt the same creation sequence for both x86_64 and aarch64, and keeping in mind that the vGIC requires every vCPU to be created. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
578780ed0c
commit
86e7f07485
@ -2082,10 +2082,9 @@ impl Snapshottable for CpuManager {
|
|||||||
|
|
||||||
fn restore(&mut self, snapshot: Snapshot) -> std::result::Result<(), MigratableError> {
|
fn restore(&mut self, snapshot: Snapshot) -> std::result::Result<(), MigratableError> {
|
||||||
for (cpu_id, snapshot) in snapshot.snapshots.iter() {
|
for (cpu_id, snapshot) in snapshot.snapshots.iter() {
|
||||||
|
let cpu_id = cpu_id.parse::<usize>().unwrap();
|
||||||
info!("Restoring VCPU {}", cpu_id);
|
info!("Restoring VCPU {}", cpu_id);
|
||||||
let vcpu = self
|
let vcpu = self.vcpus[cpu_id].clone();
|
||||||
.create_vcpu(cpu_id.parse::<u8>().unwrap())
|
|
||||||
.map_err(|e| MigratableError::Restore(anyhow!("Could not create vCPU {:?}", e)))?;
|
|
||||||
self.configure_vcpu(vcpu, None, Some(*snapshot.clone()))
|
self.configure_vcpu(vcpu, None, Some(*snapshot.clone()))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
MigratableError::Restore(anyhow!("Could not configure vCPU {:?}", e))
|
MigratableError::Restore(anyhow!("Could not configure vCPU {:?}", e))
|
||||||
|
@ -538,6 +538,12 @@ impl Vm {
|
|||||||
)
|
)
|
||||||
.map_err(Error::CpuManager)?;
|
.map_err(Error::CpuManager)?;
|
||||||
|
|
||||||
|
cpu_manager
|
||||||
|
.lock()
|
||||||
|
.unwrap()
|
||||||
|
.create_boot_vcpus()
|
||||||
|
.map_err(Error::CpuManager)?;
|
||||||
|
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
let dynamic = !tdx_enabled;
|
let dynamic = !tdx_enabled;
|
||||||
#[cfg(not(feature = "tdx"))]
|
#[cfg(not(feature = "tdx"))]
|
||||||
|
Loading…
Reference in New Issue
Block a user