From: Boqun Feng <boqun.feng@gmail.com>
To: Byungchul Park <byungchul.park@lge.com>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>,
peterz@infradead.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"sergey.senozhatsky.work@gmail.com"
<sergey.senozhatsky.work@gmail.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
kernel-team@lge.com
Subject: Re: possible circular locking dependency detected [was: linux-next: Tree for Aug 22]
Date: Wed, 23 Aug 2017 11:49:51 +0800 [thread overview]
Message-ID: <20170823034951.GG11771@tardis> (raw)
In-Reply-To: <20170823000304.GK20323@X58A-UD3R>
Hi Byungchul,
On Wed, Aug 23, 2017 at 09:03:04AM +0900, Byungchul Park wrote:
> On Tue, Aug 22, 2017 at 09:43:56PM +0000, Bart Van Assche wrote:
> > On Tue, 2017-08-22 at 19:47 +0900, Sergey Senozhatsky wrote:
> > > ======================================================
> > > WARNING: possible circular locking dependency detected
> > > 4.13.0-rc6-next-20170822-dbg-00020-g39758ed8aae0-dirty #1746 Not tainted
> > > ------------------------------------------------------
> > > fsck.ext4/148 is trying to acquire lock:
> > > (&bdev->bd_mutex){+.+.}, at: [<ffffffff8116e73e>] __blkdev_put+0x33/0x190
> > >
> > > but now in release context of a crosslock acquired at the following:
> > > ((complete)&wait#2){+.+.}, at: [<ffffffff812159e0>] blk_execute_rq+0xbb/0xda
> > >
> > > which lock already depends on the new lock.
> > >
I felt this message really misleading, because the deadlock is detected
at the commit time of "((complete)&wait#2)" rather than the acquisition
time of "(&bdev->bd_mutex)", so I made the following improvement.
Thoughts?
Regards,
Boqun
----------------------->8
From: Boqun Feng <boqun.feng@gmail.com>
Date: Wed, 23 Aug 2017 10:18:30 +0800
Subject: [PATCH] lockdep: Improve the readibility of crossrelease related
splats
When a crossrelease related deadlock is detected in a commit, the
current implemention makes splats like:
> fsck.ext4/148 is trying to acquire lock:
> (&bdev->bd_mutex){+.+.}, at: [<ffffffff8116e73e>] __blkdev_put+0x33/0x190
>
> but now in release context of a crosslock acquired at the following:
> ((complete)&wait#2){+.+.}, at: [<ffffffff812159e0>] blk_execute_rq+0xbb/0xda
>
> which lock already depends on the new lock.
> ...
However, it could be misleading because the current task has got the
lock already, and in fact the deadlock is detected when it is doing the
commit of the crossrelease lock. So make the splats more accurate to
describe the deadlock case.
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
kernel/locking/lockdep.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 66011c9f5df3..642fb5362507 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1195,17 +1195,23 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth,
pr_warn("WARNING: possible circular locking dependency detected\n");
print_kernel_ident();
pr_warn("------------------------------------------------------\n");
- pr_warn("%s/%d is trying to acquire lock:\n",
- curr->comm, task_pid_nr(curr));
- print_lock(check_src);
- if (cross_lock(check_tgt->instance))
- pr_warn("\nbut now in release context of a crosslock acquired at the following:\n");
- else
+ if (cross_lock(check_tgt->instance)) {
+ pr_warn("%s/%d is committing a crossrelease lock:\n",
+ curr->comm, task_pid_nr(curr));
+ print_lock(check_tgt);
+ pr_warn("\n, with the following lock held:\n");
+ print_lock(check_src);
+ pr_warn("\non which lock the crossrelease lock already depends.\n\n");
+ } else {
+ pr_warn("%s/%d is trying to acquire lock:\n",
+ curr->comm, task_pid_nr(curr));
+ print_lock(check_src);
pr_warn("\nbut task is already holding lock:\n");
+ print_lock(check_tgt);
+ pr_warn("\nwhich lock already depends on the new lock.\n\n");
+ }
- print_lock(check_tgt);
- pr_warn("\nwhich lock already depends on the new lock.\n\n");
pr_warn("\nthe existing dependency chain (in reverse order) is:\n");
print_circular_bug_entry(entry, depth);
--
2.14.1
next prev parent reply other threads:[~2017-08-23 3:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170822183816.7925e0f8@canb.auug.org.au>
2017-08-22 10:47 ` possible circular locking dependency detected [was: linux-next: Tree for Aug 22] Sergey Senozhatsky
2017-08-22 21:43 ` Bart Van Assche
2017-08-23 0:03 ` Byungchul Park
2017-08-23 2:36 ` Sergey Senozhatsky
2017-08-23 2:59 ` Byungchul Park
2017-08-23 3:49 ` Boqun Feng [this message]
2017-08-23 4:38 ` Boqun Feng
2017-08-23 4:46 ` Sergey Senozhatsky
2017-08-23 5:35 ` Boqun Feng
2017-08-23 5:44 ` Sergey Senozhatsky
2017-08-23 5:55 ` Sergey Senozhatsky
2017-08-24 4:39 ` Boqun Feng
2017-08-24 4:49 ` Sergey Senozhatsky
2017-08-23 5:44 ` Byungchul Park
2017-08-23 4:46 ` Byungchul Park
2017-08-23 5:01 ` Boqun Feng
2017-08-23 7:53 ` Peter Zijlstra
2017-08-30 5:20 ` Sergey Senozhatsky
2017-08-30 5:43 ` Byungchul Park
2017-08-30 6:15 ` Sergey Senozhatsky
2017-08-30 8:42 ` Peter Zijlstra
2017-08-30 8:47 ` Peter Zijlstra
2017-08-30 8:53 ` Byungchul Park
2017-08-30 12:30 ` Sergey Senozhatsky
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=20170823034951.GG11771@tardis \
--to=boqun.feng@gmail.com \
--cc=Bart.VanAssche@wdc.com \
--cc=axboe@kernel.dk \
--cc=byungchul.park@lge.com \
--cc=kernel-team@lge.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peterz@infradead.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sfr@canb.auug.org.au \
/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