public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joerg.roedel@amd.com>, <stable@kernel.org>
Subject: [PATCH 1/2] KVM: SVM: Fix NMI path when NMI happens in guest mode
Date: Thu, 13 Jan 2011 16:22:57 +0100	[thread overview]
Message-ID: <1294932178-26866-2-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1294932178-26866-1-git-send-email-joerg.roedel@amd.com>

The vmexit path on SVM needs to restore the KERNEL_GS_BASE
MSR in order to savely execute the NMI handler. Otherwise a
pending NMI can occur after the STGI instruction and crash
the machine.
This makes it impossible to run perf and kvm in parallel on
an AMD machine in a stable way.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kvm/svm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 25bd1bc..8b9bc72 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3637,6 +3637,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 
 #ifdef CONFIG_X86_64
 	wrmsrl(MSR_GS_BASE, svm->host.gs_base);
+	wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
 #else
 	loadsegment(fs, svm->host.fs);
 #endif
-- 
1.7.1



  reply	other threads:[~2011-01-13 15:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 15:22 [PATCH 0/2] perf-kvm support for SVM Joerg Roedel
2011-01-13 15:22 ` Joerg Roedel [this message]
2011-01-13 15:42   ` [PATCH 1/2] KVM: SVM: Fix NMI path when NMI happens in guest mode Avi Kivity
2011-01-13 15:51     ` Roedel, Joerg
2011-01-13 19:27       ` Avi Kivity
2011-01-14 13:36         ` Roedel, Joerg
2011-01-13 15:48   ` Jan Kiszka
2011-01-13 15:52     ` Roedel, Joerg
2011-01-13 15:22 ` [PATCH 2/2] KVM: SVM: Add support for perf-kvm Joerg Roedel

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=1294932178-26866-2-git-send-email-joerg.roedel@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=stable@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