summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-06-07 05:39:16 +0000
committerjhb <jhb@FreeBSD.org>2002-06-07 05:39:16 +0000
commitfd3d90c2c85d318baf50e0a87f17c885c98ad010 (patch)
treee4ee6179ef21cf05b9b97149b299edee32f314e4 /sys/kern
parentfbebc83b5b089064d7d4f969ef3459ad64815af2 (diff)
downloadFreeBSD-src-fd3d90c2c85d318baf50e0a87f17c885c98ad010.zip
FreeBSD-src-fd3d90c2c85d318baf50e0a87f17c885c98ad010.tar.gz
- Catch up to new ktrace API.
- ktrace trace points in msleep() and cv_wait() no longer need Giant.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_condvar.c39
-rw-r--r--sys/kern/kern_synch.c12
2 files changed, 23 insertions, 28 deletions
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 4608539..9d30d25 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -198,8 +198,8 @@ cv_wait(struct cv *cvp, struct mtx *mp)
td = curthread;
#ifdef KTRACE
- if (td->td_proc && KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 1, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(1, 0);
#endif
CV_ASSERT(cvp, mp, td);
WITNESS_SLEEP(0, &mp->mtx_object);
@@ -227,8 +227,8 @@ cv_wait(struct cv *cvp, struct mtx *mp)
mtx_unlock_spin(&sched_lock);
#ifdef KTRACE
- if (KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 0, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(0, 0);
#endif
PICKUP_GIANT();
mtx_lock(mp);
@@ -254,8 +254,8 @@ cv_wait_sig(struct cv *cvp, struct mtx *mp)
p = td->td_proc;
rval = 0;
#ifdef KTRACE
- if (td->td_proc && KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 1, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(1, 0);
#endif
CV_ASSERT(cvp, mp, td);
WITNESS_SLEEP(0, &mp->mtx_object);
@@ -282,7 +282,6 @@ cv_wait_sig(struct cv *cvp, struct mtx *mp)
sig = cv_switch_catch(td);
mtx_unlock_spin(&sched_lock);
- PICKUP_GIANT();
PROC_LOCK(p);
if (sig == 0)
@@ -296,11 +295,10 @@ cv_wait_sig(struct cv *cvp, struct mtx *mp)
PROC_UNLOCK(p);
#ifdef KTRACE
- mtx_lock(&Giant);
- if (KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 0, 0);
- mtx_unlock(&Giant);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(0, 0);
#endif
+ PICKUP_GIANT();
mtx_lock(mp);
WITNESS_RESTORE(&mp->mtx_object, mp);
@@ -322,7 +320,8 @@ cv_timedwait(struct cv *cvp, struct mtx *mp, int timo)
td = curthread;
rval = 0;
#ifdef KTRACE
- ktrcsw(td->td_proc->p_tracep, 1, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(1, 0);
#endif
CV_ASSERT(cvp, mp, td);
WITNESS_SLEEP(0, &mp->mtx_object);
@@ -366,8 +365,8 @@ cv_timedwait(struct cv *cvp, struct mtx *mp, int timo)
mtx_unlock_spin(&sched_lock);
#ifdef KTRACE
- if (KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 0, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(0, 0);
#endif
PICKUP_GIANT();
mtx_lock(mp);
@@ -395,8 +394,8 @@ cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo)
p = td->td_proc;
rval = 0;
#ifdef KTRACE
- if (td->td_proc && KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 1, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(1, 0);
#endif
CV_ASSERT(cvp, mp, td);
WITNESS_SLEEP(0, &mp->mtx_object);
@@ -439,7 +438,6 @@ cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo)
}
mtx_unlock_spin(&sched_lock);
- PICKUP_GIANT();
PROC_LOCK(p);
if (sig == 0)
@@ -453,11 +451,10 @@ cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo)
PROC_UNLOCK(p);
#ifdef KTRACE
- mtx_lock(&Giant);
- if (KTRPOINT(td->td_proc, KTR_CSW))
- ktrcsw(td->td_proc->p_tracep, 0, 0);
- mtx_unlock(&Giant);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(0, 0);
#endif
+ PICKUP_GIANT();
mtx_lock(mp);
WITNESS_RESTORE(&mp->mtx_object, mp);
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 1615d57..9d959d2 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -423,8 +423,8 @@ msleep(ident, mtx, priority, wmesg, timo)
WITNESS_SAVE_DECL(mtx);
#ifdef KTRACE
- if (p && KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 1, 0);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(1, 0);
#endif
WITNESS_SLEEP(0, &mtx->mtx_object);
KASSERT(timo != 0 || mtx_owned(&Giant) || mtx != NULL,
@@ -533,13 +533,11 @@ msleep(ident, mtx, priority, wmesg, timo)
}
PROC_UNLOCK(p);
}
- PICKUP_GIANT();
#ifdef KTRACE
- mtx_lock(&Giant);
- if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 0, 0);
- mtx_unlock(&Giant);
+ if (KTRPOINT(td, KTR_CSW))
+ ktrcsw(0, 0);
#endif
+ PICKUP_GIANT();
if (mtx != NULL) {
mtx_lock(mtx);
WITNESS_RESTORE(&mtx->mtx_object, mtx);
OpenPOWER on IntegriCloud