From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S948224AbcKAHRo (ORCPT ); Tue, 1 Nov 2016 03:17:44 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45868 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1167803AbcKAHR2 (ORCPT ); Tue, 1 Nov 2016 03:17:28 -0400 Date: Tue, 1 Nov 2016 00:15:19 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: luto@kernel.org, bp@alien8.de, fenghua.yu@intel.com, oleg@redhat.com, peterz@infradead.org, dave.hansen@linux.intel.com, quentin.casasnovas@oracle.com, dvlasenk@redhat.com, kvm@vger.kernel.org, pbonzini@redhat.com, torvalds@linux-foundation.org, brgerst@gmail.com, mingo@kernel.org, linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, jpoimboe@redhat.com, tglx@linutronix.de, riel@redhat.com, hpa@zytor.com Reply-To: dave.hansen@linux.intel.com, peterz@infradead.org, quentin.casasnovas@oracle.com, dvlasenk@redhat.com, luto@kernel.org, bp@alien8.de, fenghua.yu@intel.com, oleg@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, rusty@rustcorp.com.au, tglx@linutronix.de, hpa@zytor.com, riel@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org, brgerst@gmail.com, torvalds@linux-foundation.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu, kvm: Remove host CR0.TS manipulation Git-Commit-ID: 04ac88abaf758bd76edcc3be5549003a017e7963 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 04ac88abaf758bd76edcc3be5549003a017e7963 Gitweb: http://git.kernel.org/tip/04ac88abaf758bd76edcc3be5549003a017e7963 Author: Andy Lutomirski AuthorDate: Mon, 31 Oct 2016 15:18:45 -0700 Committer: Ingo Molnar CommitDate: Tue, 1 Nov 2016 07:47:54 +0100 x86/fpu, kvm: Remove host CR0.TS manipulation Now that x86 always uses eager FPU switching on the host, there's no need for KVM to manipulate the host's CR0.TS. This should be both simpler and faster. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Quentin Casasnovas Cc: Rik van Riel Cc: Rusty Russell Cc: Thomas Gleixner Cc: kvm list Link: http://lkml.kernel.org/r/b212064922537c05d0c81d931fc4dbe769127ce7.1477951965.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kvm/vmx.c | 12 ++++-------- arch/x86/kvm/x86.c | 5 ----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index cf1b16d..531c446 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2144,12 +2144,6 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) #endif if (vmx->host_state.msr_host_bndcfgs) wrmsrl(MSR_IA32_BNDCFGS, vmx->host_state.msr_host_bndcfgs); - /* - * If the FPU is not active (through the host task or - * the guest vcpu), then restore the cr0.TS bit. - */ - if (!fpregs_active() && !vmx->vcpu.guest_fpu_loaded) - stts(); load_gdt(this_cpu_ptr(&host_gdt)); } @@ -4871,9 +4865,11 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx) u32 low32, high32; unsigned long tmpl; struct desc_ptr dt; - unsigned long cr4; + unsigned long cr0, cr4; - vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */ + cr0 = read_cr0(); + WARN_ON(cr0 & X86_CR0_TS); + vmcs_writel(HOST_CR0, cr0); /* 22.2.3 */ vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ /* Save the most likely value for this task's CR4 in the VMCS. */ diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7f9fa2d..cfe6a75b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5060,11 +5060,6 @@ static void emulator_get_fpu(struct x86_emulate_ctxt *ctxt) { preempt_disable(); kvm_load_guest_fpu(emul_to_vcpu(ctxt)); - /* - * CR0.TS may reference the host fpu state, not the guest fpu state, - * so it may be clear at this point. - */ - clts(); } static void emulator_put_fpu(struct x86_emulate_ctxt *ctxt)