aboutsummaryrefslogtreecommitdiffstats
path: root/lib/locking-selftest.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2019-02-14 18:00:44 -0500
committerIngo Molnar <mingo@kernel.org>2019-02-28 01:55:43 -0500
commitcdc84d794947b5431c0a6916c303aee7114819d2 (patch)
treeed685700c082db656b3ae7db4fc8977b451eb709 /lib/locking-selftest.c
parent956f3563a8387beb7758f2e8ee483639ef91afc6 (diff)
locking/lockdep: Make it easy to detect whether or not inside a selftest
The patch that frees unused lock classes will modify the behavior of lockdep_free_key_range() and lockdep_reset_lock() depending on whether or not these functions are called from the context of the lockdep selftests. Hence make it easy to detect whether or not lockdep code is called from the context of a lockdep selftest. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <longman@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Cc: johannes.berg@intel.com Cc: tj@kernel.org Link: https://lkml.kernel.org/r/20190214230058.196511-10-bvanassche@acm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/locking-selftest.c')
-rw-r--r--lib/locking-selftest.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c
index 1e1bbf171eca..a1705545e6ac 100644
--- a/lib/locking-selftest.c
+++ b/lib/locking-selftest.c
@@ -1989,6 +1989,7 @@ void locking_selftest(void)
1989 1989
1990 init_shared_classes(); 1990 init_shared_classes();
1991 debug_locks_silent = !debug_locks_verbose; 1991 debug_locks_silent = !debug_locks_verbose;
1992 lockdep_set_selftest_task(current);
1992 1993
1993 DO_TESTCASE_6R("A-A deadlock", AA); 1994 DO_TESTCASE_6R("A-A deadlock", AA);
1994 DO_TESTCASE_6R("A-B-B-A deadlock", ABBA); 1995 DO_TESTCASE_6R("A-B-B-A deadlock", ABBA);
@@ -2097,5 +2098,6 @@ void locking_selftest(void)
2097 printk("---------------------------------\n"); 2098 printk("---------------------------------\n");
2098 debug_locks = 1; 2099 debug_locks = 1;
2099 } 2100 }
2101 lockdep_set_selftest_task(NULL);
2100 debug_locks_silent = 0; 2102 debug_locks_silent = 0;
2101} 2103}