ARM: 9423/1: vfp: Provide vfp_state_hold() for VFP locking.
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 2 Oct 2024 16:15:32 +0000 (17:15 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 12 Nov 2024 16:41:46 +0000 (16:41 +0000)
commitf26bdbe1fa9f79fa8cb0d0bf39303c3573c60552
tree38b5b3dea42e33bfed587f8e4e4b3698c413bcbb
parentad8d1e323dd37f91d0c973e2a74c7b9054219adc
ARM: 9423/1: vfp: Provide vfp_state_hold() for VFP locking.

kernel_neon_begin() uses local_bh_disable() to ensure exclusive access
to the VFP unit. This is broken on PREEMPT_RT because a BH disabled
section remains preemptible on PREEMPT_RT.

Introduce vfp_state_hold() which uses local_bh_disable() and
preempt_disable() on PREEMPT_RT. Since softirqs are processed always in
thread context, disabling preemption is enough to ensure that the
current context won't get interrupted by something that is using the
VFP. Use it in kernel_neon_begin().

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/vfp/vfpmodule.c