Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2015 04:04:58 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277723 - head/sys/kern
Message-ID:  <201501260404.t0Q44wfl084555@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Jan 26 04:04:57 2015
New Revision: 277723
URL: https://svnweb.freebsd.org/changeset/base/277723

Log:
  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

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c	Mon Jan 26 03:26:37 2015	(r277722)
+++ head/sys/kern/kern_timeout.c	Mon Jan 26 04:04:57 2015	(r277723)
@@ -1096,6 +1096,10 @@ _callout_stop_safe(struct callout *c, in
 	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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501260404.t0Q44wfl084555>