diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-20 13:57:31 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-20 13:57:31 +0000 |
commit | da85a125dd7fd9af53b0919887129daaf4fa53bb (patch) | |
tree | a8a5d35dfd86d6f624f47c01ea1bd6c6ac4b32b6 /sys/kern/kern_synch.c | |
parent | 4718dfdd3c76a956f1a6022f2dbb3c240b27f3e2 (diff) |
Hook up mutex(9) to witness(4).
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 79ff976529a..9925025e304 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.139 2017/04/20 13:33:00 visa Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.140 2017/04/20 13:57:30 visa Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -170,6 +170,7 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, #ifdef MULTIPROCESSOR int hold_count; #endif + WITNESS_SAVE_DECL(lock_fl); KASSERT((priority & ~(PRIMASK | PCATCH | PNORELOCK)) == 0); KASSERT(mtx != NULL); @@ -202,6 +203,8 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, sleep_setup_timeout(&sls, timo); sleep_setup_signal(&sls, priority); + WITNESS_SAVE(MUTEX_LOCK_OBJECT(mtx), lock_fl); + /* XXX - We need to make sure that the mutex doesn't * unblock splsched. This can be made a bit more * correct when the sched_lock is a mutex. @@ -217,6 +220,7 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority, if ((priority & PNORELOCK) == 0) { mtx_enter(mtx); MUTEX_OLDIPL(mtx) = spl; /* put the ipl back */ + WITNESS_RESTORE(MUTEX_LOCK_OBJECT(mtx), lock_fl); } else splx(spl); |