kth: Clean up sem/cv debugging
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 7 Nov 2018 20:32:43 +0000 (15:32 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 14 Dec 2018 22:23:48 +0000 (17:23 -0500)
commit7dd2d53d7f13e22d44204bc512562b9fbf817c4a
tree20a31842ef9557d7654c4bccba7afc28f5f9681f
parent150e3785156e67eb6f4ce8264076334436f07860
kth: Clean up sem/cv debugging

The old debug code was specific to semaphores, but it also suffered due
to lock inversion.  The old lock order was list_lock->sem_lock.  That
was to avoid issues when printing.  However, we can just use a trylock.
I might not have had that when I wrote the DB code.  This is more
important now, since cv_wait() is called with the lock already held.

The old DB code also was called regardless of whether or not we blocked.
Instead, we can just track when we actually block - which is *always*
for the CVs.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/kthread.h
kern/src/kthread.c