The kernel has several means to help debug difficult situations with regard to kernel-level locking issues, deadlock being a primary one.
Just in case you haven't already, do ensure you've first read the basics on synchronization, locking, and deadlock guidelines from the previous chapter (Chapter 6, Kernel Synchronization – Part 1, especially the Exclusive execution and atomicity and Concurrency concerns within the Linux kernel sections).
With any debug scenario, there are different points at which debugging occurs, and thus perhaps differing tools and techniques that should/could be used. Very broadly speaking, a bug might be noticed at, and thus debugged at, a few different points in time (within the Software Development Life Cycle (SDLC), really):
- During development
- After development but before release (testing, Quality Assurance (QA), and so on)
- After internal release
- After release, in the field...