From owner-p4-projects@FreeBSD.ORG Wed Feb 13 23:38:11 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A86DA16A480; Wed, 13 Feb 2008 23:38:11 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 658F616A477 for ; Wed, 13 Feb 2008 23:38:11 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mx1.freebsd.org (Postfix) with ESMTP id E05E113C4DD for ; Wed, 13 Feb 2008 23:38:10 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fg-out-1718.google.com with SMTP id 16so127657fgg.35 for ; Wed, 13 Feb 2008 15:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=fXI54GXs3qXDtRk5YeAgaUHltAiJjNynOOcqwREDlaQ=; b=ADbCLTN8W9YhuX+TtQA0vLa0IiELO5NNSi2TrO9g83F8lu3Zy1CR6+f0F4/SeglfCvMrwxFMEyh2bT77Sl0CipJ5BNBAlSgbykLDTAJTb7ok61BlNWSg2yjBvwAR55VcYlQGgkvx/xAUHGb4lIbcsjTBDu9wmNckRSaoJd8sTbU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=D3XVWxGJzWOh4EUq9vor+nGsONJ/ybp/zUPpTptRpxAkTj6FyUaV79CYrnfVpyXlzgFQPylkpHbDtlm/LUDJmJSxodCrBVEWiauprE2hsZpG2Qi4IvpgvAX+OoNhiRjvzrXE2O/yMjz8zT01wa02qICp3PTbfXbwimtj8WiI9Bg= Received: by 10.86.70.8 with SMTP id s8mr506978fga.29.1202944209325; Wed, 13 Feb 2008 15:10:09 -0800 (PST) Received: by 10.86.30.17 with HTTP; Wed, 13 Feb 2008 15:10:09 -0800 (PST) Message-ID: <3bbf2fe10802131510h400d0777yd758bfbaf780f895@mail.gmail.com> Date: Thu, 14 Feb 2008 00:10:09 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "John Baldwin" In-Reply-To: <200802132302.m1DN2D9d055694@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200802132302.m1DN2D9d055694@repoman.freebsd.org> X-Google-Sender-Auth: 21c0fc529d6a4f08 Cc: Perforce Change Reviews Subject: Re: PERFORCE change 135352 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2008 23:38:12 -0000 2008/2/14, John Baldwin : > http://perforce.freebsd.org/chv.cgi?CH=135352 > > Change 135352 by jhb@jhb_mutex on 2008/02/13 23:01:15 > > Add missing assertions and KTR logging to thread_lock(). This is > why I wasn't getting assertion failures when thread_lock() recursed > on a non-recursive spin mutex. > > Affected files ... > > .. //depot/projects/smpng/sys/kern/kern_mutex.c#151 edit > > Differences ... > > ==== //depot/projects/smpng/sys/kern/kern_mutex.c#151 (text+ko) ==== > > @@ -498,7 +498,6 @@ > int i, contested; > uint64_t waittime; > > - > contested = i = 0; > waittime = 0; > tid = (uintptr_t)curthread; > @@ -506,6 +505,15 @@ > retry: > spinlock_enter(); > m = td->td_lock; > + KASSERT(m->mtx_lock != MTX_DESTROYED, > + ("thread_lock() of destroyed mutex @ %s:%d", file, line)); > + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin, > + ("thread_lock() of sleep mutex %s @ %s:%d", > + m->lock_object.lo_name, file, line)); > + if (mtx_owned(m)) > + KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, > + ("thread_lock: recursed on non-recursive mutex %s @ %s:%d\n", > + m->lock_object.lo_name, file, line)); > WITNESS_CHECKORDER(&m->lock_object, Wouldn't be better to check against LC_SPINLOCK for the lock class? Attilio -- Peace can only be achieved by understanding - A. Einstein