Received: by 10.223.176.5 with SMTP id f5csp2895793wra; Thu, 1 Feb 2018 07:41:09 -0800 (PST) X-Google-Smtp-Source: AH8x227szAJ1vTR9KPMYO0JFEEDyisaO87G5nyLgb+6zQTQ5m8gf3LrSvIZnf88jPlSAPOO0QS/5 X-Received: by 10.101.64.74 with SMTP id h10mr28300246pgp.200.1517499669569; Thu, 01 Feb 2018 07:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517499669; cv=none; d=google.com; s=arc-20160816; b=GNQlRGMUyaGlfr26abpYsTHdDZS0rBZv2UGt0iNDVlSR+43Reui0MwWXlRelzl+nbC Mf91P5QvYP0EvkT+i0dHoZA73bryqdYdNWPVyRrQgojWGUrMTZN+iHEMZxipEG0epQq8 JgYONU2wL9RIbGb0Q6tYqotOsgh3AaurGKTK11tpzgJKZ+ajPNgOqkfDc7m7Jv8mmbUv ZiHDBae71OWFhwXnZUQYbRRHHvRT403NEttwagCgq8ksY02ftpHtxQzeZihdBSeQ80KH 46eDMrhKIfy8IWfQnD00xKEKJsMQfbjXEkTQqVHD6z7mA3SPhYWWFhRTdpJfkABpI1pr lZRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Iz9mWkAHyNnwknKQilrQgArNtzemdk7hVQDkH8itDAs=; b=U8bgIfmm9yyMkS32kXR7W9OXSscpAadnSaRms31yRKC4isjrn3RAJ3QwrIXL24GFtR BYh6efCRLpxiz7zLVg94SPrgPe1QoxPpjiH71d9r4h7EdSkRvskRVPKUJLYcDtJ0kJpK tPxZxIhT39LQ3YltS21lF5sDs8D9QmtqRG+kq3CgeyivNxAZpQxvcvxDdLp2w024QTgy 5kxjdc5KLfHhqXvs/flRO4bvS73Q0adRA0m3e9R0SQFHZS9ASWPzYK9zYXjM1tM9lSjU 4UHt0Bgyu1GvmZ5McpDZ/T2E3PQbe7kLqhjKqoinFIUBVxrZG0plZs3V6B3BzRiOAZYq EZsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb5-v6si1867293plb.93.2018.02.01.07.40.53; Thu, 01 Feb 2018 07:41:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948AbeBAPjx (ORCPT + 99 others); Thu, 1 Feb 2018 10:39:53 -0500 Received: from foss.arm.com ([217.140.101.70]:51704 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbeBAPju (ORCPT ); Thu, 1 Feb 2018 10:39:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA3CC1435; Thu, 1 Feb 2018 07:39:49 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B8E073F24D; Thu, 1 Feb 2018 07:39:49 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id B06741AE08B8; Thu, 1 Feb 2018 15:39:51 +0000 (GMT) Date: Thu, 1 Feb 2018 15:39:51 +0000 From: Will Deacon To: Peter Zijlstra Cc: Stafford Horne , Paul McKenney , Jonas Bonn , Stefan Kristiansson , David Howells , Arnd Bergmann , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: asm-generic: Disallow no-op mb() for SMP systems Message-ID: <20180201153951.GG9182@arm.com> References: <20180131130034.GR2269@hirez.programming.kicks-ass.net> <20180131131737.GA5097@arm.com> <20180131132610.GT2269@hirez.programming.kicks-ass.net> <20180201122750.GE30895@lianli.shorne-pla.net> <20180201132909.GW2249@hirez.programming.kicks-ass.net> <20180201133229.GB9182@arm.com> <20180201135329.GB2269@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180201135329.GB2269@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 02:53:29PM +0100, Peter Zijlstra wrote: > On Thu, Feb 01, 2018 at 01:32:30PM +0000, Will Deacon wrote: > > On Thu, Feb 01, 2018 at 02:29:09PM +0100, Peter Zijlstra wrote: > > > On Thu, Feb 01, 2018 at 09:27:50PM +0900, Stafford Horne wrote: > > > > I tried to clarify some of this in the spec v1.2 [0] which help formalize some of > > > > the techniques we used for the SMP implementation. Its probably not perfect, > > > > but I added a section "10. Multicore support" and tried to clarify some things > > > > in section 7 on Atomicity. But it seems I dont cover exactly what are are > > > > mentioning here. In general: > > > > > > > > 1 Secondary cores have memory snooping enabled meaning that any write to a > > > > cached address will cause the cache line to be invalidated. > > > > 2 l.swa (store atomic word) implies a store buffer flush. > > > > > > What about l.lwa? Can that observe 'old' values, or rather, miss values > > > stuck in a remote store buffer? > > > > > > This will then cause the first l.swa to fail, which, per the above, > > > would then sync things up? Which means you get that one extra > > > merry-go-round. > > > > That's ok from a correctness perspective, though, as long as store buffers > > are guaranteed to drain. > > Depends a bit if you can build control dependencies off of l.swa > succeding or not I think :-) Otherwise you get into that dodgy state you > suffer from where bits can leak right through. > > That is, I was thinking what we need for smp_mb__before_atomic. > > I could've gotten my brain in a twist or course, which isn't _that_ > unusual. I never seem to be able to quite remember the holes you have > with ll/sc on arm64 :-) Is smp_mb__before_atomic supposed to provide ordering guarantees if it's used before a failed cmpxchg? If so, I think it's needed here because the l.swa might not even execute. Or did I just invent another problem? Will