Received: by 10.223.176.5 with SMTP id f5csp763698wra; Fri, 2 Feb 2018 05:49:46 -0800 (PST) X-Google-Smtp-Source: AH8x226bZqDhuDBWO3749S/Aa20WJBjd6Q8bY/aKE3N5JdeAZRz0ucq1Hvohd136FqahpYEAA/CJ X-Received: by 2002:a17:902:82c5:: with SMTP id u5-v6mr19212097plz.401.1517579386078; Fri, 02 Feb 2018 05:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517579386; cv=none; d=google.com; s=arc-20160816; b=L/DwxSDz9sHHGfmLZuaWvBNTwWcSoNIkOsY8U0p3LKsVLEx/6qV6Q/G/lrsRIA85NM eTW+Gn4YNoNNk+eC4nBsfR/LIsRQY0DOya3mhw/iCDVkEg4KlQI5baVTzQ882OIgpXmB HLC3u3wCLtcs8YWTM070CEnMpRHcNcBqT0DrpnsIuyuTLRDkRmOhnQZvBUOhb5h8UPzP 4kCSJU3nv89CgkFkT6WaMi0/FB0fUWmthOEAPgQAioWTN8KUpaGw6A3j28IU3PwmcwhM 7kOmYWR/UFFTi9upeVtlMgjSVVba3ZPfOAtJIsfgMcBQNR+3jPY3bFaV3b7YZQRWxRjj gSHw== 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:dkim-signature:arc-authentication-results; bh=Qb6ut1TGz3JKp9ukj7TPuB9irTqvoyQc5+gWAPZxogk=; b=juGF9kb4s75AvzeQLOKQ+6G1g+AumI4K3agJOlyIhK31ZBz96b2R9AhVHEesr29PR+ Cy/e4PBLACqiPrw4AsICIE4qPfmzb2yMsIAtqRWrcCCRNl/+5OnAyK3kRtQe9sQ/H/Ay FtAMrjOKmoiiGEgh5CvnFYcbJZCjXWRt55qUDZwTJzg3VGl7fl4Im+ZkbN1eYckBIAZ2 LohRpZSTWUYEP5GezaewxZjHkGCO2caDzqUNYWwb7Wl2byZfQDVKjHKNK2kZgn1mDItw p6MkejDzVHMZ3etDfSuorLLqMeyLQpsEbCyNIFX1qEleDyHGB1BYP7nc4w2AZziKCJUc LmqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAsWcFav; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23-v6si331735pli.463.2018.02.02.05.49.31; Fri, 02 Feb 2018 05:49:46 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BAsWcFav; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751864AbeBBNsv (ORCPT + 99 others); Fri, 2 Feb 2018 08:48:51 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:38714 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbeBBNsq (ORCPT ); Fri, 2 Feb 2018 08:48:46 -0500 Received: by mail-pg0-f42.google.com with SMTP id h2so41195pgq.5 for ; Fri, 02 Feb 2018 05:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Qb6ut1TGz3JKp9ukj7TPuB9irTqvoyQc5+gWAPZxogk=; b=BAsWcFav93r9d2jCnk4FKo2ZOQP9KIczlGyvw5ds8FGYfMMXy5/Xm0GRdJTNshhWO6 HO422kAWtMxK533q9wjlP8v99QrxEAT6PUGtTwebkh/VJ++586cEqrUQAFsvjhLFX8pW 5hgcy2mFQAIVK5S3NG0kskDJnwH4yAee8U73HuQ8Y6cYdcRrVlD0GjsxFvgzxJW2i+I3 W0/lCLgi0jDc6+6NrueEofac8qJNqK3DiBaN5FfiA4nkV1ykGyW2HJxAs5xcUwoJLKCZ l6xJBSaX/h1QOzyRyO2Pbi2UCX17USWLzPNZQtGwughckANilOt6w/xUraWNcy1pgC97 L3gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Qb6ut1TGz3JKp9ukj7TPuB9irTqvoyQc5+gWAPZxogk=; b=Tf/q6+QOehAW7QP5ZnSMM8rddL15zL9p74jr3o5qwXB7XHbcjxWlkcP8t5F6XGSPSb uEPP/oPdPuW2Afw+Mqf1HEVppeTo8J0D5zL53kPMxTz0VqwkX3CILlH1jcFaRaMCzRL8 kXgUhFez89aljPKJkfOTf47qK/ml3UPONcvPPzRYGz8W/nSd0li5+81Id9jxmhipmGQK 2JlwL5Qse+B0lBOKSfIs55Sj+dRXQi+7hBJze4gEC8XPR4a4vOXvL9tp+utLiPUQpyku ssHIU/QPt/IWF92t0YyTVsKZxnaWuwvEAEUZJ2+8sBGPgrRMMkiyoHXHO/tQ26PXgnEY TJiA== X-Gm-Message-State: AKwxytfx91poTfNu1rzMVhGyvMnDVaNOSwuL3tgAq0QYjTPYKcZbd3tU TDKYAGYtNUMOxfdoTtHO+hc= X-Received: by 10.98.66.152 with SMTP id h24mr40112532pfd.13.1517579325618; Fri, 02 Feb 2018 05:48:45 -0800 (PST) Received: from localhost (g151.124-44-6.ppp.wakwak.ne.jp. [124.44.6.151]) by smtp.gmail.com with ESMTPSA id r24sm3890242pfl.61.2018.02.02.05.48.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Feb 2018 05:48:45 -0800 (PST) Date: Fri, 2 Feb 2018 22:48:43 +0900 From: Stafford Horne To: Peter Zijlstra Cc: Will Deacon , 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: <20180202134843.GF30895@lianli.shorne-pla.net> 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.9.1 (2017-09-22) 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. Sorry, I remembered incorrectly, l.lwa also implies a (l.msync) store buffer flush for the local cpu. However, in order to see something stuch in the remote store buffer a flush would need to be inititiated on the remote core. I think that is what we would expect though right? > > 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. Yes, I think the original author did not think of PSO/TSO and store buffers. Its not clear of the authors intention. It should be cleared up. I would say: 1 Weak order model with store buffers is PSO (must implement l.msync) 2 Strong model with store buffers is TSO (must implement l.msync) 3 Implementations without store buffers could be weak or strong? a weak meaning cpu could schedule loads stores out of order l.msync would cause all pending load/store instructions to be retired. b strong meaning loads/stores would happen in instruction order, in this case l.msync could be a no-op as there is no buffering of stores or loads. 1 doesnt exist as far as I know. So its probably better to remove. 2 is what we have now in mor1kx. 3.b it possible, but we always have a l.msync implementation. But maybe it doesnt make sense when there is no store buffer. -Stafford