linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/fpu: always restore_xinit_state() when !use_eager_cpu()
@ 2015-04-26 22:04 Bobby Powers
  2015-04-27 14:46 ` Dave Hansen
  2015-04-27 14:49 ` Oleg Nesterov
  0 siblings, 2 replies; 12+ messages in thread
From: Bobby Powers @ 2015-04-26 22:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Bobby Powers, x86, Oleg Nesterov, Borislav Petkov, Ingo Molnar,
	Andy Lutomirski, Dave Hansen, Fenghua Yu, Linus Torvalds,
	Pekka Riikonen, Quentin Casasnovas, Rik van Riel, Suresh Siddha

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 <bobbypowers@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>

---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-05-06 10:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 22:04 [PATCH] x86/fpu: always restore_xinit_state() when !use_eager_cpu() Bobby Powers
2015-04-27 14:46 ` Dave Hansen
2015-04-27 15:00   ` Oleg Nesterov
2015-05-01 18:14   ` Dave Hansen
2015-04-27 14:49 ` Oleg Nesterov
2015-04-27 14:58   ` Bobby Powers
2015-04-27 15:10   ` [PATCH v2] x86/fpu: always restore_xinit_state() when use_eager_cpu() Bobby Powers
2015-04-27 15:19     ` Oleg Nesterov
2015-05-02 20:42       ` Bobby Powers
2015-05-03 17:39         ` Oleg Nesterov
2015-05-04  8:11     ` Borislav Petkov
2015-05-06 10:14     ` [tip:x86/urgent] x86/fpu: Always " tip-bot for Bobby Powers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).