rtmutex: enable deadlock detection in the ww_mutex_lock functions
PATCH 1/1 rtmutex: enable deadlock detection in the ww_mutex_lock functions
According the ww-mutex-design.txt documentation, the ww_mutex_lock_interruptible and ww_mutex_lock functions should return -EDEADLK when faced with a deadlock. To do so, the flag detect_deadlock in the rt_mutex_slowlock calls should be enabled. This patch corrects potential deadlocks when running PREEMPT_RT with nouveau driver.
Kernel v3.14-rt
--- kernel/locking/rtmutex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/locking/rtmutex.c +2 -2
@@ -1965,7 +1965,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ww_cmight_sleep ();mutex_acquire (&lock->base.dep_map,0 ,0 ,_RET_IP_); - ret =rt_mutex_slowlock (&lock->base.lock,TASK_INTERRUPTIBLE ,NULL ,0 , ww_ctx); + ret =rt_mutex_slowlock (&lock->base.lock,TASK_INTERRUPTIBLE ,NULL ,1 , ww_ctx);if (ret)mutex_release (&lock->base.dep_map,1 ,_RET_IP_);else if (!ret && ww_ctx->acquired >1 )
@@ -1984,7 +1984,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx)mutex_acquire_nest (&lock->base.dep_map,0 ,0 , &ww_ctx->dep_map, _RET_IP_); - ret =rt_mutex_slowlock (&lock->base.lock,TASK_UNINTERRUPTIBLE ,NULL ,0 , ww_ctx); + ret =rt_mutex_slowlock (&lock->base.lock,TASK_UNINTERRUPTIBLE ,NULL ,1 , ww_ctx);if (ret)mutex_release (&lock->base.dep_map,1 ,_RET_IP_);else if (!ret && ww_ctx->acquired >1 )
-- 1.9.1
You should probably CC -rt maintainers when submitting a -rt patch.
Quoted 38 lines · Gustavo Bittencourt
According the ww-mutex-design.txt documentation, the
ww_mutex_lock_interruptibleandww_mutex_lockfunctions should return-EDEADLKwhen faced with a deadlock. To do so, the flagdetect_deadlockin thert_mutex_slowlockcalls should be enabled. This patch corrects potential deadlocks when runningPREEMPT_RTwith nouveau driver.Kernel v3.14-rt
Signed-off-by Gustavo Bittencourt<[email protected]>--- kernel/locking/rtmutex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/locking/rtmutex.c +2
-4@@ -1965,7 +1965,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ww_cmight_sleep ();mutex_acquire (&lock->base.dep_map,0 ,0 ,_RET_IP_); - ret =rt_mutex_slowlock (&lock->base.lock,TASK_INTERRUPTIBLE ,NULL ,0 , ww_ctx); + ret =rt_mutex_slowlock (&lock->base.lock,TASK_INTERRUPTIBLE ,NULL ,1 , ww_ctx);if (ret)mutex_release (&lock->base.dep_map,1 ,_RET_IP_);else if (!ret && ww_ctx->acquired >1 )@@ -1984,7 +1984,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx)mutex_acquire_nest (&lock->base.dep_map,0 ,0 , &ww_ctx->dep_map, _RET_IP_); - ret =rt_mutex_slowlock (&lock->base.lock,TASK_UNINTERRUPTIBLE ,NULL ,0 , ww_ctx); + ret =rt_mutex_slowlock (&lock->base.lock,TASK_UNINTERRUPTIBLE ,NULL ,1 , ww_ctx);if (ret)mutex_release (&lock->base.dep_map,1 ,_RET_IP_);else if (!ret && ww_ctx->acquired >1 ) -- 1.9.1 --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/