[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150804130053.GA22608@redhat.com>
Date: Tue, 4 Aug 2015 15:00:53 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Paul E.McKenney" <paulmck@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Waiman Long <Waiman.Long@...com>
Cc: linux-kernel@...r.kernel.org
Subject: qrwlock && read-after-read
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?
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists