Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751571AbbEFKO4 (ORCPT ); Wed, 6 May 2015 06:14:56 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40610 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbbEFKOw (ORCPT ); Wed, 6 May 2015 06:14:52 -0400 Date: Wed, 6 May 2015 03:14:15 -0700 From: tip-bot for Bobby Powers Message-ID: Cc: sbsiddha@gmail.com, mingo@kernel.org, quentin.casasnovas@oracle.com, bp@suse.de, torvalds@linux-foundation.org, bp@alien8.de, fenghua.yu@intel.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, riel@redhat.com, dave.hansen@intel.com, priikone@iki.fi, hpa@zytor.com, luto@amacapital.net, bobbypowers@gmail.com, oleg@redhat.com Reply-To: bp@suse.de, bp@alien8.de, torvalds@linux-foundation.org, sbsiddha@gmail.com, quentin.casasnovas@oracle.com, mingo@kernel.org, riel@redhat.com, dave.hansen@intel.com, fenghua.yu@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, priikone@iki.fi, luto@amacapital.net, oleg@redhat.com, bobbypowers@gmail.com In-Reply-To: <1430147441-9820-1-git-send-email-bobbypowers@gmail.com> References: <1430147441-9820-1-git-send-email-bobbypowers@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/fpu: Always restore_xinit_state() when use_eager_cpu() Git-Commit-ID: c88d47480d300eaad80c213d50c9bf6077fc49bc 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: 2949 Lines: 76 Commit-ID: c88d47480d300eaad80c213d50c9bf6077fc49bc Gitweb: http://git.kernel.org/tip/c88d47480d300eaad80c213d50c9bf6077fc49bc Author: Bobby Powers AuthorDate: Mon, 27 Apr 2015 08:10:41 -0700 Committer: Ingo Molnar CommitDate: Wed, 6 May 2015 11:22:03 +0200 x86/fpu: Always restore_xinit_state() when use_eager_cpu() The following commit: f893959b0898 ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()") removed drop_init_fpu() usage from flush_thread(). This seems to break things for me - the Go 1.4 test suite fails all over the place with floating point comparision errors (offending commit found through bisection). The functional change was that flush_thread() after this commit only calls restore_init_xstate() when both use_eager_fpu() and !used_math() are true. drop_init_fpu() (now fpu_reset_state()) calls restore_init_xstate() regardless of whether current used_math() - apply the same logic here. Switch used_math() -> tsk_used_math(tsk) to consistently use the grabbed tsk instead of current, like in the rest of flush_thread(). Tested-by: Dave Hansen Signed-off-by: Bobby Powers Signed-off-by: Borislav Petkov Acked-by: Oleg Nesterov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Pekka Riikonen Cc: Quentin Casasnovas Cc: Rik van Riel Cc: Suresh Siddha Cc: Thomas Gleixner Fixes: f893959b ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()") Link: http://lkml.kernel.org/r/1430147441-9820-1-git-send-email-bobbypowers@gmail.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/process.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index bfc99b3..6e338e3 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -156,11 +156,13 @@ void flush_thread(void) /* FPU state will be reallocated lazily at the first use. */ drop_fpu(tsk); free_thread_xstate(tsk); - } else if (!used_math()) { - /* kthread execs. TODO: cleanup this horror. */ - if (WARN_ON(init_fpu(tsk))) - force_sig(SIGKILL, tsk); - user_fpu_begin(); + } else { + if (!tsk_used_math(tsk)) { + /* kthread execs. TODO: cleanup this horror. */ + if (WARN_ON(init_fpu(tsk))) + force_sig(SIGKILL, tsk); + user_fpu_begin(); + } restore_init_xstate(); } } -- 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/