hv: vcpu: operation in vcpu_create don't need to be atomic

For pre-launched VMs and SOS, vCPUs are created on BSP one by one; For post-launched VMs,
vCPUs are created under vmm_hypercall_lock protection. So vcpu_create is called sequentially.
Operation in vcpu_create don't need to be atomic.

Tracked-On: #1842
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1 2019-07-15 19:26:15 +08:00 committed by ACRN System Integration
parent 540841ac5d
commit 8af334cbb2
1 changed files with 2 additions and 2 deletions

View File

@ -362,7 +362,7 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
* vcpu->vcpu_id = vm->hw.created_vcpus;
* vm->hw.created_vcpus++;
*/
vcpu_id = atomic_xadd16(&vm->hw.created_vcpus, 1U);
vcpu_id = vm->hw.created_vcpus;
if (vcpu_id < CONFIG_MAX_VCPUS_PER_VM) {
/* Allocate memory for VCPU */
vcpu = &(vm->hw.vcpu_array[vcpu_id]);
@ -422,9 +422,9 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
reset_vcpu_regs(vcpu);
(void)memset((void *)&vcpu->req, 0U, sizeof(struct io_request));
vm->hw.created_vcpus++;
ret = 0;
} else {
vm->hw.created_vcpus -= 1U;
pr_err("%s, vcpu id is invalid!\n", __func__);
ret = -EINVAL;
}