mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hao Xiang <hao.xiang@linux.alibaba.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, chenyi.qiang@intel.com,
	pbonzini@redhat.com, sean.j.christopherson@intel.com,
	shannon.zhao@linux.alibaba.com,
	Hao Xiang <hao.xiang@linux.alibaba.com>
Subject: [PATCH] KVM: VMX: Check if bus lock vmexit was preempted
Date: Sat, 18 Sep 2021 19:30:00 +0800	[thread overview]
Message-ID: <1631964600-73707-1-git-send-email-hao.xiang@linux.alibaba.com> (raw)

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@linux.alibaba.com>
---
 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;
 
-- 
1.8.3.1


             reply	other threads:[~2021-09-18 11:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18 11:30 Hao Xiang [this message]
2021-09-22 10:02 ` Paolo Bonzini
2021-09-22 10:32   ` Xiaoyao Li
2021-09-22 12:40     ` Paolo Bonzini
2021-09-23  0:59       ` Hao Xiang
2021-09-23  6:37         ` Paolo Bonzini
2021-09-22 14:58     ` Sean Christopherson
2021-09-23  7:15       ` Hao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1631964600-73707-1-git-send-email-hao.xiang@linux.alibaba.com \
    --to=hao.xiang@linux.alibaba.com \
    --cc=chenyi.qiang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=shannon.zhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®