summaryrefslogtreecommitdiff
path: root/kernel/locking/rtmutex_common.h
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2021-02-04 17:28:56 +0000
committerPanwar Vijay Kumar <pvijayku@codeaurora.org>2021-09-28 10:49:15 +0530
commit6d6ed38b7d10fa63caac3230150a0b8fb8d1aa0c (patch)
treea61d6384e31a2dde7273c6c1dd4932c0e0fd3892 /kernel/locking/rtmutex_common.h
parent3c8f7dfd59b503062fa92bacb6b9db9704f59880 (diff)
futex: Rework inconsistent rt_mutex/futex_q state
From: Peter Zijlstra <peterz@infradead.org> [Upstream commit 73d786bd043ebc855f349c81ea805f6b11cbf2aa ] There is a weird state in the futex_unlock_pi() path when it interleaves with a concurrent futex_lock_pi() at the point where it drops hb->lock. In this case, it can happen that the rt_mutex wait_list and the futex_q disagree on pending waiters, in particular rt_mutex will find no pending waiters where futex_q thinks there are. In this case the rt_mutex unlock code cannot assign an owner. The futex side fixup code has to cleanup the inconsistencies with quite a bunch of interesting corner cases. Simplify all this by changing wake_futex_pi() to return -EAGAIN when this situation occurs. This then gives the futex_lock_pi() code the opportunity to continue and the retried futex_unlock_pi() will now observe a coherent state. The only problem is that this breaks RT timeliness guarantees. That is, consider the following scenario: T1 and T2 are both pinned to CPU0. prio(T2) > prio(T1) CPU0 T1 lock_pi() queue_me() <- Waiter is visible preemption T2 unlock_pi() loops with -EAGAIN forever Which is undesirable for PI primitives. Future patches will rectify this. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: juri.lelli@arm.com Cc: bigeasy@linutronix.de Cc: xlpang@redhat.com Cc: rostedt@goodmis.org Cc: mathieu.desnoyers@efficios.com Cc: jdesfossez@efficios.com Cc: dvhart@infradead.org Cc: bristot@redhat.com Link: http://lkml.kernel.org/r/20170322104151.850383690@infradead.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> [Lee: Back-ported to solve a dependency] Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Git-commit: 394fc4981426d5f6427e1adb80bec3ee8cf76bcf Git-repo: https://android.googlesource.com/kernel/common/ Change-Id: I73a7014a7176150c93b7caa7b487d85fc2922058 Signed-off-by: pvijayku <pvijayku@codeaurora.org>
Diffstat (limited to 'kernel/locking/rtmutex_common.h')
0 files changed, 0 insertions, 0 deletions