Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbbDZWEv (ORCPT ); Sun, 26 Apr 2015 18:04:51 -0400 Received: from mail-oi0-f44.google.com ([209.85.218.44]:34309 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214AbbDZWEu (ORCPT ); Sun, 26 Apr 2015 18:04:50 -0400 From: Bobby Powers To: linux-kernel@vger.kernel.org Cc: Bobby Powers , x86@kernel.org, Oleg Nesterov , Borislav Petkov , Ingo Molnar , Andy Lutomirski , Dave Hansen , Fenghua Yu , Linus Torvalds , Pekka Riikonen , Quentin Casasnovas , Rik van Riel , Suresh Siddha Subject: [PATCH] x86/fpu: always restore_xinit_state() when !use_eager_cpu() Date: Sun, 26 Apr 2015 18:04:29 -0400 Message-Id: <1430085869-4327-1-git-send-email-bobbypowers@gmail.com> X-Mailer: git-send-email 2.3.6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2352 Lines: 66 Oleg's commit f893959b ("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). Note: used_math() looks at current, and should be switch to tsk_used_math(tsk), but even with this I see test suite breakage. The functional change was that flush_thread after f893959b 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(). There was a lot of commentary on the initial patch - not sure I understand it all. Happy to get some pointers or be pointed to a better fix. Signed-off-by: Bobby Powers Cc: Oleg Nesterov Cc: Borislav Petkov Cc: Ingo Molnar Cc: Andy Lutomirski Cc: Dave Hansen Cc: Fenghua Yu Cc: Linus Torvalds Cc: Pekka Riikonen Cc: Quentin Casasnovas Cc: Rik van Riel Cc: Suresh Siddha --- 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 8213da6..c820baf5 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 (!used_math()) { + /* kthread execs. TODO: cleanup this horror. */ + if (WARN_ON(init_fpu(tsk))) + force_sig(SIGKILL, tsk); + user_fpu_begin(); + } restore_init_xstate(); } } -- 2.3.6 -- 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/