From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbbCATS4 (ORCPT ); Sun, 1 Mar 2015 14:18:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51633 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbbCATSx (ORCPT ); Sun, 1 Mar 2015 14:18:53 -0500 Date: Sun, 1 Mar 2015 20:16:46 +0100 From: Oleg Nesterov To: Manfred Spraul Cc: "Paul E. McKenney" , LKML , 1vier1@web.de, Peter Zijlstra , Kirill Tkhai , Ingo Molnar , Josh Poimboeuf , stable@vger.kernel.org Subject: Re: [PATCH] ipc/sem.c: Update/correct memory barriers Message-ID: <20150301191646.GA14951@redhat.com> References: <1425226731-27724-1-git-send-email-manfred@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1425226731-27724-1-git-send-email-manfred@colorfullife.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Manfred, I leave this to you and Paul/Peter, but... On 03/01, Manfred Spraul wrote: > > +/* > + * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they > + * are only control barriers, thus a memory barrier is required if the > + * operation should act as an acquire memory barrier, i.e. if it should > + * pair with the release memory barrier from the spin_unlock() that released > + * the spinlock. > + * smp_rmb() is sufficient, as writes cannot pass the implicit control barrier. > + */ > +#ifndef smp_acquire__after_spin_unlock_wait > +#define smp_acquire__after_spin_unlock_wait() smp_rmb() > +#endif > +#ifndef smp_acquire__after_spin_is_unlocked > +#define smp_acquire__after_spin_is_unlocked() smp_rmb() > +#endif But spin_unlock_wait() and spin_is_locked() is the "same thing" when it comes to serialization with spin_unlock()... Not sure we need 2 helpers. But I won't argue of course. Oleg.