diff options
author | jhb <jhb@FreeBSD.org> | 2001-02-24 19:36:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-02-24 19:36:13 +0000 |
commit | 59969ced20b255615798fa7ab873b19582a17c19 (patch) | |
tree | e94ed0ba6989624c35b754ece79bcabee7084157 /sys/kern/subr_witness.c | |
parent | 8ada239f48aa392d6e63f11b5dd95cbe7fd2988f (diff) | |
download | FreeBSD-src-59969ced20b255615798fa7ab873b19582a17c19.zip FreeBSD-src-59969ced20b255615798fa7ab873b19582a17c19.tar.gz |
- Axe RETIP() as it was very i386 specific and unwieldy. Instead, use the
passed in filename and line number in the KTR tracepoint message.
- Even though it is #if 0'd code, change the code to detect that a process
is an interrupt thread to check p->p_ithd against NULL rather than
checking non-existant process flags from BSD/OS.
- Use '%p' to print pointers in KTR log messages instead of assuming
sizeof(int) == sizeof(void *).
- Don't set p_mtxname to NULL when releasing a mutex. It doesn't hurt
to leave it set (we don't clear w_mesg for example) and at least at
one time in the past, there used to be race conditions in the kernel
that would result in setting this to NULL causing the kernel to
dereference NULL.
- Make the _mtx_assert() function be compiled in if INVARIANTS_SUPPORT is
defined rather than if INVARIANTS is defined so that a KLD compiled
with INVARIANTS that uses mtx_assert() can be used with a kernel that
just has INVARIANT_SUPPORT compiled in.
Diffstat (limited to 'sys/kern/subr_witness.c')
-rw-r--r-- | sys/kern/subr_witness.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 9fe20a1..40cc471 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -105,7 +105,6 @@ struct mtx_debug { #define mtx_owner(m) (mtx_unowned((m)) ? NULL \ : (struct proc *)((m)->mtx_lock & MTX_FLAGMASK)) -#define RETIP(x) *(((uintptr_t *)(&x)) - 1) #define SET_PRIO(p, pri) (p)->p_pri.pri_level = (pri) /* @@ -310,7 +309,7 @@ _mtx_trylock(struct mtx *m, int opts, const char *file, int line) #endif /* WITNESS */ if ((opts & MTX_QUIET) == 0) - CTR5(KTR_LOCK, "TRY_ENTER %s [%p] result=%d at %s:%d", + CTR5(KTR_LOCK, "TRY_LOCK %s [%p] result=%d at %s:%d", m->mtx_description, m, rval, file, line); return rval; @@ -336,8 +335,9 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) } if ((opts & MTX_QUIET) == 0) - CTR3(KTR_LOCK, "_mtx_lock_sleep: %p contested (lock=%p) [%p]", - m, (void *)m->mtx_lock, (void *)RETIP(m)); + CTR4(KTR_LOCK, + "_mtx_lock_sleep: %s contested (lock=%p) at %s:%d", + m->mtx_description, (void *)m->mtx_lock, file, line); /* * Save our priority. Even though p_nativepri is protected by @@ -401,13 +401,13 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) * If we're borrowing an interrupted thread's VM context, we * must clean up before going to sleep. */ - if (p->p_flag & (P_ITHD | P_SITHD)) { - ithd_t *it = (ithd_t *)p; + if (p->p_ithd != NULL) { + struct ithd *it = p->p_ithd; if (it->it_interrupted) { if ((opts & MTX_QUIET) == 0) CTR2(KTR_LOCK, - "_mtx_lock_sleep: 0x%x interrupted 0x%x", + "_mtx_lock_sleep: %p interrupted %p", it, it->it_interrupted); intr_thd_fixup(it); } @@ -556,19 +556,18 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line) m, p1); p1->p_blocked = NULL; - p1->p_mtxname = NULL; p1->p_stat = SRUN; setrunqueue(p1); if ((opts & MTX_NOSWITCH) == 0 && p1->p_pri.pri_level < pri) { #ifdef notyet - if (p->p_flag & (P_ITHD | P_SITHD)) { - ithd_t *it = (ithd_t *)p; + if (p->p_ithd != NULL) { + struct ithd *it = p->p_ithd; if (it->it_interrupted) { if ((opts & MTX_QUIET) == 0) CTR2(KTR_LOCK, - "_mtx_unlock_sleep: 0x%x interrupted 0x%x", + "_mtx_unlock_sleep: %p interrupted %p", it, it->it_interrupted); intr_thd_fixup(it); } @@ -597,9 +596,9 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line) */ /* - * The INVARIANTS-enabled mtx_assert() + * The backing function for the INVARIANTS-enabled mtx_assert() */ -#ifdef INVARIANTS +#ifdef INVARIANTS_SUPPORT void _mtx_assert(struct mtx *m, int what, const char *file, int line) { |