Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2014 15:01:16 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Garrett Cooper <yaneurabeya@gmail.com>
Cc:        Hans Petter Selasky <hps@selasky.org>, Alfred Perlstein <alfred@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: Questions about locking; turnstiles and sleeping threads
Message-ID:  <CAJ-VmokfyLTfx-HVkKV5bLY3S07AeQgO0kBaw7JkGdgDzscuTg@mail.gmail.com>
In-Reply-To: <ECB3576A-CD92-4F19-9EA3-CFF430165D0B@gmail.com>
References:  <CAJ-VmomrauhCMoF_dZfMWWhZp0EgwfE9RmxL5Pc37PhLSzZ6Qg@mail.gmail.com> <54647D1E.9010904@freebsd.org> <CAJ-VmonbEfxz9Bgw9O9f-5%2Bb=UM1b1nzPK9zfAAnmYKVumOKkQ@mail.gmail.com> <201411130948.23785.jhb@freebsd.org> <CAJ-Vmo=ZW0i0upfPkf2fx8GgnKn943dZr96_PsGnw5NgcbC7NQ@mail.gmail.com> <ECB3576A-CD92-4F19-9EA3-CFF430165D0B@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I'd like to try and add WITNESS_WARN() where appropriate.

How's this look?

Index: kern_timeout.c
===================================================================
--- kern_timeout.c    (revision 274304)
+++ kern_timeout.c    (working copy)
@@ -1096,7 +1096,22 @@
     struct lock_class *class;
     int direct, sq_locked, use_lock;

+    /* XXX GIANTOK? c_lock can be NULL? */
+
     /*
+     * If safe is clear then we're not going to drop into the
+     * sleepq wait routines.  So, we don't have to check
+     * for the witness warning here.
+     *
+     * If safe is set then we may drop into the sleep routines
+     * so do the check.
+     */
+    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.
      */



-adrian



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