From: Dave Chinner <david@fromorbit.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org,
Johannes Berg <johannes.berg@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH RFC] kernel/locking, fs/direct-io: Introduce and use down_write_nolockdep()
Date: Sat, 27 Oct 2018 16:37:45 +1100 [thread overview]
Message-ID: <20181027053745.GI6311@dastard> (raw)
In-Reply-To: <20181026164905.214474-1-bvanassche@acm.org>
On Fri, Oct 26, 2018 at 09:49:05AM -0700, Bart Van Assche wrote:
> The rwsem locking functions contain lockdep annotations (down_write(),
> up_write(), down_read(), up_read(), ...). Unfortunately lockdep and
> semaphores are not a good match because lockdep assumes that releasing
> a synchronization object will happen from the same kernel thread that
> acquired the synchronization object. This is the case for most but not
> all semaphore locking calls. When a semaphore is released from another
> context than the context from which it has been acquired lockdep may
> report a false positive circular locking report. This patch avoids
> that lockdep reports the false positive report shown below for the
> direct I/O code. Please note that the lockdep complaint shown below is
> not the same as a closely related lockdep complaint that has been
> reported recently by syzbot. This patch has been tested on top of a
> patch that was suggested by Ted and Tejun, namely to change a
> destroy_workqueue() call in the direct-io code into a call to
> destroy_workqueue_no_drain(). For the syzbot report and the discussion
> of that report, see also https://lkml.org/lkml/2018/10/23/511.
FWIW, it kinda looks like you're recreating the rwsem debugging
wrapper that's been in fs/xfs/mrlock.h since XFS was first ported to
Linux.
As an API, however, this needs to be consistent with
down_read_non_owner()/up_read_non_owner() which are for exactly this
same issue issue (different acquire/release contexts) on the read
side of the rwsem. Indeed, it can probably use the same
infrastructure...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-10-27 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 16:49 [PATCH RFC] kernel/locking, fs/direct-io: Introduce and use down_write_nolockdep() Bart Van Assche
2018-10-26 17:43 ` Matthew Wilcox
2018-10-26 18:11 ` Bart Van Assche
2018-10-26 18:38 ` Matthew Wilcox
2018-10-26 19:12 ` Bart Van Assche
2018-10-27 5:37 ` Dave Chinner [this message]
2018-10-28 17:58 ` Peter Zijlstra
2018-10-28 20:34 ` Christoph Hellwig
2018-10-28 20:45 ` Bart Van Assche
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=20181027053745.GI6311@dastard \
--to=david@fromorbit.com \
--cc=bvanassche@acm.org \
--cc=johannes.berg@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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).