From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:56651 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754764AbbHLNd0 (ORCPT ); Wed, 12 Aug 2015 09:33:26 -0400 Date: Wed, 12 Aug 2015 15:31:10 +0200 From: Oleg Nesterov To: Manfred Spraul Cc: Andrew Morton , LKML , 1vier1@web.de, "Paul E. McKenney" , Peter Zijlstra , Kirill Tkhai , Ingo Molnar , Josh Poimboeuf , stable@vger.kernel.org Subject: Re: [PATCH] ipc/sem.c: Update/correct memory barriers Message-ID: <20150812133109.GA8266@redhat.com> References: <1439142939-2605-1-git-send-email-manfred@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439142939-2605-1-git-send-email-manfred@colorfullife.com> Sender: stable-owner@vger.kernel.org List-ID: On 08/09, Manfred Spraul wrote: > > /* > + * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they > + * are only control barriers. > + * The code must pair with spin_unlock(&sem->lock) or > + * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient. > + * > + * smp_rmb() is sufficient, as writes cannot pass the control barrier. > + */ > +#define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb() Agreed. But to remind, this can have more users. In particular, task_work_run() which currently does mb() after spin_unlock_wait(). Can someone suggest a good "generic" name for this helper so that we can move it into include/linux/spinlock.h? Oleg.