Received: by 10.223.176.5 with SMTP id f5csp2748233wra; Thu, 1 Feb 2018 05:33:08 -0800 (PST) X-Google-Smtp-Source: AH8x2249E4/pIKNYaZ9x9rwx5GtlwN5m73Lvbt3jkxpjULuZqYhf1+TeAdNoffxZf1b2A8WWFWvV X-Received: by 10.99.182.12 with SMTP id j12mr30387699pgf.113.1517491987975; Thu, 01 Feb 2018 05:33:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517491987; cv=none; d=google.com; s=arc-20160816; b=cLbFLxZPEpPHyhdddvrZGX0qvLxhEriCYH642vzxqTOqlKxnEWEcChY5CcQLAwWNLN ziO78LBOkSixwTbaQLttXxl9Gw8+9bKuR9kbxoOEnmbw4S+dHtGC9qhvUFpCT7x2Yc4t 6qpEtFWu4SsBPM1diAJqUx2KrljXl9R52+O2fTRex7juyjAU/SIqVbrL0cgqRPRFXpUk ep3Zy5Obr9of1atwFOpyPy13+8iOGbyVPPEtD6/MPXxwTFSL5rYG5Be+EPfGuKbe9RQf Tq3h4/Ivhh/oFhLn8NEzDurimJRdmmRpkOCWy2DaPqIymKIHl9raKH/ZoKtHK0g7Fciu Yvyg== 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=sqqPo+yiR5AeJXA8sLjKGkrzIXu9G0G0hXrIN14d834=; b=ZNmVWhj7YIihAeaiieIo9o/wZC0trqAWQkrVsA0co9QXaqLEqCPGS/kD6kfLokdUJb S7WzdUCS07CfcH3bzH7GrNSzo9RY9zNSVvE3K9x/BkT/eRInzcf7S4te7FUv7LmFUlfW /eHiCh+2DBapl6G6PZnWYv7GYfJ4XkjIWyfCw1Z8I3RIhnFRuz6dbfJvMlAWlTTEUUhq 5wDYbcAnE56j3txwuV53l/mJpuqW06mgkGgdYrTxxBH7G35TKJXHY2LvV6LLcOeqOsQX W0lLMHQNbOS1hdleisvLunpJco805T8ufPQCHNLOhkbwKBeCcCKy03FPfKCDrCAH5dq+ OPog== 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 x25si12852528pgc.643.2018.02.01.05.32.52; Thu, 01 Feb 2018 05:33:07 -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 S1752047AbeBANca (ORCPT + 99 others); Thu, 1 Feb 2018 08:32:30 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50288 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeBANc2 (ORCPT ); Thu, 1 Feb 2018 08:32:28 -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 7393480D; Thu, 1 Feb 2018 05:32:28 -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 4379B3F25C; Thu, 1 Feb 2018 05:32:28 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 3774D1AE08B8; Thu, 1 Feb 2018 13:32:30 +0000 (GMT) Date: Thu, 1 Feb 2018 13:32:30 +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: <20180201133229.GB9182@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180201132909.GW2249@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: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. > > 3 l.msync is used to flush the store buffer > > > > Also, during the IPI controller review [1] Marc Z asked many similar questions. > > I believe he was ok in the end. > > > > Anyway, > > Thanks for thanks for spotting the issue here. For some reason I remember we > > did have an l.msync for our mb(). Let me think about and test out this patch > > (and the fix to actually define mb) to see if anything comes up. > > > > Also, I haven't seen any implementations that use WOM. Stefan might know better. > > So if the strong model has a store buffer, as I think the above says, > then it is _NOT_ correct for l.msync to be treated as a NOP, it _must_ > flush the store buffer. > > At which point I think your 'strong' model is basically TSO. So it would > be very good to get that spelled out somewhere. Agreed, especially as a software person reading the spec may end up thinking that they don't need to use l.msync if they never set WOM. At least, I read it this way despite knowing that it's probably not what you intended. Will