From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 14 03:48:03 2014 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55874FFA for ; Fri, 14 Feb 2014 03:48:03 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0DF7518C9 for ; Fri, 14 Feb 2014 03:48:02 +0000 (UTC) Received: from Julian-MBP3.local (ppp121-45-232-70.lns20.per1.internode.on.net [121.45.232.70]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.7) with ESMTP id s1E3lqMd008621 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 13 Feb 2014 19:47:55 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <52FD91E2.4080903@freebsd.org> Date: Fri, 14 Feb 2014 11:47:46 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Alfred Perlstein , Vijay Singh Subject: Re: Debugging rw lock References: <52FD30D9.6050604@mu.org> <52FD32FF.70106@mu.org> In-Reply-To: <52FD32FF.70106@mu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2014 03:48:03 -0000 On 2/14/14, 5:02 AM, Alfred Perlstein wrote: > > 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. maybe do it the other way around and count the read locks a thread has.. then when there is a problem go see what they hold.. (or add the ability to detail 10 locks each or something) > > -Alfred > > >> >> >> On Thu, Feb 13, 2014 at 12:53 PM, Alfred Perlstein >> 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" >> > > _______________________________________________ > 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" >