linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Marc Haber <mh+linux-kernel@zugschlus.de>
Cc: Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org, kvm ML <kvm@vger.kernel.org>
Subject: Re: Major KVM issues with kernel 4.5 on the host
Date: Wed, 13 Apr 2016 22:36:34 +0200	[thread overview]
Message-ID: <570EADD2.8030300@redhat.com> (raw)
In-Reply-To: <20160413183701.GC7600@torres.zugschlus.de>



On 13/04/2016 20:37, Marc Haber wrote:
> On Fri, Mar 18, 2016 at 11:01:46AM +0100, Paolo Bonzini wrote:
>> On 17/03/2016 19:11, Borislav Petkov wrote:
>>> I'm going to try reproducing the issue on a less "important" machine
>>> so that bisecting is less painful, but maybe you guys have an idea
>>> what's going wrong here.
>>
>> No idea, sorry. :(  Bisecting would be great.
> 
> Working on that now.
> 
>>   I'll also try reproducing and bisecting next week, in the meanwhile
>>   just having the host dmesg would help a lot.
> 
> Attached. I hope the message will get through to the list.

Didn't help, but a fresh look at the list of 4.5 patches helped.
What the hell was I thinking, I missed write_rdtscp_aux who
obviously uses MSR_TSC_AUX.

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 31346a3f20a5..1481dea15844 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -39,6 +39,7 @@
 #include <asm/kvm_para.h>
 
 #include <asm/virtext.h>
+#include <asm/vgtod.h>
 #include "trace.h"
 
 #define __ex(x) __kvm_handle_fault_on_reboot(x)
@@ -1240,9 +1241,6 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 			wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio);
 		}
 	}
-	/* This assumes that the kernel never uses MSR_TSC_AUX */
-	if (static_cpu_has(X86_FEATURE_RDTSCP))
-		wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
 }
 
 static void svm_vcpu_put(struct kvm_vcpu *vcpu)
@@ -3847,6 +3845,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 	svm->vmcb->save.cr2 = vcpu->arch.cr2;
 
 	clgi();
+	if (static_cpu_has(X86_FEATURE_RDTSCP))
+		wrmsrl(MSR_TSC_AUX, svm->tsc_aux);
 
 	local_irq_enable();
 
@@ -3923,6 +3923,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 #endif
 		);
 
+	if (static_cpu_has(X86_FEATURE_RDTSCP))
+		wrmsrl(MSR_TSC_AUX, __getcpu());
 #ifdef CONFIG_X86_64
 	wrmsrl(MSR_GS_BASE, svm->host.gs_base);
 #else


Paolo

  reply	other threads:[~2016-04-13 20:36 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 16:54 Major KVM issues with kernel 4.5 on the host Marc Haber
2016-03-17 18:11 ` Borislav Petkov
2016-03-18 10:01   ` Paolo Bonzini
2016-04-13 18:37     ` Marc Haber
2016-04-13 20:36       ` Paolo Bonzini [this message]
2016-04-13 20:52         ` Marc Haber
2016-04-13 22:29         ` Marc Haber
2016-04-14  1:16           ` Paolo Bonzini
2016-04-14  5:22             ` Marc Haber
2016-04-21  8:39               ` Marc Haber
2016-04-21 12:37                 ` Borislav Petkov
2016-04-21 14:50                   ` Marc Haber
2016-04-21 16:51                     ` Borislav Petkov
2016-04-21 20:04                       ` Marc Haber
2016-04-23 16:04                         ` Borislav Petkov
2016-04-23 18:43                           ` Marc Haber
2016-04-23 18:52                             ` Dr. David Alan Gilbert
2016-05-12 20:20                               ` transparent huge pages breaks KVM on AMD Marc Haber
2016-05-12 20:24                                 ` Kirill A. Shutemov
2016-05-12 20:34                                   ` Marc Haber
2016-05-12 20:42                                     ` Kirill A. Shutemov
2016-05-13  5:23                                       ` Marc Haber
2016-05-13  8:07                                         ` Borislav Petkov
2016-05-13  8:09                                           ` Borislav Petkov
2016-05-13 13:21                                             ` Marc Haber
2016-05-13 16:08                                               ` Borislav Petkov
2016-05-14  6:19                                             ` Marc Haber
2016-05-13  9:08                                           ` Marc Haber
2016-05-13  9:19                                             ` Borislav Petkov
2016-05-13 14:59                                           ` Marc Haber
2016-05-13  8:35                                 ` Dr. David Alan Gilbert
2016-05-13 14:03                                   ` Marc Haber
2016-04-23 23:57                             ` Major KVM issues with kernel 4.5 on the host Borislav Petkov
2016-04-14  6:07             ` Marc Haber
2016-04-14 16:47             ` Marc Haber
2016-04-14 17:30               ` Paolo Bonzini
2016-04-14 17:47                 ` Marc Haber
2016-03-18 18:49   ` Marc Haber
2016-03-18 22:04     ` Borislav Petkov
2016-03-19  0:08       ` Marc Haber
2016-03-20 13:31         ` Borislav Petkov
2016-03-20 17:14           ` Andrey Korolyov
2016-03-20 18:25             ` Borislav Petkov
2016-03-20 18:42               ` Andrey Korolyov
2016-03-20 18:58                 ` Borislav Petkov
2016-04-13 18:22                   ` Marc Haber
2016-04-13 20:37                     ` Paolo Bonzini
2016-04-13 18:20           ` Marc Haber
2016-03-21  9:08         ` Paolo Bonzini

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=570EADD2.8030300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mh+linux-kernel@zugschlus.de \
    /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;
as well as URLs for NNTP newsgroup(s).