From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754652AbbKBShF (ORCPT ); Mon, 2 Nov 2015 13:37:05 -0500 Received: from foss.arm.com ([217.140.101.70]:52241 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbbKBShC (ORCPT ); Mon, 2 Nov 2015 13:37:02 -0500 Date: Mon, 2 Nov 2015 18:37:00 +0000 From: Will Deacon To: Linus Torvalds Cc: Peter Zijlstra , Ingo Molnar , Oleg Nesterov , Linux Kernel Mailing List , Paul McKenney , boqun.feng@gmail.com, Jonathan Corbet , Michal Hocko , David Howells Subject: Re: [PATCH 4/4] locking: Introduce smp_cond_acquire() Message-ID: <20151102183659.GN29657@arm.com> References: <20151102132901.157178466@infradead.org> <20151102134941.005198372@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 02, 2015 at 10:08:24AM -0800, Linus Torvalds wrote: > On Mon, Nov 2, 2015 at 5:29 AM, Peter Zijlstra wrote: > > +#define smp_cond_acquire(cond) do { \ > > + while (!(cond)) \ > > + cpu_relax(); \ > > + smp_read_barrier_depends(); /* ctrl */ \ > > + smp_rmb(); /* ctrl + rmb := acquire */ \ > > +} while (0) > > This code makes absolutely no sense. > > smp_read_barrier_depends() is about a memory barrier where there is a > data dependency between two accesses. The "depends" is very much about > the data dependency, and very much about *nothing* else. Paul wasn't so sure, which I think is why smp_read_barrier_depends() is already used in, for example, READ_ONCE_CTRL: http://lkml.kernel.org/r/20151007154003.GJ3910@linux.vnet.ibm.com although I agree that this would pave the way for speculative stores on Alpha and that seems like a heavy accusation to make. > Your comment talks about control dependencies, but > smp_read_barrier_depends() has absolutely nothing to do with a control > dependency. In fact, it is explicitly a no-op on architectures like > ARM and PowerPC that violate control dependencies. In this case, control dependencies are only referring to READ -> WRITE ordering, so they are honoured by ARM and PowerPC. Will