From owner-freebsd-arch@FreeBSD.ORG Thu Nov 13 23:01:18 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21FF6339; Thu, 13 Nov 2014 23:01:18 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B8050391; Thu, 13 Nov 2014 23:01:17 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id h11so1091960wiw.9 for ; Thu, 13 Nov 2014 15:01:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=vWat8BEJ8BNCUd8yhf13BFYL0VNS5CK8pV/GKTGzDKs=; b=QoK+Ycs4zwbrMW5XokV914Zf6jh4aSaZeQqK7p7af4Rbpr4Eg1CUl3VgeR7NQcwkhj VFqqxl4h79z8pcMHoyaPLeXVWAQmK5TY08msdSKCTT5VvTbEpmg4v451gSLjjaegSK/j wRXHJznlWPJJ7umr+A2/XP16XLBBO9qjuXEu1NRgz5DQ/5snrqMsIs3Kzb9FZ0ruoaAY fiqiebxNVc5UgKNOP04tzLKVMhgPm0/o0QdIPJicYWRnGJvj3XcVBuLKmNnLckhVAnio NAtRi7rnxwEuYvMGMSWnkQh7b6fNNI4i0GABHyGo4el/14I6pp4nPjVWV7Xu7Cb+Mr/2 G+Bg== MIME-Version: 1.0 X-Received: by 10.194.47.226 with SMTP id g2mr8207426wjn.68.1415919676192; Thu, 13 Nov 2014 15:01:16 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Thu, 13 Nov 2014 15:01:16 -0800 (PST) In-Reply-To: References: <54647D1E.9010904@freebsd.org> <201411130948.23785.jhb@freebsd.org> Date: Thu, 13 Nov 2014 15:01:16 -0800 X-Google-Sender-Auth: J6BLBk6yX_KDWyI5Jbn3o0Vj_Zw Message-ID: Subject: Re: Questions about locking; turnstiles and sleeping threads From: Adrian Chadd To: Garrett Cooper Content-Type: text/plain; charset=UTF-8 Cc: Hans Petter Selasky , Alfred Perlstein , Steve Kargl , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2014 23:01:18 -0000 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