locking/rwsem: Check for operations on an uninitialized rwsem
authorDavidlohr Bueso <dave@stgolabs.net>
Mon, 29 Jul 2019 04:47:35 +0000 (21:47 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 6 Aug 2019 10:49:15 +0000 (12:49 +0200)
commitfce45cd41101f1a9620267146b21f09b3454d8db
treeff8142e67c6ec7cb5d6ed8aa0a7e662bfe57ce1a
parent91d2a812dfb98b3b4dad661529c33bc38d303461
locking/rwsem: Check for operations on an uninitialized rwsem

Currently rwsems is the only locking primitive that lacks this
debug feature. Add it under CONFIG_DEBUG_RWSEMS and do the magic
checking in the locking fastpath (trylock) operation such that
we cover all cases. The unlocking part is pretty straightforward.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Waiman Long <longman@redhat.com>
Cc: mingo@kernel.org
Cc: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lkml.kernel.org/r/20190729044735.9632-1-dave@stgolabs.net
include/linux/rwsem.h
kernel/locking/rwsem.c