summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2015-01-26 04:04:57 +0000
committeradrian <adrian@FreeBSD.org>2015-01-26 04:04:57 +0000
commit70dc4fad7a93ca73cc531060c49f47e0bd97911a (patch)
tree9e33408b7bb54b09cfe177c9157fbda5e9cc2536
parentb09edd53c954af35a87f8a2240c50eff7397978b (diff)
downloadFreeBSD-src-70dc4fad7a93ca73cc531060c49f47e0bd97911a.zip
FreeBSD-src-70dc4fad7a93ca73cc531060c49f47e0bd97911a.tar.gz
Call WITNESS_WARN() in callout_drain() to check whether any locks are
being held before sleeping. This has bitten me (in ath(4)) once before and I'd like to see this not bite anyone else. Differential Revision: D1638 Reviewed by: jhb, hselasky MFC after: 1 week
-rw-r--r--sys/kern/kern_timeout.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index 13822fd..1d5d24f 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1096,6 +1096,10 @@ _callout_stop_safe(struct callout *c, int safe)
struct lock_class *class;
int direct, sq_locked, use_lock;
+ if (safe)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c->c_lock,
+ "calling %s", __func__);
+
/*
* Some old subsystems don't hold Giant while running a callout_stop(),
* so just discard this check for the moment.
OpenPOWER on IntegriCloud