Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2014 13:02:55 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        Vijay Singh <vijju.singh@gmail.com>
Cc:        hackers@freebsd.org
Subject:   Re: Debugging rw lock
Message-ID:  <52FD32FF.70106@mu.org>
In-Reply-To: <CALCNsJQzeqGh%2BZ0rW2jw9e%2BDfKdaRo9BpOQq7XrjfZ1EzNDFYQ@mail.gmail.com>
References:  <CALCNsJS6vFJU18F3VRR-T2RdtGNxd3fycUCkQ63BmGp29DAUMw@mail.gmail.com> <52FD30D9.6050604@mu.org> <CALCNsJQzeqGh%2BZ0rW2jw9e%2BDfKdaRo9BpOQq7XrjfZ1EzNDFYQ@mail.gmail.com>

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

On 2/13/14, 12:59 PM, Vijay Singh wrote:
> You're talking about instrumenting the code, right? But which thread? I was
> thinking of augmenting the rw lock to record the readers, but wanted to
> check if something is possible without instrumentation.

If rw locks are implemented using low level atomics then you're going to 
make the very slow and have a LOT of work to do as opposed to just using 
a thread specific storage to implement it.  You're better off just 
making use of the fact that only "curthread" can access the per-thread 
stack and just use that.  Or at least that's how it works in my brain.

-Alfred


>
>
> On Thu, Feb 13, 2014 at 12:53 PM, Alfred Perlstein <bright@mu.org> wrote:
>
>> Keep a stack of rwlocks owned in the struct thread.
>>
>> -Alfred
>>
>> On 2/13/14, 12:51 PM, Vijay Singh wrote:
>>
>>> I am running into an issue where an rw lock is read locked and never
>>> unlocked, and causes a system to livelock. I was wondering if its possible
>>> to figure out which thread owns the read lock?
>>>
>>> It's the tcp pcbinfo lock.
>>>
>>> (kgdb-amd64-7.4-08) show_rwlock rw
>>>    name : tcp
>>>    class: rw
>>>    flags: {SLEEP, INITED, WITNESS, RECURSE, UPGRADABLE}
>>>    state: RLOCK: 1 locks
>>>    waiters: writers
>>>
>>> Any help is appreciated.
>>>
>>> -vijay
>>> _______________________________________________
>>> freebsd-hackers@freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org
>>> "
>>>
>>>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52FD32FF.70106>