From 48c343df5fb2f0fda70dabd21b09774fe51920b4 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 2 Apr 2002 16:51:20 +0000 Subject: [PATCH] Explicitly document how we implicitly enforce the lock order of sleep locks before spin locks. --- sys/kern/subr_witness.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 53fbb9647ab4..ec98ba0e90ac 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -474,6 +474,11 @@ witness_lock(struct lock_object *lock, int flags, const char *file, int line) td = curthread; if (class->lc_flags & LC_SLEEPLOCK) { + /* + * Since spin locks include a critical section, this check + * impliclty enforces a lock order of all sleep locks before + * all spin locks. + */ if (td->td_critnest != 0 && (flags & LOP_TRYLOCK) == 0) panic("blockable sleep lock (%s) %s @ %s:%d", class->lc_name, lock->lo_name, file, line);