exit_reason.bus_lock_detected is not only set when bus lock VM exit
was preempted, in fact, this bit is always set if bus locks are
detected no matter what the exit_reason.basic is.
So the bus_lock_vmexit handling in vmx_handle_exit should be duplicated
when exit_reason.basic is EXIT_REASON_BUS_LOCK(74). We can avoid it by
checking if bus lock vmexit was preempted in vmx_handle_exit.
Signed-off-by: Hao Xiang <hao.xiang@xxxxxxxxxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 0c2c0d5..5ddf1df 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6054,7 +6054,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
* still need to exit to user space when bus lock detected to inform
* that there is a bus lock in guest.
*/
- if (to_vmx(vcpu)->exit_reason.bus_lock_detected) {
+ if (to_vmx(vcpu)->exit_reason.bus_lock_detected &&
+ to_vmx(vcpu)->exit_reason.basic != EXIT_REASON_BUS_LOCK) {
if (ret > 0)
vcpu->run->exit_reason = KVM_EXIT_X86_BUS_LOCK;