Skip to content
  • Ingo Molnar's avatar
    x86/fpu: Clean up and fix MXCSR handling · 91a8c2a5
    Ingo Molnar authored
    
    
    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: default avatarBorislav 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: default avatarIngo Molnar <mingo@kernel.org>
    91a8c2a5