From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964817AbcBIQMo (ORCPT ); Tue, 9 Feb 2016 11:12:44 -0500 Received: from terminus.zytor.com ([198.137.202.10]:38581 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964783AbcBIQMl (ORCPT ); Tue, 9 Feb 2016 11:12:41 -0500 Date: Tue, 9 Feb 2016 08:11:36 -0800 From: tip-bot for Andy Lutomirski Message-ID: Cc: sai.praneeth.prakhya@intel.com, quentin.casasnovas@oracle.com, mingo@kernel.org, torvalds@linux-foundation.org, oleg@redhat.com, luto@kernel.org, hpa@zytor.com, fenghua.yu@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, luto@amacapital.net, riel@redhat.com, peterz@infradead.org, yu-cheng.yu@intel.com Reply-To: torvalds@linux-foundation.org, oleg@redhat.com, luto@kernel.org, mingo@kernel.org, sai.praneeth.prakhya@intel.com, quentin.casasnovas@oracle.com, riel@redhat.com, peterz@infradead.org, yu-cheng.yu@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, luto@amacapital.net, fenghua.yu@intel.com, hpa@zytor.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Default eagerfpu=on on all CPUs Git-Commit-ID: 58122bf1d856a4ea9581d62a07c557d997d46a19 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: 58122bf1d856a4ea9581d62a07c557d997d46a19 Gitweb: http://git.kernel.org/tip/58122bf1d856a4ea9581d62a07c557d997d46a19 Author: Andy Lutomirski AuthorDate: Sun, 24 Jan 2016 14:38:10 -0800 Committer: Ingo Molnar CommitDate: Tue, 9 Feb 2016 15:42:56 +0100 x86/fpu: Default eagerfpu=on on all CPUs We have eager and lazy FPU modes, introduced in: 304bceda6a18 ("x86, fpu: use non-lazy fpu restore for processors supporting xsave") The result is rather messy. There are two code paths in almost all of the FPU code, and only one of them (the eager case) is tested frequently, since most kernel developers have new enough hardware that we use eagerfpu. It seems that, on any remotely recent hardware, eagerfpu is a win: glibc uses SSE2, so laziness is probably overoptimistic, and, in any case, manipulating TS is far slower that saving and restoring the full state. (Stores to CR0.TS are serializing and are poorly optimized.) To try to shake out any latent issues on old hardware, this changes the default to eager on all CPUs. If no performance or functionality problems show up, a subsequent patch could remove lazy mode entirely. Signed-off-by: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Quentin Casasnovas Cc: Rik van Riel Cc: Sai Praneeth Prakhya Cc: Thomas Gleixner Cc: yu-cheng yu Link: http://lkml.kernel.org/r/ac290de61bf08d9cfc2664a4f5080257ffc1075a.1453675014.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/init.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 6d9f0a7..471fe27 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -260,7 +260,10 @@ static void __init fpu__init_system_xstate_size_legacy(void) * not only saved the restores along the way, but we also have the * FPU ready to be used for the original task. * - * 'eager' switching is used on modern CPUs, there we switch the FPU + * 'lazy' is deprecated because it's almost never a performance win + * and it's much more complicated than 'eager'. + * + * 'eager' switching is by default on all CPUs, there we switch the FPU * state during every context switch, regardless of whether the task * has used FPU instructions in that time slice or not. This is done * because modern FPU context saving instructions are able to optimize @@ -271,7 +274,7 @@ static void __init fpu__init_system_xstate_size_legacy(void) * to use 'eager' restores, if we detect that a task is using the FPU * frequently. See the fpu->counter logic in fpu/internal.h for that. ] */ -static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO; +static enum { ENABLE, DISABLE } eagerfpu = ENABLE; /* * Find supported xfeatures based on cpu features and command-line input. @@ -348,15 +351,9 @@ static void __init fpu__init_system_ctx_switch(void) */ static void __init fpu__init_parse_early_param(void) { - /* - * No need to check "eagerfpu=auto" again, since it is the - * initial default. - */ if (cmdline_find_option_bool(boot_command_line, "eagerfpu=off")) { eagerfpu = DISABLE; fpu__clear_eager_fpu_features(); - } else if (cmdline_find_option_bool(boot_command_line, "eagerfpu=on")) { - eagerfpu = ENABLE; } if (cmdline_find_option_bool(boot_command_line, "no387"))