WARN_ON()
and BUG_ON()
macros for run-time assertions.pr_debug
based output in kernel message ring bufferccflags-y += -DDEBUG
preempt_disable()
, see preempt-locking.txt for other methods.irqs_disabled()
and in_interrupt()
are very helpful regarding protection of non-preemptive code (see also the comments at Stack Overflow).