summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-03-04 21:03:05 +0000
committerjhb <jhb@FreeBSD.org>2003-03-04 21:03:05 +0000
commite4bcd25517da2e44fd854859cc6ead7dcfe3df3a (patch)
treed32954415444ccb8c42b0a457f6f0e6e15a0d64e /sys/kern
parente87dfc0cdec66dcab96cfd816e8a33d1c59dc261 (diff)
downloadFreeBSD-src-e4bcd25517da2e44fd854859cc6ead7dcfe3df3a.zip
FreeBSD-src-e4bcd25517da2e44fd854859cc6ead7dcfe3df3a.tar.gz
Replace calls to WITNESS_SLEEP() and witness_list() with equivalent calls
to WITNESS_WARN().
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_condvar.c12
-rw-r--r--sys/kern/kern_lock.c4
-rw-r--r--sys/kern/kern_mac.c5
-rw-r--r--sys/kern/kern_sig.c3
-rw-r--r--sys/kern/kern_synch.c3
-rw-r--r--sys/kern/kern_sysctl.c3
-rw-r--r--sys/kern/subr_mbuf.c11
-rw-r--r--sys/kern/subr_trap.c5
8 files changed, 23 insertions, 23 deletions
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;
OpenPOWER on IntegriCloud