diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-04 21:03:05 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-04 21:03:05 +0000 |
commit | e4bcd25517da2e44fd854859cc6ead7dcfe3df3a (patch) | |
tree | d32954415444ccb8c42b0a457f6f0e6e15a0d64e | |
parent | e87dfc0cdec66dcab96cfd816e8a33d1c59dc261 (diff) | |
download | FreeBSD-src-e4bcd25517da2e44fd854859cc6ead7dcfe3df3a.zip FreeBSD-src-e4bcd25517da2e44fd854859cc6ead7dcfe3df3a.tar.gz |
Replace calls to WITNESS_SLEEP() and witness_list() with equivalent calls
to WITNESS_WARN().
-rw-r--r-- | sys/alpha/alpha/trap.c | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 9 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 9 | ||||
-rw-r--r-- | sys/ia64/ia64/trap.c | 17 | ||||
-rw-r--r-- | sys/kern/kern_condvar.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_lock.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_mac.c | 5 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 3 | ||||
-rw-r--r-- | sys/kern/subr_mbuf.c | 11 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 5 | ||||
-rw-r--r-- | sys/powerpc/aim/trap.c | 8 | ||||
-rw-r--r-- | sys/powerpc/powerpc/trap.c | 8 | ||||
-rw-r--r-- | sys/security/mac/mac_framework.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_internal.h | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_net.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_pipe.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_process.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_syscalls.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_system.c | 5 | ||||
-rw-r--r-- | sys/security/mac/mac_vfs.c | 5 | ||||
-rw-r--r-- | sys/sparc64/sparc64/trap.c | 8 | ||||
-rw-r--r-- | sys/vm/uma_core.c | 3 |
24 files changed, 65 insertions, 91 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 718f677..d4df234 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -783,12 +783,8 @@ syscall(code, framep) #ifdef DIAGNOSTIC cred_free_thread(td); #endif -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index ab1f1f0..d29cc07 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1094,13 +1094,8 @@ syscall(frame) #ifdef DIAGNOSTIC cred_free_thread(td); #endif - -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index ab1f1f0..d29cc07 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1094,13 +1094,8 @@ syscall(frame) #ifdef DIAGNOSTIC cred_free_thread(td); #endif - -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/ia64/ia64/trap.c b/sys/ia64/ia64/trap.c index 9aab532..30f43f5 100644 --- a/sys/ia64/ia64/trap.c +++ b/sys/ia64/ia64/trap.c @@ -904,12 +904,8 @@ syscall(int code, u_int64_t *args, struct trapframe *framep) #ifdef DIAGNOSTIC cred_free_thread(td); #endif -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } @@ -1081,13 +1077,8 @@ ia32_syscall(struct trapframe *framep) #ifdef DIAGNOSTIC cred_free_thread(td); #endif - -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c index 87c2840..a95e623 100644 --- a/sys/kern/kern_condvar.c +++ b/sys/kern/kern_condvar.c @@ -199,7 +199,8 @@ cv_wait(struct cv *cvp, struct mtx *mp) ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_SLEEP(0, &mp->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + "Waiting on \"%s\"", cvp->cv_description); WITNESS_SAVE(&mp->mtx_object, mp); if (cold ) { @@ -255,7 +256,8 @@ cv_wait_sig(struct cv *cvp, struct mtx *mp) ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_SLEEP(0, &mp->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + "Waiting on \"%s\"", cvp->cv_description); WITNESS_SAVE(&mp->mtx_object, mp); if (cold || panicstr) { @@ -323,7 +325,8 @@ cv_timedwait(struct cv *cvp, struct mtx *mp, int timo) ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_SLEEP(0, &mp->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + "Waiting on \"%s\"", cvp->cv_description); WITNESS_SAVE(&mp->mtx_object, mp); if (cold || panicstr) { @@ -401,7 +404,8 @@ cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo) ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_SLEEP(0, &mp->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + "Waiting on \"%s\"", cvp->cv_description); WITNESS_SAVE(&mp->mtx_object, mp); if (cold || panicstr) { diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 6ee1c5c..7f8b831 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -240,7 +240,9 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) } if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0) - WITNESS_SLEEP(1, &lkp->lk_interlock->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, + &lkp->lk_interlock->mtx_object, + "Acquiring lockmgr lock \"%s\"", lkp->lk_wmesg); if (panicstr != NULL) { mtx_unlock(lkp->lk_interlock); diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c index e9d9eeb..e98a50c 100644 --- a/sys/kern/kern_mac.c +++ b/sys/kern/kern_mac.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7aa9064..712f76a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1648,7 +1648,8 @@ issignal(td) p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - WITNESS_SLEEP(1, &p->p_mtx.mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.mtx_object, + "Checking for signals"); for (;;) { int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG); diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index c626f7a..3c0d5fa 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -149,7 +149,8 @@ msleep(ident, mtx, priority, wmesg, timo) if (KTRPOINT(td, KTR_CSW)) ktrcsw(1, 0); #endif - WITNESS_SLEEP(0, &mtx->mtx_object); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mtx->mtx_object, + "Sleeping on \"%s\"", wmesg); KASSERT(timo != 0 || mtx_owned(&Giant) || mtx != NULL, ("sleeping without a mutex")); /* diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 05d6185..2c5191c 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1000,7 +1000,8 @@ sysctl_old_user(struct sysctl_req *req, const void *p, size_t l) size_t i = 0; if (req->lock == 1 && req->oldptr) - WITNESS_SLEEP(1, NULL); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "sysctl_old_user()"); if (req->oldptr) { i = l; if (req->oldlen <= req->oldidx) diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index 4facff8..7906ab1 100644 --- a/sys/kern/subr_mbuf.c +++ b/sys/kern/subr_mbuf.c @@ -1038,15 +1038,8 @@ mb_reclaim(void) struct domain *dp; struct protosw *pr; -/* - * XXX: Argh, we almost always trip here with witness turned on now-a-days - * XXX: because we often come in with Giant held. For now, there's no way - * XXX: to avoid this. - */ -#ifdef WITNESS - KASSERT(witness_list(curthread) == 0, - ("mb_reclaim() called with locks held")); -#endif + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK | WARN_PANIC, NULL, + "mb_reclaim()"); mbstat.m_drain++; /* XXX: No consistency. */ diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index da4b7a8..9eb4aed 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -157,10 +157,7 @@ ast(struct trapframe *framep) CTR3(KTR_SYSC, "ast: thread %p (pid %d, %s)", td, p->p_pid, p->p_comm); KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode")); -#ifdef WITNESS - if (witness_list(td)) - panic("Returning to user mode with mutex(s) held"); -#endif + WITNESS_WARN(WARN_PANIC, NULL, "Returning to user mode"); mtx_assert(&Giant, MA_NOTOWNED); mtx_assert(&sched_lock, MA_NOTOWNED); td->td_frame = framep; diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c index 4874093..83f0b86 100644 --- a/sys/powerpc/aim/trap.c +++ b/sys/powerpc/aim/trap.c @@ -473,12 +473,8 @@ syscall(struct trapframe *frame) */ STOPEVENT(p, S_SCX, code); -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 4874093..83f0b86 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -473,12 +473,8 @@ syscall(struct trapframe *frame) */ STOPEVENT(p, S_SCX, code); -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index e9d9eeb..e98a50c 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -264,7 +264,7 @@ static int mac_policy_list_busy; } while (0) /* - * We manually invoke WITNESS_SLEEP() to allow Witness to generate + * We manually invoke WITNESS_WARN() to allow Witness to generate * warnings even if we don't end up ever triggering the wait at * run-time. The consumer of the exclusive interface must not hold * any locks (other than potentially Giant) since we may sleep for @@ -273,7 +273,8 @@ static int mac_policy_list_busy; * be made. */ #define MAC_POLICY_LIST_EXCLUSIVE() do { \ - WITNESS_SLEEP(1, NULL); \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \ + "mac_policy_list_exclusive() at %s:%d", __FILE__, __LINE__);\ mtx_lock(&mac_policy_list_lock); \ while (mac_policy_list_busy != 0) \ cv_wait(&mac_policy_list_not_busy, \ diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c index fa31ad3..7054048 100644 --- a/sys/sparc64/sparc64/trap.c +++ b/sys/sparc64/sparc64/trap.c @@ -629,12 +629,8 @@ syscall(struct trapframe *tf) #ifdef DIAGNOSTIC cred_free_thread(td); #endif -#ifdef WITNESS - if (witness_list(td)) { - panic("system call %s returning with mutex(s) held\n", - syscallnames[code]); - } -#endif + WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", + syscallnames[code]); mtx_assert(&sched_lock, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED); } diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 1fa83df..2e8e704 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1327,7 +1327,8 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) if (!(flags & M_NOWAIT)) { KASSERT(curthread->td_intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); - WITNESS_SLEEP(1, NULL); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "malloc() of \"%s\"", zone->uz_name); } zalloc_restart: |