Messages in this thread | | | Date | Tue, 3 May 2022 11:03:05 +0200 | From | Peter Zijlstra <> | Subject | Re: [patch 3/3] x86/fpu: Make FPU protection more robust |
| |
On Sun, May 01, 2022 at 09:31:47PM +0200, Thomas Gleixner wrote: > +void fpregs_lock(void) > +{ > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > + local_bh_disable(); > + else > + preempt_disable(); > + > + WARN_ON_ONCE(this_cpu_read(fpu_in_use)); > + this_cpu_write(fpu_in_use, true);
barrier(); > +} > +EXPORT_SYMBOL_GPL(fpregs_lock);
> +void fpregs_unlock(void) > +{ barrier();
> + WARN_ON_ONCE(!this_cpu_read(fpu_in_use)); > + this_cpu_write(fpu_in_use, false); > + > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > + local_bh_enable(); > + else > + preempt_enable(); > +} > +EXPORT_SYMBOL_GPL(fpregs_unlock);
I think this isn't currently a problem because a function call is a C sequence point, but 'funnily' C doesn't preserve sequence points when inlining so LTO can actually break this without barrier() on.
| |