Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1199819
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: qrwlock && read-after-read |
| Date | 2015-08-04 15:20 +0200 |
| Message-ID | <pTKim-3aR-13@gated-at.bofh.it> (permalink) |
| References | <pTK8F-2Zr-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
qrwlock && read-after-read Oleg Nesterov <oleg@redhat.com> - 2015-08-04 15:10 +0200
Re: qrwlock && read-after-read Peter Zijlstra <peterz@infradead.org> - 2015-08-04 15:20 +0200
Re: qrwlock && read-after-read Oleg Nesterov <oleg@redhat.com> - 2015-08-04 15:50 +0200
Re: qrwlock && read-after-read Peter Zijlstra <peterz@infradead.org> - 2015-08-04 19:40 +0200
Re: qrwlock && read-after-read Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-04 16:00 +0200
Re: qrwlock && read-after-read Oleg Nesterov <oleg@redhat.com> - 2015-08-05 15:20 +0200
csiph-web