public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: kvm@vger.kernel.org
Cc: Jim Mattson <jmattson@google.com>
Subject: [PATCH v2] kvm: vmx: Properly handle machine check during VM-entry
Date: Fri, 19 May 2017 08:56:03 -0700	[thread overview]
Message-ID: <20170519155603.16076-1-jmattson@google.com> (raw)
In-Reply-To: <20170519133916.GB9960@potion>

When bit 31 of the exit reason is set to indicate a VM-entry failure,
only the exit reason and exit qualification fields are set. All other
VM-exit information fields, including "VM-exit interruption
information," are unmodified.

Fixes: 00eba012d53e6 ("KVM: VMX: Refactor vmx_complete_atomic_exit()")
Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/vmx.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c6f4ad44aa95..7c7ebefa8d15 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8614,17 +8614,19 @@ static void vmx_apicv_post_state_restore(struct kvm_vcpu *vcpu)
 
 static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
 {
-	u32 exit_intr_info;
+	u32 exit_intr_info = 0;
 
 	if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY
 	      || vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI))
 		return;
 
-	vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
-	exit_intr_info = vmx->exit_intr_info;
+	if (vmx->exit_reason != EXIT_REASON_MCE_DURING_VMENTRY)
+		exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
+	vmx->exit_intr_info = exit_intr_info;
 
 	/* Handle machine checks before interrupts are enabled */
-	if (is_machine_check(exit_intr_info))
+	if (vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY ||
+	    is_machine_check(exit_intr_info))
 		kvm_machine_check();
 
 	/* We need to handle NMIs before interrupts are enabled */
-- 
2.13.0.303.g4ebf302169-goog

  reply	other threads:[~2017-05-19 15:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 23:02 [PATCH] kvm: vmx: Properly handle machine check during VM-entry Jim Mattson
2017-05-19 13:39 ` David Hildenbrand
2017-05-19 13:39 ` Radim Krčmář
2017-05-19 15:56   ` Jim Mattson [this message]
2017-05-22  8:26 ` Xiao Guangrong
2017-05-22  9:06   ` Wanpeng Li
2017-05-22 15:14     ` Jim Mattson
2017-05-22 16:04   ` Jim Mattson
2017-05-22 16:48     ` [PATCH v3] " Jim Mattson
2017-05-23  2:20     ` [PATCH] " Xiao Guangrong
2017-05-25 16:17       ` Jim Mattson

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=20170519155603.16076-1-jmattson@google.com \
    --to=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    /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