mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mutex: fix deadlock injection
Date: Mon, 5 Aug 2013 09:58:05 +0200	[thread overview]
Message-ID: <20130805075805.GB22035@phenom.ffwll.local> (raw)
In-Reply-To: <51F775B5.201@canonical.com>

On Tue, Jul 30, 2013 at 10:13:41AM +0200, Maarten Lankhorst wrote:
> The check needs to be for > 1, because ctx->acquired is already incremented.
> This will prevent ww_mutex_lock_slow from returning -EDEADLK and not locking
> the mutex. It caused a lot of false gpu lockups on radeon with
> CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y because a function that shouldn't be able
> to return -EDEADLK did.
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>

Oops, thanks for catching this.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
> diff --git a/kernel/mutex.c b/kernel/mutex.c
> index ff05f4b..a52ee7bb 100644
> --- a/kernel/mutex.c
> +++ b/kernel/mutex.c
> @@ -686,7 +686,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
>  	might_sleep();
>  	ret =  __mutex_lock_common(&lock->base, TASK_UNINTERRUPTIBLE,
>  				   0, &ctx->dep_map, _RET_IP_, ctx);
> -	if (!ret && ctx->acquired > 0)
> +	if (!ret && ctx->acquired > 1)
>  		return ww_mutex_deadlock_injection(lock, ctx);
>  
>  	return ret;
> @@ -702,7 +702,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
>  	ret = __mutex_lock_common(&lock->base, TASK_INTERRUPTIBLE,
>  				  0, &ctx->dep_map, _RET_IP_, ctx);
>  
> -	if (!ret && ctx->acquired > 0)
> +	if (!ret && ctx->acquired > 1)
>  		return ww_mutex_deadlock_injection(lock, ctx);
>  
>  	return ret;
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

      parent reply	other threads:[~2013-08-05  7:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01  8:22 [GIT PULL] core/mutexes changes for v3.11: W/W mutex support Ingo Molnar
2013-07-03  0:54 ` Linus Torvalds
2013-07-03  6:29   ` Maarten Lankhorst
2013-07-05  6:23     ` Ingo Molnar
2013-07-05  7:29       ` [PATCH] mutex: move ww_mutex definitions to ww_mutex.h Maarten Lankhorst
2013-07-12 13:28         ` [tip:core/locking] mutex: Move " tip-bot for Maarten Lankhorst
2013-07-30  8:13       ` [PATCH] mutex: fix deadlock injection Maarten Lankhorst
2013-07-30  8:41         ` Peter Zijlstra
2013-08-07  0:05           ` Dave Airlie
2013-08-07  6:22             ` Maarten Lankhorst
2013-07-30 13:09         ` Alex Deucher
2013-07-31  8:55         ` [tip:core/urgent] mutex: Fix w/w mutex " tip-bot for Maarten Lankhorst
2013-08-05  7:58         ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130805075805.GB22035@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®