Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754336AbcJEAer (ORCPT ); Tue, 4 Oct 2016 20:34:47 -0400 Received: from shelob.surriel.com ([74.92.59.67]:53767 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752822AbcJEAep (ORCPT ); Tue, 4 Oct 2016 20:34:45 -0400 From: riel@redhat.com To: linux-kernel@vger.kernel.org Cc: dave.hansen@linux.intel.com, x86@kernel.org, tglx@linutronix.de, pbonzini@redhat.com, mingo@redhat.com, luto@kernel.org, pa@zytor.com, bp@suse.de Subject: [PATCH 9/9] x86/fpu: split old & new fpu code paths Date: Tue, 4 Oct 2016 20:34:38 -0400 Message-Id: <1475627678-20788-10-git-send-email-riel@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1475627678-20788-1-git-send-email-riel@redhat.com> References: <1475627678-20788-1-git-send-email-riel@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1369 Lines: 49 From: Rik van Riel Now that CR0.TS is no longer being manipulated, we can simplify switch_fpu_prepare by no longer nesting the handling of the new fpu inside the two branches for the old FPU. Signed-off-by: Rik van Riel --- 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 aa7a117b43f8..ef52935f8a17 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; } -- 2.7.4