From: Dave Chinner <david@fromorbit.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>, xfs@oss.sgi.com
Subject: Re: [PATCH, RFC] xfs: remove i_iolock and use i_rwsem in the VFS inode instead
Date: Fri, 9 Sep 2016 11:06:01 +1000 [thread overview]
Message-ID: <20160909010601.GC30056@dastard> (raw)
In-Reply-To: <20160908065442.GV10138@twins.programming.kicks-ass.net>
On Thu, Sep 08, 2016 at 08:54:42AM +0200, Peter Zijlstra wrote:
> On Thu, Sep 08, 2016 at 07:45:36AM +1000, Dave Chinner wrote:
> > On Mon, Sep 05, 2016 at 05:15:29PM +0200, Christoph Hellwig wrote:
> > > Hi Dave,
> > >
> > > I looked into killing the mrlock and ran into an unexpected problem.
> > >
> > > Currently mr_writer tracks that there is someone holding a write lock,
> > > lockdep on the other hand checks if the calling thread has that lock.
> > >
> > > While that generally is the right semantic, our hack to offload
> > > btree splits to a work item offends lockdep. E.g. this callstack
> > > now asserts:
> >
> > It's a semaphore, not a mutex. Semaphore locking is independent of
> > task context, the lock follows the object it protects, not the task
> > that took the lock. i.e. Lockdep is wrong to assume the "owner" of a
> > rw_sem will not change between lock and unlock.
>
> We've added strict owner semantics to rwsem a long time ago.
/me sighs.
History repeats.
We went through all this crap about semaphores and strict ownership
a few years ago when someone tried to make the struct semaphore
require strict ownership and XFS went all explodey. :/
> If you want the actual semaphore semantics (which we greatly discourage,
> because you cannot do validation on it)
What you actually means is "you cannot use /lockdep/ on it", not
"cannot do validation" on it. Indeed, this discussion started from
wanting to remove the wrappers that implement XFS context
specific locking validation on top of rwsems.
Yes, lockdep has it's uses, but let's not ignore the fact that it
also has significant limitations, introduces serious annotation
complexity for non-trivial locking models (e.g. XFS inodes), and
many people use it as a crutch to avoid thinking about locking
models (i.e. "lockdep doesn't complain, so it must be good!").
>From my perspective, lockdep is a very poor replacement for
architecting a robust locking model and then implementing code that
directly asserts that the correct locks are held at the correct
time. We trip over failed XFS locking asserts during development all
the time, but it's very, very rare to have lockdep tell us we have a
problem in XFS because we catch the problems long before lockdep
will notice them.
> you should use
> {down,up}_read_non_owner().
> I'm not sure we've got write_non_owner() variants for this.
For the case Christoph reported, it's the write side context of the
inode locks that is handed off to other threads. And no, we don't
have annotations for that.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-09-09 1:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 17:10 [PATCH, RFC] xfs: remove i_iolock and use i_rwsem in the VFS inode instead Christoph Hellwig
2016-08-11 21:54 ` Peter Zijlstra
2016-08-18 17:37 ` Christoph Hellwig
2016-08-19 13:27 ` Peter Zijlstra
2016-08-20 6:37 ` Christoph Hellwig
2016-08-22 8:34 ` Peter Zijlstra
2016-09-05 15:12 ` Christoph Hellwig
2016-09-07 7:43 ` Peter Zijlstra
2016-09-08 6:06 ` Ingo Molnar
2016-08-11 23:43 ` Dave Chinner
2016-08-12 2:50 ` Christoph Hellwig
2016-08-12 9:58 ` Dave Chinner
2016-09-05 15:15 ` Christoph Hellwig
2016-09-07 21:45 ` Dave Chinner
2016-09-08 6:54 ` Peter Zijlstra
2016-09-09 1:06 ` Dave Chinner [this message]
2016-09-09 8:21 ` Peter Zijlstra
2016-09-09 8:34 ` Christoph Hellwig
2016-09-11 0:17 ` Dave Chinner
2016-09-13 19:42 ` Peter Zijlstra
2016-09-09 8:33 ` Christoph Hellwig
2016-09-09 8:44 ` Peter Zijlstra
2016-09-09 9:05 ` Christoph Hellwig
2016-09-09 9:51 ` Peter Zijlstra
2016-09-10 16:20 ` Christoph Hellwig
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=20160909010601.GC30056@dastard \
--to=david@fromorbit.com \
--cc=hch@lst.de \
--cc=peterz@infradead.org \
--cc=xfs@oss.sgi.com \
/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).