summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2012-09-12 22:10:53 +0000
committerattilio <attilio@FreeBSD.org>2012-09-12 22:10:53 +0000
commita634dfc320608f9955ab0350a7f78ee73064b909 (patch)
tree139a9f57a8c17d9b87a87568fbf9be1819e671f0 /sys/kern/kern_lock.c
parentac29dac65b70ec7f821f36ac07f086e6a514fe1a (diff)
downloadFreeBSD-src-a634dfc320608f9955ab0350a7f78ee73064b909.zip
FreeBSD-src-a634dfc320608f9955ab0350a7f78ee73064b909.tar.gz
Improve check coverage about idle threads.
Idle threads are not allowed to acquire any lock but spinlocks. Deny any attempt to do so by panicing at the locking operation when INVARIANTS is on. Then, remove the check on blocking on a turnstile. The check in sleepqueues is left because they are not allowed to use tsleep() either which could happen still. Reviewed by: bde, jhb, kib MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 24526b0..8b428bd 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -477,6 +477,9 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL,
("%s: LK_INTERLOCK passed without valid interlock @ %s:%d",
__func__, file, line));
+ KASSERT(!TD_IS_IDLETHREAD(curthread),
+ ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, curthread,
+ lk->lock_object.lo_name, file, line));
class = (flags & LK_INTERLOCK) ? LOCK_CLASS(ilk) : NULL;
if (panicstr != NULL) {
OpenPOWER on IntegriCloud