Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] lockdep: kconfig

Offer the following lock validation options:

CONFIG_PROVE_LOCKING

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Ingo Molnar and committed by
Linus Torvalds
4d9f34ad ef5d4707

+96 -2
+96 -2
lib/Kconfig.debug
··· 134 134 This option enables a rt-mutex tester. 135 135 136 136 config DEBUG_SPINLOCK 137 - bool "Spinlock debugging" 137 + bool "Spinlock and rw-lock debugging: basic checks" 138 138 depends on DEBUG_KERNEL 139 139 help 140 140 Say Y here and build SMP to catch missing spinlock initialization ··· 142 142 best used in conjunction with the NMI watchdog so that spinlock 143 143 deadlocks are also debuggable. 144 144 145 + config DEBUG_MUTEXES 146 + bool "Mutex debugging: basic checks" 147 + depends on DEBUG_KERNEL 148 + help 149 + This feature allows mutex semantics violations to be detected and 150 + reported. 151 + 152 + config DEBUG_RWSEMS 153 + bool "RW-sem debugging: basic checks" 154 + depends on DEBUG_KERNEL 155 + help 156 + This feature allows read-write semaphore semantics violations to 157 + be detected and reported. 158 + 159 + config DEBUG_LOCK_ALLOC 160 + bool "Lock debugging: detect incorrect freeing of live locks" 161 + depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 162 + select DEBUG_SPINLOCK 163 + select DEBUG_MUTEXES 164 + select DEBUG_RWSEMS 165 + select LOCKDEP 166 + help 167 + This feature will check whether any held lock (spinlock, rwlock, 168 + mutex or rwsem) is incorrectly freed by the kernel, via any of the 169 + memory-freeing routines (kfree(), kmem_cache_free(), free_pages(), 170 + vfree(), etc.), whether a live lock is incorrectly reinitialized via 171 + spin_lock_init()/mutex_init()/etc., or whether there is any lock 172 + held during task exit. 173 + 174 + config PROVE_LOCKING 175 + bool "Lock debugging: prove locking correctness" 176 + depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 177 + select LOCKDEP 178 + select DEBUG_SPINLOCK 179 + select DEBUG_MUTEXES 180 + select DEBUG_RWSEMS 181 + select DEBUG_LOCK_ALLOC 182 + default n 183 + help 184 + This feature enables the kernel to prove that all locking 185 + that occurs in the kernel runtime is mathematically 186 + correct: that under no circumstance could an arbitrary (and 187 + not yet triggered) combination of observed locking 188 + sequences (on an arbitrary number of CPUs, running an 189 + arbitrary number of tasks and interrupt contexts) cause a 190 + deadlock. 191 + 192 + In short, this feature enables the kernel to report locking 193 + related deadlocks before they actually occur. 194 + 195 + The proof does not depend on how hard and complex a 196 + deadlock scenario would be to trigger: how many 197 + participant CPUs, tasks and irq-contexts would be needed 198 + for it to trigger. The proof also does not depend on 199 + timing: if a race and a resulting deadlock is possible 200 + theoretically (no matter how unlikely the race scenario 201 + is), it will be proven so and will immediately be 202 + reported by the kernel (once the event is observed that 203 + makes the deadlock theoretically possible). 204 + 205 + If a deadlock is impossible (i.e. the locking rules, as 206 + observed by the kernel, are mathematically correct), the 207 + kernel reports nothing. 208 + 209 + NOTE: this feature can also be enabled for rwlocks, mutexes 210 + and rwsems - in which case all dependencies between these 211 + different locking variants are observed and mapped too, and 212 + the proof of observed correctness is also maintained for an 213 + arbitrary combination of these separate locking variants. 214 + 215 + For more details, see Documentation/lockdep-design.txt. 216 + 217 + config LOCKDEP 218 + bool 219 + depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 220 + select STACKTRACE 221 + select FRAME_POINTER 222 + select KALLSYMS 223 + select KALLSYMS_ALL 224 + 225 + config DEBUG_LOCKDEP 226 + bool "Lock dependency engine debugging" 227 + depends on LOCKDEP 228 + help 229 + If you say Y here, the lock dependency engine will do 230 + additional runtime checks to debug itself, at the price 231 + of more runtime overhead. 232 + 233 + config TRACE_IRQFLAGS 234 + bool 235 + default y 236 + depends on TRACE_IRQFLAGS_SUPPORT 237 + depends on PROVE_LOCKING 238 + 145 239 config DEBUG_SPINLOCK_SLEEP 146 - bool "Sleep-inside-spinlock checking" 240 + bool "Spinlock debugging: sleep-inside-spinlock checking" 147 241 depends on DEBUG_KERNEL 148 242 help 149 243 If you say Y here, various routines which may sleep will become very