Messages in this thread | | | Date | Tue, 27 Oct 2020 11:42:07 +0100 | From | Sebastian Andrzej Siewior <> | Subject | Re: [patch 2/2] x86/fpu: Make kernel FPU protection RT friendly |
| |
On 2020-10-27 11:09:51 [+0100], Thomas Gleixner wrote: > --- a/arch/x86/include/asm/fpu/api.h > +++ b/arch/x86/include/asm/fpu/api.h > @@ -32,15 +32,27 @@ extern void fpregs_mark_activate(void); > * > * 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.
The important part is that kernel_fpu_begin() also disables preemption and it may run in softirq. It does not use fpregs_lock() and fpregs_lock() serializes against kernel_fpu_begin().
> */ > static inline void fpregs_lock(void) > { > - local_bh_disable(); > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > + local_bh_disable(); > + else > + preempt_disable();
Could you please swap that to if (IS_ENABLED(CONFIG_PREEMPT_RT)) preempt_disable(); else local_bh_disable();
> } >
Sebastian
| |