* [PATCH -rt] rtmutex: enable deadlock detection in the ww_mutex_lock functions
@ 2015-01-27 5:53 Gustavo Bittencourt
2015-01-27 6:49 ` Mike Galbraith
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Bittencourt @ 2015-01-27 5:53 UTC (permalink / raw)
To: linux-kernel
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
Signed-off-by: Gustavo Bittencourt<gbitten@gmail.com>
---
kernel/locking/rtmutex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 6c40660..3f6ef91 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1965,7 +1965,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ww_c
might_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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -rt] rtmutex: enable deadlock detection in the ww_mutex_lock functions
2015-01-27 5:53 [PATCH -rt] rtmutex: enable deadlock detection in the ww_mutex_lock functions Gustavo Bittencourt
@ 2015-01-27 6:49 ` Mike Galbraith
0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2015-01-27 6:49 UTC (permalink / raw)
To: Gustavo Bittencourt; +Cc: linux-kernel
You should probably CC -rt maintainers when submitting a -rt patch.
On Tue, 2015-01-27 at 03:53 -0200, Gustavo Bittencourt wrote:
> 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
>
> Signed-off-by: Gustavo Bittencourt<gbitten@gmail.com>
> ---
> kernel/locking/rtmutex.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
> index 6c40660..3f6ef91 100644
> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -1965,7 +1965,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ww_c
> might_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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-27 6:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 5:53 [PATCH -rt] rtmutex: enable deadlock detection in the ww_mutex_lock functions Gustavo Bittencourt
2015-01-27 6:49 ` Mike Galbraith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.