Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp412589ybi; Fri, 21 Jun 2019 01:43:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiXJ4YQVVw/YUKlWV97ZimaEacWMZyDn4Q7X8QxLeS2KEdxDWPoq81fnrWvzg3QNLmBAy4 X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr24063399plh.338.1561106613428; Fri, 21 Jun 2019 01:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561106613; cv=none; d=google.com; s=arc-20160816; b=rsRz3agc0ohBLkpEEXoU2adlxeUC366tiIP1im4zSG8fHnsGcr46M0yD1KAgDCWEd+ scdNb4wrY/zXY0E0WVv36Gmaxbvub2DOBYm0tBW3Tu9RG1ERc6BX0loaa3nSZY4bIt3z gsrk0FukJPkR/y2lNiOKz2T1T1zljJEO/tQTiN9cYL5w6xv6qvraxT6JFNQWsKJB8xpt hzRo7HCDARf6CvxlS7RGFBNvozydcExgPxUQ2+CisVlYyWTlRhQskPtmyp/4eHzf1gTc HA+GsRbtR7BJFYjjYpJLO1VzKni4a1WZwZvuhlEecL4t8l73U9Qu//fjZBgWBJQ8QcRg bjSQ== 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=yKNFfzwEYl5/zmQazFDSNcBME8+4rbQsszyA7NJfvIc=; b=b9Fxj6Qg/FfTRqJaJYL90BYGqgYU4IyWoPcNoXJpBCV/0xw2qmyF2rRQWLzzOBYEdO DXgXHzxOCthJXldjH8mPByeDQE28XGHxTCVWYVpODLhLXg/iEdO+mPkbbPhwvTIRd+N8 Uzzi6mMZicS+bEh38tqHgsleZ0W2o/belT4D8MUGRcRXZvX+mrZ4GjtDrntm+u6G/hTX cYHGXCC1gZc3lpAsveLiiohRsT+6TIK637bmAvjC1aauZFj1uA+EefdRRcOycK1FICQ6 IBd1kkE6M1Q7Km9UD0id8nbWmj57TyGH5WB/spPlEcDc0yHYN/Sn+k1tFcN0LesPYw9u 6dfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=lktPUZjl; 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 f9si2170823pfd.110.2019.06.21.01.43.18; Fri, 21 Jun 2019 01:43:33 -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=lktPUZjl; 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 S1726311AbfFUIlj (ORCPT + 99 others); Fri, 21 Jun 2019 04:41:39 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34231 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfFUIlj (ORCPT ); Fri, 21 Jun 2019 04:41:39 -0400 Received: by mail-wr1-f68.google.com with SMTP id k11so5740382wrl.1 for ; Fri, 21 Jun 2019 01:41:37 -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=yKNFfzwEYl5/zmQazFDSNcBME8+4rbQsszyA7NJfvIc=; b=lktPUZjlhyjev2c/H8gl+b491BD8xfz0ChaGXpiJhMKTBq72aRixQo8wDTp4pOWWB5 SrzZv/cyUMJhMaJJcrtby/qw1GMuNyZtBN5w0eP/n/K0b1yyFPG9cfKRTqO1ku69fYuX vPsO4HZ2wS6H0/JDSUs16OwS4k40YMBYeG+vk= 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=yKNFfzwEYl5/zmQazFDSNcBME8+4rbQsszyA7NJfvIc=; b=nXeZ0aF0nGl7N2d1LhcWT0G9qSf2pxa7IPb5X1s3Jz+Mpu7Ys2/ge+34rYJlI0slWK 7kFww5oth5DDprWbbiuNH3Lxwg5rZE84YHyKx3UWHxsSxUTsIEUUhal1wc/Xaq2M3jcC SyUtHjukRj0yWxq2rhuIe2zkMr1PbFTGy6nmr9o+gl/PnbVe6aN8FlKMFwtReAtB3Mkt ZzHJpgpMVQtGQxjQ7UA9R26L1bqH6oS+QZYLYfa2w01R4CNY1WT9yzkOTZm54PipL6kt BtCLhKCEUg6FqatRuEayXFODwTpz+KZqcgfaiU/aZXoQf9dpC234fT8c8b3WPw75c1p/ Kscw== X-Gm-Message-State: APjAAAW6TaJDKEdMyMtRc0SgMtDO9Ik65kPsXUd7AZkX3Ye6+AxbEHFn JKVX9frAjmse7tQ0rjLPBYZxGg== X-Received: by 2002:a5d:4e50:: with SMTP id r16mr9487976wrt.227.1561106497090; Fri, 21 Jun 2019 01:41:37 -0700 (PDT) Received: from andrea (86.100.broadband17.iol.cz. [109.80.100.86]) by smtp.gmail.com with ESMTPSA id g11sm1753970wru.24.2019.06.21.01.41.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jun 2019 01:41:36 -0700 (PDT) Date: Fri, 21 Jun 2019 10:41:29 +0200 From: Andrea Parri To: Alan Stern Cc: LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Herbert Xu , Kernel development list Subject: Re: [PATCH 3/3] tools: memory-model: Improve data-race detection Message-ID: <20190621084129.GA6827@andrea> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Jun 20, 2019 at 11:55:58AM -0400, Alan Stern wrote: > Herbert Xu recently reported a problem concerning RCU and compiler > barriers. In the course of discussing the problem, he put forth a > litmus test which illustrated a serious defect in the Linux Kernel > Memory Model's data-race-detection code. > > The defect was that the LKMM assumed visibility and executes-before > ordering of plain accesses had to be mediated by marked accesses. In > Herbert's litmus test this wasn't so, and the LKMM claimed the litmus > test was allowed and contained a data race although neither is true. > > In fact, plain accesses can be ordered by fences even in the absence > of marked accesses. In most cases this doesn't matter, because most > fences only order accesses within a single thread. But the rcu-fence > relation is different; it can order (and induce visibility between) > accesses in different threads -- events which otherwise might be > concurrent. This makes it relevant to data-race detection. > > This patch makes two changes to the memory model to incorporate the > new insight: > > If a store is separated by a fence from another access, > the store is necessarily visible to the other access (as > reflected in the ww-vis and wr-vis relations). Similarly, > if a load is separated by a fence from another access then > the load necessarily executes before the other access (as > reflected in the rw-xbstar relation). > > If a store is separated by a strong fence from a marked access > then it is necessarily visible to any access that executes > after the marked access (as reflected in the ww-vis and wr-vis > relations). > > With these changes, the LKMM gives the desired result for Herbert's > litmus test and other related ones. > > Signed-off-by: Alan Stern > Reported-by: Herbert Xu For the entire series: Acked-by: Andrea Parri Two nits, but up to Paul AFAIAC: - This is a first time for "tools: memory-model:" in Subject; we were kind of converging to "tools/memory-model:"... - The report preceded the patch; we might as well reflect this in the order of the tags. Thanks, Andrea