mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-27 11:22:17 +00:00
hv: remove Service VM delayed loading
Now multiboot modules memory is already reserved from e820 in function `alloc_mods_memory()` and Service VM will not corrupt pre-launched VM modules. So remove the code of Service VM delayed loading. Tracked-On: #8652 Signed-off-by: Haiwei Li <haiwei.li@intel.com>
This commit is contained in:
parent
44a603a579
commit
c4ea248bc9
@ -1087,7 +1087,6 @@ void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec)
|
||||
start_vm(vm);
|
||||
}
|
||||
|
||||
static uint8_t loaded_pre_vm_nr = 0U;
|
||||
/**
|
||||
* Prepare to create vm/vcpu for vm
|
||||
*
|
||||
@ -1095,7 +1094,7 @@ static uint8_t loaded_pre_vm_nr = 0U;
|
||||
*/
|
||||
int32_t prepare_vm(uint16_t vm_id, struct acrn_vm_config *vm_config)
|
||||
{
|
||||
int32_t err = 0;
|
||||
int32_t err = -1;
|
||||
struct acrn_vm *vm = NULL;
|
||||
|
||||
#ifdef CONFIG_SECURITY_VM_FIXUP
|
||||
@ -1103,41 +1102,15 @@ int32_t prepare_vm(uint16_t vm_id, struct acrn_vm_config *vm_config)
|
||||
#endif
|
||||
if (get_vmid_by_name(vm_config->name) != vm_id) {
|
||||
pr_err("Invalid VM name: %s", vm_config->name);
|
||||
err = -1;
|
||||
} else {
|
||||
/* Service VM and pre-launched VMs launch on all pCPUs defined in vm_config->cpu_affinity */
|
||||
err = create_vm(vm_id, vm_config->cpu_affinity, vm_config, &vm);
|
||||
}
|
||||
|
||||
if (err == 0) {
|
||||
if (is_prelaunched_vm(vm)) {
|
||||
build_vrsdp(vm);
|
||||
}
|
||||
|
||||
if (is_service_vm(vm)) {
|
||||
/* We need to ensure all modules of pre-launched VMs have been loaded already
|
||||
* before loading Service VM modules, otherwise the module of pre-launched VMs could
|
||||
* be corrupted because Service VM kernel might pick any usable RAM to extract kernel
|
||||
* when KASLR enabled.
|
||||
* In case the pre-launched VMs aren't loaded successfuly that cause deadlock here,
|
||||
* use a 10000ms timer to break the waiting loop.
|
||||
*/
|
||||
uint64_t start_tick = cpu_ticks();
|
||||
|
||||
while (loaded_pre_vm_nr != PRE_VM_NUM) {
|
||||
uint64_t timeout = ticks_to_ms(cpu_ticks() - start_tick);
|
||||
|
||||
if (timeout > 10000U) {
|
||||
pr_err("Loading pre-launched VMs timeout!");
|
||||
break;
|
||||
}
|
||||
if (err == 0) {
|
||||
if (is_prelaunched_vm(vm)) {
|
||||
build_vrsdp(vm);
|
||||
}
|
||||
}
|
||||
|
||||
err = prepare_os_image(vm);
|
||||
|
||||
if (is_prelaunched_vm(vm)) {
|
||||
loaded_pre_vm_nr++;
|
||||
err = prepare_os_image(vm);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user