Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2003 20:29:54 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Maksim Yevmenkin <Maksim.Yevmenkin@cw.com>
Cc:        current@freebsd.org
Subject:   RE: WITNESS questions
Message-ID:  <XFMail.20030221202954.jhb@FreeBSD.org>
In-Reply-To: <3E49A429.DBFA4FBB@cw.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 12-Feb-2003 Maksim Yevmenkin wrote:
> Dear Hackers,
> 
> Does WITNESS keeps track of particular mutex instance or
> just places where particular mutex type was acquired and
> released? Is it even possible to keep track of individual
> instance of the particular mutex type?

It just keeps track of types.  This is sufficient for tracking
lock orders.

> Here is my problem. In my code (Bluetooth sockets layers)
> each socket/PCB has a mutex. The mutex type is the same.
> Also there are few global mutexes that used to protect
> sockets/PCBs list etc. 
> 
> Now when i do testing and both client and server reside
> on the same machine, i, sometimes, get "lock order reversal"
> messages. All messages can be put into two groups:
>:
> 1) Both mutexes are particular instances of the two different
>    types.

This is a bug then.  You shouldn't be doing this unless you
have a well defined order for when you acquire different
instances of the lock.  Otherwise, what is to prevent two
threads from acquiring the same two locks of the same type
in the opposite order?

> 2) One mutex is global and another is particular instance
>    of the particular type.

Similarly, you need to have the same order between global
mutexes and all the mutexes of a given type.

> These messages are bugging me and i want to get to the 
> bottom of this. How i can verify/convince myself that
> these messages are not problems? How should i deal with
> multiple mutex instances? Will WITNESS be able to help
> me here?
> 
> thanks,
> max
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030221202954.jhb>