Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_turnstile.c
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | #ifndef SMP | ||||
KASSERT(td != curthread, ("Deadlock detected")); | KASSERT(td != curthread, ("Deadlock detected")); | ||||
#endif | #endif | ||||
/* | /* | ||||
* If we aren't blocked on a lock, we should be. | * If we aren't blocked on a lock, we should be. | ||||
*/ | */ | ||||
KASSERT(TD_ON_LOCK(td), ( | KASSERT(TD_ON_LOCK(td), ( | ||||
"thread %d(%s):%d holds %s but isn't blocked on a lock\n", | "thread %d(%s):%d holds %s but isn't blocked on a lock\n", | ||||
td->td_tid, td->td_name, td->td_state, | td->td_tid, td->td_name, TD_GET_STATE(td), | ||||
ts->ts_lockobj->lo_name)); | ts->ts_lockobj->lo_name)); | ||||
/* | /* | ||||
* Pick up the lock that td is blocked on. | * Pick up the lock that td is blocked on. | ||||
*/ | */ | ||||
ts = td->td_blocked; | ts = td->td_blocked; | ||||
MPASS(ts != NULL); | MPASS(ts != NULL); | ||||
THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); | THREAD_LOCKPTR_ASSERT(td, &ts->ts_lock); | ||||
▲ Show 20 Lines • Show All 880 Lines • ▼ Show 20 Lines | print_lockchain(struct thread *td, const char *prefix) | ||||
*/ | */ | ||||
while (!db_pager_quit) { | while (!db_pager_quit) { | ||||
if (td == (void *)LK_KERNPROC) { | if (td == (void *)LK_KERNPROC) { | ||||
db_printf("%sdisowned (LK_KERNPROC)\n", prefix); | db_printf("%sdisowned (LK_KERNPROC)\n", prefix); | ||||
return; | return; | ||||
} | } | ||||
db_printf("%sthread %d (pid %d, %s) is ", prefix, td->td_tid, | db_printf("%sthread %d (pid %d, %s) is ", prefix, td->td_tid, | ||||
td->td_proc->p_pid, td->td_name); | td->td_proc->p_pid, td->td_name); | ||||
switch (td->td_state) { | switch (TD_GET_STATE(td)) { | ||||
case TDS_INACTIVE: | case TDS_INACTIVE: | ||||
db_printf("inactive\n"); | db_printf("inactive\n"); | ||||
return; | return; | ||||
case TDS_CAN_RUN: | case TDS_CAN_RUN: | ||||
db_printf("runnable\n"); | db_printf("runnable\n"); | ||||
return; | return; | ||||
case TDS_RUNQ: | case TDS_RUNQ: | ||||
db_printf("on a run queue\n"); | db_printf("on a run queue\n"); | ||||
Show All 22 Lines | case TDS_INHIBITED: | ||||
if (owner == NULL) | if (owner == NULL) | ||||
return; | return; | ||||
td = owner; | td = owner; | ||||
break; | break; | ||||
} | } | ||||
db_printf("inhibited: %s\n", KTDSTATE(td)); | db_printf("inhibited: %s\n", KTDSTATE(td)); | ||||
return; | return; | ||||
default: | default: | ||||
db_printf("??? (%#x)\n", td->td_state); | db_printf("??? (%#x)\n", TD_GET_STATE(td)); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
DB_SHOW_COMMAND(lockchain, db_show_lockchain) | DB_SHOW_COMMAND(lockchain, db_show_lockchain) | ||||
{ | { | ||||
struct thread *td; | struct thread *td; | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |