freebsd-current

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: MTX Lock implementation question Barney Cordoba Wed Mar 04 10:00:51 2009




--- On Wed, 3/4/09, John Baldwin <[EMAIL PROTECTED]> wrote:

> From: John Baldwin <[EMAIL PROTECTED]>
> Subject: Re: MTX Lock implementation question
> To: [EMAIL PROTECTED], [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> 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.

Barney


      
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"