mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-12 16:15:05 -04:00
Merge tag 'x86-fpu-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 FPU updates from Thomas Gleixner: - Simplify the FPU protection for !RT kernels - Add the RT variant of FPU protections * tag 'x86-fpu-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Make kernel FPU protection RT friendly x86/fpu: Simplify fpregs_[un]lock()
This commit is contained in:
@@ -29,17 +29,32 @@ extern void fpregs_mark_activate(void);
|
||||
* A context switch will (and softirq might) save CPU's FPU registers to
|
||||
* fpu->state and set TIF_NEED_FPU_LOAD leaving CPU's FPU registers in
|
||||
* a random state.
|
||||
*
|
||||
* local_bh_disable() protects against both preemption and soft interrupts
|
||||
* on !RT kernels.
|
||||
*
|
||||
* On RT kernels local_bh_disable() is not sufficient because it only
|
||||
* serializes soft interrupt related sections via a local lock, but stays
|
||||
* preemptible. Disabling preemption is the right choice here as bottom
|
||||
* half processing is always in thread context on RT kernels so it
|
||||
* implicitly prevents bottom half processing as well.
|
||||
*
|
||||
* Disabling preemption also serializes against kernel_fpu_begin().
|
||||
*/
|
||||
static inline void fpregs_lock(void)
|
||||
{
|
||||
preempt_disable();
|
||||
local_bh_disable();
|
||||
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
|
||||
local_bh_disable();
|
||||
else
|
||||
preempt_disable();
|
||||
}
|
||||
|
||||
static inline void fpregs_unlock(void)
|
||||
{
|
||||
local_bh_enable();
|
||||
preempt_enable();
|
||||
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
|
||||
local_bh_enable();
|
||||
else
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_DEBUG_FPU
|
||||
|
||||
Reference in New Issue
Block a user