[PATCH v3 20/21] arm64/fpu: Enforce task-context only for generic kernel mode FPU
Ard Biesheuvel
ardb at kernel.org
Thu Oct 9 08:40:49 PDT 2025
On Wed, 8 Oct 2025 at 21:35, Jari Ruusu <jariruusu at protonmail.com> wrote:
>
> Ard Biesheuvel wrote:
> > So enforce that kernel_fpu_begin() can only be called from task context,
> > and [redundantly] disable preemption. This removes the need for users of
> > this API to provide a kernel mode FP/SIMD state after a future patch
> > that makes that compulsory for preemptible task context.
> [snip]
> > --- a/arch/arm64/include/asm/fpu.h
> > +++ b/arch/arm64/include/asm/fpu.h
> [snip]
> > +static inline void kernel_fpu_begin(void)
> > +{
> > + BUG_ON(!in_task());
> > + preempt_disable();
> ^^^^^^^------this looks okay
> > + kernel_neon_begin();
> > +}
> > +
> > +static inline void kernel_fpu_end(void)
> > +{
> > + kernel_neon_end();
> > + preempt_disable();
> ^^^^^^^------this looks wrong
> > +}
>
> Maybe that second one should be preempt_enable()
>
Indeed, thanks for spotting that.
More information about the linux-arm-kernel
mailing list