x86/fpu: Clean up and fix MXCSR handling
authorIngo Molnar <[email protected]>
Fri, 24 Apr 2015 08:49:11 +0000 (10:49 +0200)
committerIngo Molnar <[email protected]>
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 <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/fpu/init.c