From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765543AbYD2PDt (ORCPT ); Tue, 29 Apr 2008 11:03:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756271AbYD2PDl (ORCPT ); Tue, 29 Apr 2008 11:03:41 -0400 Received: from fg-out-1718.google.com ([72.14.220.159]:12102 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755800AbYD2PDk (ORCPT ); Tue, 29 Apr 2008 11:03:40 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qgbBHaH05EODKSICTihw6h6KlHSUJ0/GiIpbNXGRtaWfEgeuzwCpS8pZub4vwnOnInR7CjqSafLLXWgSHqKiv/cbHjG7U+1fJaupBDrikyb+iBGEnsriQVAydJzRCW8GT1mCwzaLTcx5d5Dz6KyiEtd+/mCw9zC5CpWok33xWyY= Message-ID: Date: Tue, 29 Apr 2008 17:03:38 +0200 From: "Bart Van Assche" To: "Peter Zijlstra" Subject: Re: [PATCH 1/8] lockdep: fix recursive read lock validation Cc: ego@in.ibm.com, linux-kernel@vger.kernel.org, "Zdenek Kabelac" , "Oleg Nesterov" , "Heiko Carstens" , "Rafael J. Wysocki" , "Andrew Morton" , "Ingo Molnar" , "Srivatsa Vaddagiri" In-Reply-To: <1209481050.13978.72.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080429125659.GA23562@in.ibm.com> <20080429125750.GB23562@in.ibm.com> <1209481050.13978.72.camel@twins> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 29, 2008 at 4:57 PM, Peter Zijlstra wrote: > > On Tue, 2008-04-29 at 15:16 +0200, Bart Van Assche wrote: > > On Tue, Apr 29, 2008 at 2:57 PM, Gautham R Shenoy wrote: > > > Subject: lockdep: fix recursive read lock validation > > > This means that the following sequence is now invalid, whereas previously > > > it was considered valid: > > > > > > rlock(a); rlock(b); runlock(b); runlock(a) > > > rlock(b); rlock(a); > > > > Why are you marking this sequence as invalid ? Although it can be > > debated whether it is good programming practice to be inconsistent > > about the order of read-locking, the above sequence can't be involved > > in a deadlock. > > Not for pure read locks, but when you add write locks to it, it does get > deadlocky. Lockdep does not keep separate chains for read and write > locks. Nesting writer locks inside reader locks is always a bad idea. So please come up with an example of how varying the reader lock nesting order can trigger a deadlock (when no writer locks are nested inside reader locks and nested writer locks are always nested in the same order). Bart.