Back to home page

LXR

 
 

    


0001 /*
0002  * lib/debug_locks.c
0003  *
0004  * Generic place for common debugging facilities for various locks:
0005  * spinlocks, rwlocks, mutexes and rwsems.
0006  *
0007  * Started by Ingo Molnar:
0008  *
0009  *  Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
0010  */
0011 #include <linux/rwsem.h>
0012 #include <linux/mutex.h>
0013 #include <linux/export.h>
0014 #include <linux/spinlock.h>
0015 #include <linux/debug_locks.h>
0016 
0017 /*
0018  * We want to turn all lock-debugging facilities on/off at once,
0019  * via a global flag. The reason is that once a single bug has been
0020  * detected and reported, there might be cascade of followup bugs
0021  * that would just muddy the log. So we report the first one and
0022  * shut up after that.
0023  */
0024 int debug_locks = 1;
0025 EXPORT_SYMBOL_GPL(debug_locks);
0026 
0027 /*
0028  * The locking-testsuite uses <debug_locks_silent> to get a
0029  * 'silent failure': nothing is printed to the console when
0030  * a locking bug is detected.
0031  */
0032 int debug_locks_silent;
0033 EXPORT_SYMBOL_GPL(debug_locks_silent);
0034 
0035 /*
0036  * Generic 'turn off all lock debugging' function:
0037  */
0038 int debug_locks_off(void)
0039 {
0040     if (__debug_locks_off()) {
0041         if (!debug_locks_silent) {
0042             console_verbose();
0043             return 1;
0044         }
0045     }
0046     return 0;
0047 }
0048 EXPORT_SYMBOL_GPL(debug_locks_off);