Re: [PATCH v3 20/21] arm64/fpu: Enforce task-context only for generic kernel mode FPU

From: Jari Ruusu
Date: Thu Oct 09 2025 - 00:35:57 EST


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()

--
Jari Ruusu  4096R/8132F189 12D6 4C3A DCDA 0AA4 27BD  ACDF F073 3C80 8132 F189