Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp814883yba; Sat, 13 Apr 2019 14:40:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqynnyuqraa1alkn29x92JX87LDilXXKR6A5XuXawd3ta3t7OAJS9n4U7JumAHWBIGF9JnTe X-Received: by 2002:a62:604:: with SMTP id 4mr66447931pfg.38.1555191648072; Sat, 13 Apr 2019 14:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555191648; cv=none; d=google.com; s=arc-20160816; b=EsqN/8PlD6QCwfTGQ+GiXWhCsgrJTj9a6NywVUzSSugdQJmF1cWqn1cVGo8ShNSC0a GZ0eE5YuzMLX9MhSm1pB/yqwUfkHM10B8KDjcyZui6Cc+LupE2Hh2NnGciiPH6SB94Lr hexhjQruEnjPgVVPfYfC8Ftepdxgjersc8SuWYFhjxifXJtwbXw1WSHf085o17t1f181 QDz3s+YMD4NyJd3sY8tqlmRErOWPo7Frmy+T7+6UCDqzL8EyrkonrOL4bbHnplJ3kYH0 Qf1cHvmw81wyBf9TjTtj7NZAtcLBJOsmYMHVR+tzJaMLlmI3JBBgZ5CaQXeoRlF5GluS XksQ== 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; bh=NltJFvUkFPAAEBpx8MoWkiwpJTDuphCP3bx5XvrZP7s=; b=SKonYZztprKRXI6rOQsgAbl//apyuXJRo8tT7AvnbqQGYq+5rHO4BOkU8HfiVaHxjU UtTz8Prbv61OvCc1b6hLeTrRc7PtjfZNCtbnVui81lVD/Zv2lf8hS+BXPp6b+Fd2jMJH qph3NfL1YMGnPZkrKBj9KeZcPMpPWvKEAiWUGXjvf4AccB7YWA9Q76AHFi6yWGIVR3aK KdwH4uIQOAzYpPh/R+mfI38TnJfff5Xn7Vq06B7Jn4Rovf8MO+XLns8jdQNhmgMGLlC3 ZjeACrr8trSvo9iXF4XMS3U156gaJkOVWBCtPjhMkbGkF2HzVsQh92qg6sYcnEDOR62B 3zNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aXLKdbeT; 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 p61si13151834plb.428.2019.04.13.14.40.30; Sat, 13 Apr 2019 14:40:48 -0700 (PDT) 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=@amarulasolutions.com header.s=google header.b=aXLKdbeT; 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 S1727103AbfDMVj5 (ORCPT + 99 others); Sat, 13 Apr 2019 17:39:57 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:33885 "EHLO mail-wm1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbfDMVj5 (ORCPT ); Sat, 13 Apr 2019 17:39:57 -0400 Received: by mail-wm1-f43.google.com with SMTP id r186so3089370wmf.1 for ; Sat, 13 Apr 2019 14:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NltJFvUkFPAAEBpx8MoWkiwpJTDuphCP3bx5XvrZP7s=; b=aXLKdbeTCvGr/lEtbI6JMmCjNrOejt5N5HmOsXcOJxCEyic3KgkXXPrjYZqGL3lFR1 wEsSIxnRvdtLcZadA8G43DJxFqKLxKoqtBUiQdp3QoB6NiPjjVFjxMQTo+iHUv373wC4 lN8KfHDTdXbfTvw+P/lSX9DDjb2zCpiDZKqCQ= 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=NltJFvUkFPAAEBpx8MoWkiwpJTDuphCP3bx5XvrZP7s=; b=aTujLgIcb+5Lz1p+coJMfI7Wp44o7UW8ngn3sVqp/Lv44Ei07kiGCWqEe8u48aPi6K C6kaiy44H9+6WEqnP49TTdZEfRkleWwXgl2xI0md3me01FTKGKFDDyVq5K08lzVdcCSs +IJm+LB2tIX9DNFPDUXFNgTwftshE0jq8aCRrmutopRJuoi8DthSQif8TWh3ITeC7Kbu Sog5dnsSA191eevZYsj+Ew9ngAmAVRzg4Rvbc1+U09E68bnkKTi0qxxoFVOiBGGnSudr rMF3SYR8z6FWBuaxAh69/1t1TIjOImRyUfBuy957GQqmb3k95TyQ2budw0ykgy9V804f jrDQ== X-Gm-Message-State: APjAAAX6Ml0kglwIvBfcS28jGK7rFyX8D+SMmejaAdJYRrV937ZQaOux Xs8LwAJItAW8q0Yrn9HSihLreQ== X-Received: by 2002:a1c:ed12:: with SMTP id l18mr15142977wmh.13.1555191594698; Sat, 13 Apr 2019 14:39:54 -0700 (PDT) Received: from andrea ([89.22.71.151]) by smtp.gmail.com with ESMTPSA id r6sm39782225wrt.38.2019.04.13.14.39.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Apr 2019 14:39:53 -0700 (PDT) Date: Sat, 13 Apr 2019 23:39:38 +0200 From: Andrea Parri To: "Paul E. McKenney" Cc: Alan Stern , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon , Daniel Kroening , Kernel development list Subject: Re: Adding plain accesses and detecting data races in the LKMM Message-ID: <20190413213938.GA4371@andrea> References: <20190408055117.GA25135@andrea> <20190409013618.GA3824@andrea> <20190409150132.GB14111@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190409150132.GB14111@linux.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 09, 2019 at 08:01:32AM -0700, Paul E. McKenney wrote: > On Tue, Apr 09, 2019 at 03:36:18AM +0200, Andrea Parri wrote: > > > > The formula was more along the line of "do not assume either of these > > > > cases to hold; use barrier() is you need an unconditional barrier..." > > > > AFAICT, all current implementations of smp_mb__{before,after}_atomic() > > > > provides a compiler barrier with either barrier() or "memory" clobber. > > > > > > Well, we have two reasonable choices: Say that > > > smp_mb__{before,after}_atomic will always provide a compiler barrier, > > > or don't say this. I see no point in saying that the combination of > > > Before-atomic followed by RMW provides a barrier. > > > > ;-/ I'm fine with the first choice. I don't see how the second choice > > (this proposal/patch) would be consistent with some documentation and > > with the current implementations; for example, > > > > 1) Documentation/atomic_t.txt says: > > > > Thus: > > > > atomic_fetch_add(); > > > > is equivalent to: > > > > smp_mb__before_atomic(); > > atomic_fetch_add_relaxed(); > > smp_mb__after_atomic(); > > > > [...] > > > > 2) Some implementations of the _relaxed() variants do not provide any > > compiler barrier currently. > > But don't all implementations of smp_mb__before_atomic() and > smp_mb__after_atomic() currently supply a compiler barrier? Yes, AFAICS, all implementations of smp_mb__{before,after}_atomic() currently supply a compiler barrier. Nevertheless, there's a difference between: (1) Specify that these barriers supply a compiler barrier, (2) Specify that (certain) combinations of these barriers and RMWs supply a compiler barrier, and (3) This patch... ;-) FWIW, I'm not aware of current/informal documentation following (the arguably simpler but slightly stronger) (1). But again (amending my last remark): (1) and (2) both make sense to me. Thanx, Andrea > > Thanx, Paul >