summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0002-ARM-vfp-Use-vfp_lock-in-vfp_sync_hwstate.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches-rt/0002-ARM-vfp-Use-vfp_lock-in-vfp_sync_hwstate.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/debian/patches-rt/0002-ARM-vfp-Use-vfp_lock-in-vfp_sync_hwstate.patch b/debian/patches-rt/0002-ARM-vfp-Use-vfp_lock-in-vfp_sync_hwstate.patch
new file mode 100644
index 000000000..a0d93547c
--- /dev/null
+++ b/debian/patches-rt/0002-ARM-vfp-Use-vfp_lock-in-vfp_sync_hwstate.patch
@@ -0,0 +1,44 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 19 May 2023 16:57:30 +0200
+Subject: [PATCH 2/4] ARM: vfp: Use vfp_lock() in vfp_sync_hwstate().
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.6/older/patches-6.6.7-rt18.tar.xz
+
+vfp_sync_hwstate() uses preempt_disable() followed by local_bh_disable()
+to ensure that it won't get interrupted while checking the VFP state.
+This harms PREEMPT_RT because softirq handling can get preempted and
+local_bh_disable() synchronizes the related section with a sleeping lock
+which does not work with disabled preemption.
+
+Use the vfp_lock() to synchronize the access.
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ arch/arm/vfp/vfpmodule.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/arch/arm/vfp/vfpmodule.c
++++ b/arch/arm/vfp/vfpmodule.c
+@@ -540,11 +540,9 @@ static inline void vfp_pm_init(void) { }
+ */
+ void vfp_sync_hwstate(struct thread_info *thread)
+ {
+- unsigned int cpu = get_cpu();
++ vfp_lock();
+
+- local_bh_disable();
+-
+- if (vfp_state_in_hw(cpu, thread)) {
++ if (vfp_state_in_hw(raw_smp_processor_id(), thread)) {
+ u32 fpexc = fmrx(FPEXC);
+
+ /*
+@@ -555,8 +553,7 @@ void vfp_sync_hwstate(struct thread_info
+ fmxr(FPEXC, fpexc);
+ }
+
+- local_bh_enable();
+- put_cpu();
++ vfp_unlock();
+ }
+
+ /* Ensure that the thread reloads the hardware VFP state on the next use. */