Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752936AbbBWPBT (ORCPT ); Mon, 23 Feb 2015 10:01:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51327 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752655AbbBWPBR (ORCPT ); Mon, 23 Feb 2015 10:01:17 -0500 Date: Mon, 23 Feb 2015 15:59:29 +0100 From: Oleg Nesterov To: Andy Lutomirski Cc: Rik van Riel , x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov Subject: Re: [RFC PATCH] x86, fpu: Use eagerfpu by default on all CPUs Message-ID: <20150223145929.GA10342@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2216 Lines: 60 On 02/20, Andy Lutomirski wrote: > > 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. > > 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 > --- > arch/x86/kernel/xsave.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c > index 0de1fae2bdf0..1928c8f34ce5 100644 > --- a/arch/x86/kernel/xsave.c > +++ b/arch/x86/kernel/xsave.c > @@ -637,8 +637,8 @@ static void __init xstate_enable_boot_cpu(void) > prepare_fx_sw_frame(); > setup_init_fpu_buf(); > > - /* Auto enable eagerfpu for xsaveopt */ > - if (cpu_has_xsaveopt && eagerfpu != DISABLE) > + /* Auto enable eagerfpu for everyone */ > + if (eagerfpu != DISABLE) > eagerfpu = ENABLE; Well, but if we want this change then perhaps we should simply change the default value? This way "AUTO" still can work. Oleg. --- x/arch/x86/kernel/xsave.c +++ x/arch/x86/kernel/xsave.c @@ -563,7 +563,7 @@ static void __init setup_init_fpu_buf(vo xsave_state_booting(init_xstate_buf, -1); } -static enum { AUTO, ENABLE, DISABLE } eagerfpu = AUTO; +static enum { AUTO, ENABLE, DISABLE } eagerfpu = ENABLE; static int __init eager_fpu_setup(char *s) { if (!strcmp(s, "on")) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/