hv: using a dedicate lock

On the original WaaG, split-lock was rarely triggered by WaaG kernel.
We didn't find any problems when removing this patch. So this patch
was discarded in the final patch set merge.

Now, the latest Windows graphic driver will trigger lots of
split-lock very frequently. The test team reports this patch will
affect the stability.

Add this patch back to improve stability by using a dedicate lock.

Please note: This patch is only for release 2.5 test.

Tracked-On: #6051
Signed-off-by: Jie Deng <jie.deng@intel.com>
This commit is contained in:
Jie Deng 2021-03-11 23:30:35 +08:00 committed by wenlingz
parent 1e478fc6a9
commit 070385c4f6
3 changed files with 17 additions and 2 deletions

View File

@ -31,7 +31,7 @@ void vcpu_kick_splitlock_emulation(struct acrn_vcpu *cur_vcpu)
uint16_t i;
if (cur_vcpu->vm->hw.created_vcpus > 1U) {
get_vm_lock(cur_vcpu->vm);
get_split_lock(cur_vcpu->vm);
foreach_vcpu(i, cur_vcpu->vm, other) {
if (other != cur_vcpu) {
@ -53,7 +53,7 @@ void vcpu_complete_splitlock_emulation(struct acrn_vcpu *cur_vcpu)
}
}
put_vm_lock(cur_vcpu->vm);
put_split_lock(cur_vcpu->vm);
}
}

View File

@ -1088,3 +1088,13 @@ void put_vm_lock(struct acrn_vm *vm)
{
spinlock_release(&vm->vm_state_lock);
}
void get_split_lock(struct acrn_vm *vm)
{
spinlock_obtain(&vm->split_lock);
}
void put_split_lock(struct acrn_vm *vm)
{
spinlock_release(&vm->split_lock);
}

View File

@ -149,6 +149,7 @@ struct acrn_vm {
* the initialization depends on the clear BSS section
*/
spinlock_t vm_state_lock;
spinlock_t split_lock;
spinlock_t vlapic_mode_lock; /* Spin-lock used to protect vlapic_mode modifications for a VM */
spinlock_t ept_lock; /* Spin-lock used to protect ept add/modify/remove for a VM */
spinlock_t emul_mmio_lock; /* Used to protect emulation mmio_node concurrent access for a VM */
@ -274,6 +275,10 @@ void get_vm_lock(struct acrn_vm *vm);
void put_vm_lock(struct acrn_vm *vm);
void *get_sworld_memory_base(void);
void get_split_lock(struct acrn_vm *vm);
void put_split_lock(struct acrn_vm *vm);
#endif /* !ASSEMBLER */
#endif /* VM_H_ */