From owner-freebsd-current@FreeBSD.ORG Wed Mar 4 18:45:44 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 366A6106564A for ; Wed, 4 Mar 2009 18:45:44 +0000 (UTC) (envelope-from barney_cordoba@yahoo.com) Received: from web63902.mail.re1.yahoo.com (web63902.mail.re1.yahoo.com [69.147.97.117]) by mx1.freebsd.org (Postfix) with SMTP id E829D8FC17 for ; Wed, 4 Mar 2009 18:45:43 +0000 (UTC) (envelope-from barney_cordoba@yahoo.com) Received: (qmail 16805 invoked by uid 60001); 4 Mar 2009 18:45:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1236192343; bh=87aVz+aoRNYDbBKvPOJKrD6acF+jOKca/ZfuTqoglS8=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=K4UowkR7XrPLOh+lrikPYZ+1XkPaQlDdebjCoVgNh7ZfitPVu14GnnYahmTAIIcrS2pbKjunz1MGIZ2Fe3HpunZ4dyLb8Evmq2Okfg2aAyMQaFGdOmjlB1WVltGX77am3oQzbu92p23DlA4HrFifFtbXU0scS7pWrIdp1YbAP64= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=zgIPZKZ9tqcRiqZNfaYF8zpGfNvih3ZBj/Njxm9+o07oBh52WQ4nBDF7/rvZI+w3rDolhXsr55lPvontGXSTEaQYxd9uaV4n98bcKePYmAtJquB2rl+2E2/qi/nEAS2dahlRv2XybrqnmB+SWo+IjFRYtta0DyGb81ei9CFxY0I=; Message-ID: <440962.16587.qm@web63902.mail.re1.yahoo.com> X-YMail-OSG: ol6z4YcVM1mxPzy4lBZKcEjoQ3ZdnA5O3tfP4l5ypB4NI8b9iYy4DILp90fZ87PY1jBpM_mo8.be49wmqBR9oExAQo8_qFzGqlFP2SPwS0TiWe41M5Cbe7P77eztR0PRfuyEJSm4xGY9xwy1jk_IU2DD2HSnqDRl1oyOet8B7cjZU1hjmY2KAvC_T6n4AJSwRebThM1_8g3I3iJlorcdZX_EKnFe7s2Q Received: from [98.242.222.229] by web63902.mail.re1.yahoo.com via HTTP; Wed, 04 Mar 2009 10:45:43 PST X-Mailer: YahooMailWebService/0.7.289.1 Date: Wed, 4 Mar 2009 10:45:43 -0800 (PST) From: Barney Cordoba To: John Baldwin In-Reply-To: <200903041305.54726.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: current@freebsd.org Subject: Re: MTX Lock implementation question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: barney_cordoba@yahoo.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 18:45:44 -0000 --- On Wed, 3/4/09, John Baldwin wrote: > From: John Baldwin > Subject: Re: MTX Lock implementation question > To: barney_cordoba@yahoo.com > Cc: current@freebsd.org > Date: Wednesday, March 4, 2009, 1:05 PM > On Wednesday 04 March 2009 12:34:40 pm Barney Cordoba wrote: > > > > --- On Wed, 3/4/09, John Baldwin > wrote: > > > > > From: John Baldwin > > > Subject: Re: MTX Lock implementation question > > > To: freebsd-current@freebsd.org, > barney_cordoba@yahoo.com > > > Cc: current@freebsd.org > > > Date: Wednesday, March 4, 2009, 10:13 AM > > > On Wednesday 04 March 2009 7:54:32 am Barney > Cordoba wrote: > > > > > > > > Suppose the following: > > > > > > > > Module foo.c > > > > > > > > foo_getlock(sc) > > > > { > > > > FOO_LOCK(sc); > > > > } > > > > foo_unlock(sc) > > > > { > > > > FOO_UNLOCK(sc); > > > > } > > > > foo_dosomething(sc) > > > > { > > > > MTX_LOCK_ASSERT(sc); > > > > foo_dooit(); > > > > } > > > > > > > > Module bar.c > > > > > > > > bar_dofoo() > > > > { > > > > foo_getlock(sc); > > > > foo_dosomething(sc); > > > > foo_unlock(sc); > > > > } > > > > > > This works fine. > > > > > > > Is this something that shouldn't work? I > need to > > > access functions > > > > that require locks in a different module, > but this > > > code barfs on > > > > ASSERT with witness enabled. Is this a > deflugalty in > > > WITNESS, or do > > > > I need to create functions within foo that > do the > > > locking? Its been > > > > working ok for awhile (its not a high volume > function) > > > but when I > > > > fired up witness to debug something else I > encountered > > > witness panics. > > > > > > You probably have a real bug that WITNESS is > warning about > > > however. > > > > > > -- > > > John Baldwin > > > > It seems that theres a problem when the mutex is > initialized with a type > > of NULL. Changing it to a non-null string eliminated > the issue. I'm > > running a 7.0 base system. > > Hmm, mutexes are required to be named. The > "type" argument is optional, but > the name is not. So you can't do: > > mtx_init(&m, NULL, NULL, MTX_DEF); > > > You can, however do: > > mtx_init(&m, "foo", NULL, MTX_DEF); There seems to be an issue when the type is set to NULL. I got panics in strcpy and strlen functions when displaying warning traces that cleared up when the type was set to a string. BC