Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534AbcJGJu6 (ORCPT ); Fri, 7 Oct 2016 05:50:58 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34240 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbcJGJuv (ORCPT ); Fri, 7 Oct 2016 05:50:51 -0400 Date: Fri, 7 Oct 2016 02:47:20 -0700 From: tip-bot for Rik van Riel Message-ID: Cc: riel@redhat.com, oleg@redhat.com, brgerst@gmail.com, hpa@zytor.com, peterz@infradead.org, quentin.casasnovas@oracle.com, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, jpoimboe@redhat.com, dvlasenk@redhat.com, dave.hansen@linux.intel.com, luto@kernel.org, bp@alien8.de, fenghua.yu@intel.com Reply-To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, dvlasenk@redhat.com, jpoimboe@redhat.com, bp@alien8.de, luto@kernel.org, fenghua.yu@intel.com, oleg@redhat.com, brgerst@gmail.com, riel@redhat.com, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, quentin.casasnovas@oracle.com In-Reply-To: <1475627678-20788-10-git-send-email-riel@redhat.com> References: <1475627678-20788-10-git-send-email-riel@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Split old & new FPU code paths Git-Commit-ID: 9ad93fe35aff616fca4e2b9581fdeed498605f9e 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 Content-Length: 2342 Lines: 70 Commit-ID: 9ad93fe35aff616fca4e2b9581fdeed498605f9e Gitweb: http://git.kernel.org/tip/9ad93fe35aff616fca4e2b9581fdeed498605f9e Author: Rik van Riel AuthorDate: Tue, 4 Oct 2016 20:34:38 -0400 Committer: Ingo Molnar CommitDate: Fri, 7 Oct 2016 11:14:43 +0200 x86/fpu: Split old & new FPU code paths Now that CR0.TS is no longer being manipulated, we can simplify switch_fpu_prepare() by no longer nesting the handling of new_fpu inside the two branches for the old_fpu. Signed-off-by: Rik van Riel Cc: 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: Peter Zijlstra Cc: Quentin Casasnovas Cc: Thomas Gleixner Cc: pbonzini@redhat.com Link: http://lkml.kernel.org/r/1475627678-20788-10-git-send-email-riel@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/fpu/internal.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index d0324bc..1dcb29e 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -581,23 +581,17 @@ switch_fpu_prepare(struct fpu *old_fpu, struct fpu *new_fpu, int cpu) /* But leave fpu_fpregs_owner_ctx! */ old_fpu->fpregs_active = 0; trace_x86_fpu_regs_deactivated(old_fpu); + } else + old_fpu->last_cpu = -1; - /* Don't change CR0.TS if we just switch! */ - if (fpu.preload) { - fpregs_activate(new_fpu); - trace_x86_fpu_regs_activated(new_fpu); + if (fpu.preload) { + if (fpregs_state_valid(new_fpu, cpu)) + fpu.preload = 0; + else prefetch(&new_fpu->state); - } - } else { - old_fpu->last_cpu = -1; - if (fpu.preload) { - if (fpregs_state_valid(new_fpu, cpu)) - fpu.preload = 0; - else - prefetch(&new_fpu->state); - fpregs_activate(new_fpu); - } + fpregs_activate(new_fpu); } + return fpu; }