From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
"Paul E.McKenney" <paulmck@linux.vnet.ibm.com>,
Waiman Long <Waiman.Long@hp.com>,
linux-kernel@vger.kernel.org
Subject: Re: qrwlock && read-after-read
Date: Tue, 4 Aug 2015 15:10:36 +0200 [thread overview]
Message-ID: <20150804131036.GQ25159@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150804130053.GA22608@redhat.com>
On Tue, Aug 04, 2015 at 03:00:53PM +0200, Oleg Nesterov wrote:
> I am working on the (off-topic) bug report which motivated me to
> look at locking/qrwlock.c and it seems to me there is a problem
> with the queued rwlocks.
>
> Unless I am totally confused read-after-read is no longer valid,
> write_lock() stops the new readers. And lockdep doesn't know this,
> read_lock()->rwlock_acquire_read() doesn't match the reality. The
> code doing
>
> read_lock(X);
> read_lock(X);
>
> can deadlock if another CPU does write_lock(X) in between. This
> was fine before rwlock_t was changed to use qrwlock.
>
> A nested read_lock() in interrupt should be fine though, and this
> is because queue_read_lock_slowpath() "ignores" _QW_WAITING if
> in_interrupt().
>
> This means that rwlock_t has the really strange semantics imho,
> and again, it is not lockdep-friendly.
>
> What do you think we can/should do? Or did I misread this code?
Fix lockdep, although that's non trivial from what I remember.
These (new) semantics were very much on purpose and suggested by Linus
IIRC.
next prev parent reply other threads:[~2015-08-04 13:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 13:00 Oleg Nesterov
2015-08-04 13:10 ` Peter Zijlstra [this message]
2015-08-04 13:40 ` Oleg Nesterov
2015-08-04 17:32 ` Peter Zijlstra
2015-08-04 13:51 ` Linus Torvalds
2015-08-05 13:08 ` Oleg Nesterov
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=20150804131036.GQ25159@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Waiman.Long@hp.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--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
Powered by JetHome