OSDN Git Service

locking: More accurate annotations for read_lock()
authorBoqun Feng <boqun.feng@gmail.com>
Fri, 7 Aug 2020 07:42:20 +0000 (15:42 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 26 Aug 2020 10:42:02 +0000 (12:42 +0200)
commite918188611f073063415f40fae568fa4d86d9044
tree360f04ba1aeae14a4205a2b74ce0f5090bf70378
parent92b4e9f11a636d1723cc0866bf8b9111b1e24339
locking: More accurate annotations for read_lock()

On the archs using QUEUED_RWLOCKS, read_lock() is not always a recursive
read lock, actually it's only recursive if in_interrupt() is true. So
change the annotation accordingly to catch more deadlocks.

Note we used to treat read_lock() as pure recursive read locks in
lib/locking-seftest.c, and this is useful, especially for the lockdep
development selftest, so we keep this via a variable to force switching
lock annotation for read_lock().

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200807074238.1632519-2-boqun.feng@gmail.com
include/linux/lockdep.h
kernel/locking/lockdep.c
lib/locking-selftest.c