From owner-freebsd-current@FreeBSD.ORG Sat Nov 24 15:46:19 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BE786E; Sat, 24 Nov 2012 15:46:19 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id CFE0B8FC0C; Sat, 24 Nov 2012 15:46:18 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so1887092vba.13 for ; Sat, 24 Nov 2012 07:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=s2cBXDyt2xYqPX28hKnhB8A1O0zoGUMRpnJokpMRVbg=; b=OO4v2mNRSy3JqtcTI5Pq11/IM+RWlza0bIFKk6Aa+tB9KL48AcrP5sR+bfY76FVqwB UkJS9D/Dmm6MVZvrV3JQ2WVMDoaFCApgKgEtpG8GNKkcIjYNDrJNev0zQODxya3I0+4x sPaOp5lSp+6+dyFxN/ke0H0BaTOZ2y2BKWftKXWi4yHb3/OQSddyGFMKMiuex2xx2oYs CZfLQtxBa/8SSXUleJOfRTNRVT8Ih5hzPNSx9LDvwRosv0EKXTLdtIkmuohOmOKK/nrk lHymt3F1YpUTobCncUTp6SX8OQD5vDz9L2dG5cYM77htWCZE3JCKSPRUN+7Hna0ZQ8pm xncg== MIME-Version: 1.0 Received: by 10.52.27.241 with SMTP id w17mr9538649vdg.96.1353771977988; Sat, 24 Nov 2012 07:46:17 -0800 (PST) Received: by 10.58.207.114 with HTTP; Sat, 24 Nov 2012 07:46:17 -0800 (PST) In-Reply-To: References: Date: Sat, 24 Nov 2012 10:46:17 -0500 Message-ID: Subject: Re: Spurious witness warning when destroying spin mtx From: Ryan Stone To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 15:46:19 -0000 On Sat, Nov 24, 2012 at 10:01 AM, Attilio Rao wrote: > I seriously wonder why right now we don't assume the lock is unheld. > There are likely historically reasons for that, but I would like to > know which one are those and eventually fix them out. > FWIK, all the other locking primitives assume the lock is already > unheld when destroying and I think it would be good to have that for > mutexes as well. > > Can you please show which lock triggers the panic you saw? > > Thanks, > Attilio > > It was taskqueue_free: void taskqueue_free(struct taskqueue *queue) { TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; taskqueue_terminate(queue->tq_threads, queue); KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); KASSERT(queue->tq_callouts == 0, ("Armed timeout tasks")); mtx_destroy(&queue->tq_mutex); free(queue->tq_threads, M_TASKQUEUE); free(queue, M_TASKQUEUE); }