mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 20:22:46 +00:00
hv: Serialize WBINVD using wbinvd_lock
As mentioned in previous patch, wbinvd utilizes the vcpu_make_request and signal_event call pair to stall other vcpus. Due to the fact that these two calls are not thread-safe, we need to avoid concurrent call to this API pair. This patch adds wbinvd lock to serialize wbinvd emulation. Tracked-On: #7887 Signed-off-by: Yifan Liu <yifan1.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
745e70fb06
commit
05460f151a
@ -438,6 +438,7 @@ static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
if (is_rt_vm(vcpu->vm)) {
|
||||
walk_ept_table(vcpu->vm, ept_flush_leaf_page);
|
||||
} else {
|
||||
spinlock_obtain(&vcpu->vm->wbinvd_lock);
|
||||
/* Pause other vcpus and let them wait for the wbinvd completion */
|
||||
foreach_vcpu(i, vcpu->vm, other) {
|
||||
if (other != vcpu) {
|
||||
@ -452,6 +453,7 @@ static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
signal_event(&other->events[VCPU_EVENT_SYNC_WBINVD]);
|
||||
}
|
||||
}
|
||||
spinlock_release(&vcpu->vm->wbinvd_lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,7 @@ struct acrn_vm {
|
||||
* the initialization depends on the clear BSS section
|
||||
*/
|
||||
spinlock_t vm_state_lock;
|
||||
spinlock_t wbinvd_lock; /* Spin-lock used to serialize wbinvd emulation */
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user