x86/fpu: Clean up and fix MXCSR handling
authorIngo Molnar <mingo@kernel.org>
Fri, 24 Apr 2015 08:49:11 +0000 (10:49 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:35 +0000 (15:47 +0200)
commit91a8c2a5b43fc4be4adb4bda50cd331697e289e0
treecc9606604601f8793f909c97953fa581f9aad7cb
parent400e4b209166dcd3e3a155401c57bdc6413bf715
x86/fpu: Clean up and fix MXCSR handling

The code has the following problems:

 - it uses a single global 'fx_scratch' area that multiple CPUs could
   write into simultaneously, in theory.

 - it wastes 512 bytes of .data for something that is only rarely used.

Fix this by moving the state buffer to the stack. Note that while
this is 512 bytes, we don't ever call this function in very deep
callchains, so its stack usage should not be a problem.

Also add comments to explain the magic 0x0000ffbf default value.

Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/fpu/init.c