Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbXLDT2k (ORCPT ); Tue, 4 Dec 2007 14:28:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751116AbXLDT2c (ORCPT ); Tue, 4 Dec 2007 14:28:32 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:36100 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1750914AbXLDT2c (ORCPT ); Tue, 4 Dec 2007 14:28:32 -0500 Date: Tue, 4 Dec 2007 14:28:31 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Jarek Poplawski cc: Jarek Poplawski , Ingo Molnar , Linux-pm mailing list , Kernel development list , Peter Zijlstra Subject: Re: Need lockdep help In-Reply-To: <4755A457.5080405@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1534 Lines: 40 On Tue, 4 Dec 2007, Jarek Poplawski wrote: > Alan Stern wrote, On 12/04/2007 04:17 PM: > ... > > > Furthermore, in this case deadlock isn't really impossible -- it could > > occur if there were a bug somewhere else in the kernel. So lockdep was > > correct to warn that deadlock might occur. > > > Alan, if the scenario was like you described at the beginning, there was > no deadlock possible, unless some errors in the notifier. Or errors in the notifier's caller. > These #1-#3 > threads were only helpful to guess what lockdep could 'think', but I > guess notifier doesn't use 2 rivaling threads for a wake, so, lockdep > probably needed additional information. And you really can't consider > any hypothetical kernel bugs here because then each lock is vulnerable. But you have to consider hypothetical kernel bugs. That's exactly what lockdep is for -- to warn you about possible deadlocks that could be caused by bugs. As a simple example, if thread #1 does "lock(A); lock(B)" and thread #2 does "lock(B); lock(A)" then there's a possible bug. Lockdep should warn about you, and it does -- even if those two threads can never run at the same time. If lockdep warned about deadlocks only when they actually happened, it wouldn't be nearly so useful. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/