1. 19 5月, 2015 30 次提交
    • I
      x86/fpu: Remove failure paths from fpstate-alloc low level functions · c4d6ee6e
      Ingo Molnar 提交于
      Now that we always allocate the FPU context as part of task_struct there's
      no need for separate allocations - remove them and their primary failure
      handling code.
      
      ( Note that there's still secondary error codes that have become superfluous,
        those will be removed in separate patches. )
      
      Move the somewhat misplaced setup_xstate_comp() call to the core.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      c4d6ee6e
    • I
      x86/fpu: Add more comments to the FPU init code · ae02679c
      Ingo Molnar 提交于
      Extend the comments of the FPU init code, and fix old ones.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      ae02679c
    • I
      x86/fpu: Reorder init methods · 41e78410
      Ingo Molnar 提交于
      Reorder init methods in order of their relationship and usage, to
      form coherent blocks throughout the whole file.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      41e78410
    • I
      x86/fpu: Rename fpstate_xstate_init_size() to fpu__init_system_xstate_size_legacy() · 7638b74b
      Ingo Molnar 提交于
      To bring it in line with the other init_system*() methods.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      7638b74b
    • I
      x86/fpu: Remove the extra fpu__detect() layer · c66e3f28
      Ingo Molnar 提交于
      Now that fpu__detect() has become an empty layer around
      fpu__init_system(), eliminate it and make fpu__init_system()
      the main system initialization routine.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      c66e3f28
    • I
      x86/fpu: Move fpu__init_system_early_generic() out of fpu__detect() · dd863880
      Ingo Molnar 提交于
      Move the fpu__init_system_early_generic() call into fpu__init_system(),
      which hosts all the system init calls.
      
      Expose fpu__init_system() to other modules - this will be our main and only
      system init function.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      dd863880
    • I
      x86/fpu: Factor out FPU bug checks into fpu/bugs.c · 0bf23f3d
      Ingo Molnar 提交于
      Create separate fpu/bugs.c code so that if we read generic FPU code
      we don't have to wade through all the bugcheck related code first.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      0bf23f3d
    • I
      x86/fpu: Move !FPU check ingo fpu__init_system_early_generic() · e83ab9ad
      Ingo Molnar 提交于
      There's a !FPU related sanity check in fpu__init_cpu_generic(),
      which is executed on every CPU onlining - even though we should do
      this only once, and during system init.
      
      Move this check to fpu__init_system_early_generic().
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      e83ab9ad
    • I
      x86/fpu: Factor out fpu__init_system_early_generic() · 2e2f3da7
      Ingo Molnar 提交于
      Move the generic bits of fpu__detect() into fpu__init_system_early_generic().
      
      We'll move some other code here too in a followup patch.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      2e2f3da7
    • I
      x86/fpu: Factor out fpu__init_system_generic() · 7218e8b7
      Ingo Molnar 提交于
      Factor out the generic bits from fpu__init_system().
      
      Rename mxcsr_feature_mask_init() to fpu__init_system_mxcsr()
      to bring it in line with the rest of the nomenclature.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      7218e8b7
    • I
      x86/fpu: Factor out fpu__init_cpu_generic() · b11316ed
      Ingo Molnar 提交于
      Factor out the generic bits from fpu__init_cpu(), to create
      a flat sequence of per CPU initialization function calls:
      
      	fpu__init_cpu_generic();
      	fpu__init_cpu_xstate();
      	fpu__init_cpu_ctx_switch();
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      b11316ed
    • I
      x86/fpu: Simplify fpu__cpu_init() · 21c4cd10
      Ingo Molnar 提交于
      After the latest round of cleanups, fpu__cpu_init() has become
      a simple call to fpu__init_cpu().
      
      Rename fpu__init_cpu() to fpu__cpu_init() and remove the
      extra layer.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      21c4cd10
    • I
      x86/fpu: Remove fpu__init_cpu_ctx_switch() call from fpu__init_system() · 7202ab46
      Ingo Molnar 提交于
      We are now doing the fpu__init_cpu_ctx_switch() call from fpu__init_cpu(),
      so there's no need to call it from fpu__init_system() anymore.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      7202ab46
    • I
      x86/fpu: Do system-wide setup from fpu__detect() · 067051cc
      Ingo Molnar 提交于
      fpu__cpu_init() is called on every CPU, so it is the wrong place
      to call fpu__init_system() from. Call it from fpu__detect():
      this is early CPU init code, but we already have CPU features detected,
      so we can call the system-wide FPU init code from here.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      067051cc
    • I
      x86/fpu: Call fpu__init_cpu_ctx_switch() from fpu__init_cpu() · 3960fccf
      Ingo Molnar 提交于
      fpu__init_cpu() is currently called from fpu__init_system(),
      which is the wrong place for it: call it from the proper high level
      per CPU init function, fpu__init_cpu().
      
      Note, we still keep the old call site as well, because it depends
      on having proper CR0::TS setup. We'll fix this in the next patch.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      3960fccf
    • I
      x86/fpu: Move the fpstate_xstate_init_size() call into fpu__init_system() · 997578b1
      Ingo Molnar 提交于
      The fpstate_xstate_init_size() function sets up a basic xstate_size, called
      during fpu__detect() currently.
      
      Its real dependency is to be called before fpu__init_system_xstate().
      
      So move the function call site into fpu__init_system(), to right before the
      fpu__init_system_xstate() call.
      
      Also add a once-per-boot flag to fpstate_xstate_init_size(), we'll remove
      this quirk later once we've cleaned up the init dependencies.
      
      This moves the two related functions closer to each other and makes them
      both part of the _init_system() functionality.
      
      Currently we do the fpstate_xstate_init_size()
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      997578b1
    • I
      x86/fpu: Do CLTS fpu__init_system() · 530b37e4
      Ingo Molnar 提交于
      mxcsr_feature_mask_init() depends on TS being cleared, as it executes
      an FXSAVE instruction.
      
      After later changes we will move the TS setup into fpu__init_cpu(),
      which will interact with this - so clear the TS flag explicitly.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      530b37e4
    • I
      x86/fpu: Split fpu__ctx_switch_init() into _cpu() and _system() portions · 011545b5
      Ingo Molnar 提交于
      So fpu__ctx_switch_init() has two aspects: a once per bootup functionality
      that sets up a capability flag, and a per CPU functionality that sets CR0::TS.
      
      Split the function.
      
      Note that at this stage we still have duplicate calls into these methods, as
      both the _system() and the _cpu() methods are run on all CPUs, with lower
      level on_boot_cpu flags filtering out the duplicates where needed. So add
      TS flag clearing as well, to handle the aftermath of early CPU init sequences
      that might call in without having eager-fpu set - don't assume the TS flag
      is cleared.
      
      Calling each from its respective init level will happen later on.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      011545b5
    • I
      x86/fpu: Clean up eager_fpu_init() and rename it to fpu__ctx_switch_init() · 064e51e3
      Ingo Molnar 提交于
      It's not an xsave specific function anymore, so rename it accordingly
      and also clean it up a bit:
      
       - remove the obsolete __init_refok, as the code paths are not
         mixed anymore
      
       - rename it from eager_fpu_init() to fpu__ctx_switch_init()
      
       - remove stray 'return;'
      
       - make it static to its only user
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      064e51e3
    • I
      x86/fpu: Move eager_fpu_init() to fpu/init.c · 6f5d265a
      Ingo Molnar 提交于
      Move eager_fpu_init() and the 'eagerfpu' boot parameter handling function
      to the generic FPU init file: it's generic FPU functionality.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      6f5d265a
    • I
      x86/fpu: Set up the legacy FPU init image from fpu__init_system() · 2507e1c0
      Ingo Molnar 提交于
      The legacy FPU init image is used on older CPUs who don't run xstate init.
      But the init code is called within setup_init_fpu_buf(), an xstate method.
      
      Move this legacy init out of the xstate code and put it into fpu/init.c.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      2507e1c0
    • I
      x86/fpu: Do fpu__init_system_xstate only from fpu__init_system() · 429ced50
      Ingo Molnar 提交于
      Only call xstate system setup routines from fpu__init_system().
      
      Likewise, don't call fpu__init_cpu_xstate() from fpu__init_system().
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      429ced50
    • I
      x86/fpu: Remove xsave_init() · c42103b2
      Ingo Molnar 提交于
      Expand fpu__init_system_xstate() and fpu__init_cpu_xstate() calls
      into xsave_init() calls.
      
      (This will allow us to call the proper versions in higher level FPU init code
      later on.)
      
      No change in functionality.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      c42103b2
    • I
      x86/fpu: Split fpu__cpu_init() into early-boot and cpu-boot parts · e35f6f14
      Ingo Molnar 提交于
      There are two kinds of FPU initialization sequences necessary to bring FPU
      functionality up: once per system bootup activities, such as detection,
      feature initialization, etc. of attributes that are shared by all CPUs
      in the system - and per cpu initialization sequences run when a CPU is
      brought online (either during bootup or during CPU hotplug onlining),
      such as CR0/CR4 register setting, etc.
      
      The FPU code is mixing these roles together, with no clear distinction.
      
      Start sorting this out by splitting the main FPU detection routine
      (fpu__cpu_init()) into two parts: fpu__init_system() for
      one per system init activities, and fpu__init_cpu() for the
      per CPU onlining init activities.
      
      Note that xstate_init() is called from both variants for the time being,
      because it has a dual nature as well. We'll fix that in upcoming patches.
      
      Just do the split and call it as we used to before, don't introduce any
      change in initialization behavior yet, beyond duplicate (and harmless)
      fpu__init_cpu() and xstate_init() calls - which we'll fix in later
      patches.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      e35f6f14
    • I
      x86/fpu: Remove fpstate_xstate_init_size() boot quirk · 6a133207
      Ingo Molnar 提交于
      fpstate_xstate_init_size() is called in fpu__cpu_init(), which is
      run on every CPU, every time they are brought online.
      
      But we want to call fpstate_xstate_init_size() only once. Move it to
      fpu__detect(), which only runs once, on the boot CPU.
      
      Also clean up the flow of fpstate_xstate_init_size() a bit, by
      removing a 'return' from the middle of the function.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      6a133207
    • I
      x86/fpu: Clean up and fix MXCSR handling · 91a8c2a5
      Ingo Molnar 提交于
      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: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      91a8c2a5
    • I
      x86/fpu: Rename fpu-internal.h to fpu/internal.h · 78f7f1e5
      Ingo Molnar 提交于
      This unifies all the FPU related header files under a unified, hiearchical
      naming scheme:
      
       - asm/fpu/types.h:      FPU related data types, needed for 'struct task_struct',
                               widely included in almost all kernel code, and hence kept
                               as small as possible.
      
       - asm/fpu/api.h:        FPU related 'public' methods exported to other subsystems.
      
       - asm/fpu/internal.h:   FPU subsystem internal methods
      
       - asm/fpu/xsave.h:      XSAVE support internal methods
      
      (Also standardize the header guard in asm/fpu/internal.h.)
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      78f7f1e5
    • I
      x86/fpu: Factor out the FPU bug detection code into fpu__init_check_bugs() · 4d164092
      Ingo Molnar 提交于
      Move the boot-time FPU bug detection code to the other FPU boot time
      init code in fpu/init.c.
      
      No change in code size:
      
         text    data     bss     dec     hex filename
         13044568        1884440 1130496 16059504         f50c70 vmlinux.before
         13044568        1884440 1130496 16059504         f50c70 vmlinux.after
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      4d164092
    • I
      x86/fpu: Move the no_387 handling and FPU detection code into init.c · 146ed598
      Ingo Molnar 提交于
      Both no_387() and fpu__detect() run at boot time, so they belong
      into init.c.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      146ed598
    • I
      x86/fpu: Split out the boot time FPU init code into fpu/init.c · 0c867537
      Ingo Molnar 提交于
      Move boot time FPU initialization code into init.c, to better
      isolate it into its own domain.
      Reviewed-by: NBorislav 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: NIngo Molnar <mingo@kernel.org>
      0c867537