Add witness warnings to panic if a thread tries to exit while holding any

locks.

Requested by:	jeff
MFC after:	3 days
This commit is contained in:
John Baldwin 2005-09-02 20:20:01 +00:00
parent 6064e568ec
commit 83de502d59
2 changed files with 5 additions and 0 deletions

View File

@ -487,6 +487,9 @@ exit1(struct thread *td, int rv)
*/ */
cpu_exit(td); cpu_exit(td);
WITNESS_WARN(WARN_PANIC, &proctree_lock.sx_object,
"process (pid %d) exiting", p->p_pid);
PROC_LOCK(p); PROC_LOCK(p);
PROC_LOCK(p->p_pptr); PROC_LOCK(p->p_pptr);
sx_xunlock(&proctree_lock); sx_xunlock(&proctree_lock);

View File

@ -1313,6 +1313,8 @@ thread_userret(struct thread *td, struct trapframe *frame)
PROC_LOCK(p); PROC_LOCK(p);
if (kg->kg_upsleeps) if (kg->kg_upsleeps)
wakeup(&kg->kg_completed); wakeup(&kg->kg_completed);
WITNESS_WARN(WARN_PANIC, &p->p_mtx.mtx_object,
"thread exiting in userret");
mtx_lock_spin(&sched_lock); mtx_lock_spin(&sched_lock);
thread_stopped(p); thread_stopped(p);
thread_exit(); thread_exit();