Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261300AbVBVW0C (ORCPT ); Tue, 22 Feb 2005 17:26:02 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261306AbVBVW0C (ORCPT ); Tue, 22 Feb 2005 17:26:02 -0500 Received: from gate.crashing.org ([63.228.1.57]:4320 "EHLO gate.crashing.org") by vger.kernel.org with ESMTP id S261300AbVBVWZz (ORCPT ); Tue, 22 Feb 2005 17:25:55 -0500 Subject: Re: [PATCH/RFC] Futex mmap_sem deadlock From: Benjamin Herrenschmidt To: Linus Torvalds Cc: Olof Johansson , Kernel Mailing List , Andrew Morton , jamie@shareable.org, Rusty Russell , David Howells In-Reply-To: References: <20050222190646.GA7079@austin.ibm.com> <1109106969.5412.138.camel@gaston> <1109108532.5411.149.camel@gaston> Content-Type: text/plain Date: Wed, 23 Feb 2005 09:24:56 +1100 Message-Id: <1109111096.5412.152.camel@gaston> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1380 Lines: 33 On Tue, 2005-02-22 at 14:10 -0800, Linus Torvalds wrote: > Oh, well. The reason I hate the rwsem behaviour is exactly because it > results in this very subtle class of deadlocks. This one case is certainly > solvable several ways, but do we have other issues somewhere else? Things > like kobject might be ripe with things like this. The mm semaphore tends > to be pretty well-behaved - and I'm not sure the same is true of the > kobject one. We could detect those tho. When the appropriate DEBUG option is set, by storing a cpumask in the semaphore we could detect if it's already taken on this cpu... > Normal recursive deadlocks are wonderful - most of them show up > immediately, so assuming you just have enough coverage, you're fine. This > fairness-related deadlock requires a race to happen. Unless you consider that taking the read semaphore twice on the same CPU is always a bug, thus the above stuff would work for catching them at least more often... > Maybe it would be sufficient to have a debugging version of rwsems that > just notice recursion? > > Linus -- Benjamin Herrenschmidt - 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/