When trying to walk lock chains, we have to deduce what a thread is
blocked on. Checking LOCK_CLASS(td->td_wchan) is not a very reliable
method by itself, as it just tests whether a particular 4 bits near
where td_wchan points have a particular value. Misinterpreting wait
channel pointers of other sleeps as lockmgr locks would frequently cause
ddb show allchains (or show lockchain) to trap, or to produce incorrect
output.
Now, check the sleepq_type. When calling sleepq_add, we use SLEEPQ_LK
for lockmgr locks and SLEEPQ_SX for sx locks. This is a more reliable
indication that the td_wchan is actually a lock.
While here, also make the output of lockmgr and sx locks consistent with
the output for other locks (see print_lockchain). Outputting a pointer
to the lock allows it to be inspected further with ddb show lock or
other methods.
Sponsored by: Dell Inc.