Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756598AbZCLPNf (ORCPT ); Thu, 12 Mar 2009 11:13:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755110AbZCLPN1 (ORCPT ); Thu, 12 Mar 2009 11:13:27 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:37429 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754571AbZCLPN0 (ORCPT ); Thu, 12 Mar 2009 11:13:26 -0400 Message-ID: <49B92691.3010100@us.ibm.com> Date: Thu, 12 Mar 2009 08:13:21 -0700 From: Darren Hart User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Thomas Gleixner CC: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Rusty Russell Subject: Re: [PATCH 3/6] futex: add double_unlock_hb() References: <20090312075349.9856.83687.stgit@Aeon> <20090312075552.9856.48021.stgit@Aeon> <1236852455.5090.105.camel@laptop> <20090312101028.GA7157@elte.hu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1877 Lines: 59 Thomas Gleixner wrote: > On Thu, 12 Mar 2009, Ingo Molnar wrote: >> * Peter Zijlstra wrote: >> >>> On Thu, 2009-03-12 at 00:55 -0700, Darren Hart wrote: >>>> The futex code uses double_lock_hb() which locks the hb->lock's in pointer >>>> value order. There is no parallel unlock routine, and the code unlocks them >>>> in name order, ignoring pointer value. This opens up a window for an ABBA >>>> deadlock. This patch adds double_unlock_hb() to remove the window as well >>>> as refactor the duplicated code segments. >>> While I don't mind the patch per-se, I'm hard pressed to see >>> any deadlock potential in the unordered unlock. >>> >>> All sites (at least those in the patch) always release both >>> locks without taking another in between, therefore one would >>> think there's no deadlock possible. >> yeah. > > I can't see a deadlock either. > Right, sorry, it's the double_lock that requires the test. Duh. I need to find a way to do some of this work during more regular hours I guess ;-) Thanks for the catch everyone. Ingo shall I resubmit? Or did you already clean it up? Thanks, Darren >> The patch is still nice (as you mention), it factors out the >> unlock sequence. I'll change the commit message accordingy. > > We do not need the comparison magic. Can we just put the code into > double_unlock_hb() which gets replaced ? > > i.e: > > spin_unlock(&hb1->lock); > if (hb1 != hb2) > spin_unlock(&hb2->lock); > > This code is confusing enough. > > Thanks, > > tglx -- Darren Hart IBM Linux Technology Center Real-Time Linux Team -- 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/