• Ard Biesheuvel's avatar
    arm64: fpsimd: Drop unneeded 'busy' flag · 9b19700e
    Ard Biesheuvel authored
    Kernel mode NEON will preserve the user mode FPSIMD state by saving it
    into the task struct before clobbering the registers. In order to avoid
    the need for preserving kernel mode state too, we disallow nested use of
    kernel mode NEON, i..e, use in softirq context while the interrupted
    task context was using kernel mode NEON too.
    
    Originally, this policy was implemented using a per-CPU flag which was
    exposed via may_use_simd(), requiring the users of the kernel mode NEON
    to deal with the possibility that it might return false, and having NEON
    and non-NEON code paths. This policy was changed by commit
    13150149 ("arm64: fpsimd: run kernel mode NEON with softirqs
    disabled"), and now, softirq processing is disabled entirely instead,
    and so may_use_simd() can never fail when called from task or softirq
    context.
    
    This means we can drop the fpsimd_context_busy flag entirely, and
    instead, ensure that we disable softirq processing in places where we
    formerly relied on the flag for preventing races in the FPSIMD preserve
    routines.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Reviewed-by: default avatarMark Brown <broonie@kernel.org>
    Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Link: https://lore.kernel.org/r/20231208113218.3001940-7-ardb@google.com
    [will: Folded in fix from CAMj1kXFhzbJRyWHELCivQW1yJaF=p07LLtbuyXYX3G1WtsdyQg@mail.gmail.com]
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    9b19700e
simd.h 1.04 KB