Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966404AbbD2ReI (ORCPT ); Wed, 29 Apr 2015 13:34:08 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:34736 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753800AbbD2ReF (ORCPT ); Wed, 29 Apr 2015 13:34:05 -0400 Message-ID: <55411609.90507@colorfullife.com> Date: Wed, 29 Apr 2015 19:34:01 +0200 From: Manfred Spraul User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Chris Metcalf , Peter Zijlstra CC: "Paul E. McKenney" , Oleg Nesterov , Kirill Tkhai , linux-kernel@vger.kernel.org, Ingo Molnar , Josh Poimboeuf Subject: Re: [PATCH] spinlock: clarify doc for raw_spin_unlock_wait() References: <20150428162458.GI5029@twins.programming.kicks-ass.net> <1430239485-17700-1-git-send-email-cmetcalf@ezchip.com> In-Reply-To: <1430239485-17700-1-git-send-email-cmetcalf@ezchip.com> Content-Type: text/plain; charset=windows-1252; 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: 2009 Lines: 47 On 04/28/2015 06:44 PM, Chris Metcalf wrote: > The intent of the function is to wait for the current locker. > Thus, we don't have to worry about potential later lockers, > but we also have to ensure that the arch implementation > doesn't return a false positive for the current locker. > > Signed-off-by: Chris Metcalf sysvsem depends on this definition, i.e. a false early return can cause a corrupted semaphore state. Acked-by: Manfred Spraul > --- > On 04/28/2015 12:24 PM, Peter Zijlstra wrote: >> I think it must not return before the lock holder that is current at the >> time of calling releases. Anything thereafter is indeed fair game as per >> your logic above. > Great, that seems like a workable definition. How does this modified > language seem? With this definition I can actually modify the > implementation of tile's arch_raw_spin_unlock_wait() to just read > current_ticket once and just wait until it changes (assuming the > lock is, in fact, locked). > > Not sure whose tree this should go through; any takers? > > include/linux/spinlock.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h > index 3e18379dfa6f..36de5fc86647 100644 > --- a/include/linux/spinlock.h > +++ b/include/linux/spinlock.h > @@ -141,7 +141,8 @@ do { \ > #endif > > /** > - * raw_spin_unlock_wait - wait until the spinlock gets unlocked > + * raw_spin_unlock_wait - wait until the lock holder that is current at the > + * time of calling releases the lock (or return immediately if unlocked). > * @lock: the spinlock in question. > */ > #define raw_spin_unlock_wait(lock) arch_spin_unlock_wait(&(lock)->raw_lock) -- 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/