From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [btrfs/rt] lockdep false positive
Date: Wed, 25 Jan 2017 19:29:49 +0100 [thread overview]
Message-ID: <1485368989.5150.60.camel@gmail.com> (raw)
In-Reply-To: <20170125170209.h6tqr6zgaq6ojmco@linutronix.de>
On Wed, 2017-01-25 at 18:02 +0100, Sebastian Andrzej Siewior wrote:
> > [ 341.960794] CPU0
> > [ 341.960795] ----
> > [ 341.960795] lock(btrfs-tree-00);
> > [ 341.960795] lock(btrfs-tree-00);
> > [ 341.960796]
> > [ 341.960796] *** DEADLOCK ***
> > [ 341.960796]
> > [ 341.960796] May be due to missing lock nesting notation
> > [ 341.960796]
> > [ 341.960796] 6 locks held by kworker/u8:9/2039:
> > [ 341.960797] #0: ("%s-%s""btrfs", name){.+.+..}, at: [] process_one_work+0x171/0x700
> > [ 341.960812] #1: ((&work->normal_work)){+.+...}, at: [] process_one_work+0x171/0x700
> > [ 341.960815] #2: (sb_internal){.+.+..}, at: [] start_transaction+0x2a7/0x5a0 [btrfs]
> > [ 341.960825] #3: (btrfs-tree-02){+.+...}, at: [] btrfs_clear_lock_blocking_rw+0x55/0x100 [btrfs]
> > [ 341.960835] #4: (btrfs-tree-01){+.+...}, at: [] btrfs_clear_lock_blocking_rw+0x55/0x100 [btrfs]
> > [ 341.960854] #5: (btrfs-tree-00){+.+...}, at: [] btrfs_clear_lock_blocking_rw+0x55/0x100 [btrfs]
> >
> > Attempting to describe RT rwlock semantics to lockdep prevents this.
>
> and this is what I don't get. I stumbled upon this myself [0] but didn't
> fully understand the problem (assuming this is the same problem colored
> differently).
Yeah, [0] looks like it, though I haven't met an 'fs' variant, my
encounters were always either 'tree' or 'csum' flavors.
> With your explanation I am not sure if I get what is happening. If btrfs
> is taking here read-locks on random locks then it may deadlock if
> another btrfs-thread is doing the same and need each other's locks.
I don't know if a real RT deadlock is possible. I haven't met one,
only variants of this bogus recursion gripe.
> If btrfs takes locks recursively which it already holds (in the same
> context / process) then it shouldn't be visible here because lockdep
> does not account this on -RT.
If what lockdep gripes about were true, we would never see the splat,
we'd zip straight through that (illusion) recursive read_lock() with
lockdep being none the wiser.
> If btrfs takes the locks in a special order for instance only ascending
> according to inode's number then it shouldn't deadlock.
No idea. Locking fancy enough to require dynamic key assignment to
appease lockdep is too fancy for me.
-Mike
next prev parent reply other threads:[~2017-01-25 18:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 8:46 [btrfs/rt] lockdep false positive Mike Galbraith
2017-01-22 17:45 ` Mike Galbraith
2017-01-22 18:25 ` Mike Galbraith
2017-01-23 5:23 ` Mike Galbraith
2017-01-23 9:07 ` Peter Zijlstra
2017-01-25 17:02 ` Sebastian Andrzej Siewior
2017-01-25 18:29 ` Mike Galbraith [this message]
2017-01-26 17:09 ` Sebastian Andrzej Siewior
2017-01-26 18:01 ` Mike Galbraith
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=1485368989.5150.60.camel@gmail.com \
--to=umgwanakikbuti@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).