Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp743266ybi; Fri, 21 Jun 2019 07:26:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrgO3ptchG9EkF2+R9mjEKdtLSJ0YywJBB8DyrKtAusDRpHnqn4U5xA36Kx1ee2FwMgKEu X-Received: by 2002:a63:c0e:: with SMTP id b14mr18692742pgl.4.1561127192949; Fri, 21 Jun 2019 07:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561127192; cv=none; d=google.com; s=arc-20160816; b=WbPg0neSrmW5YH32HatbdzU1HFkr1P+BWp/sjOV2VN7niREyvuT8cgOGiBSa+hu5Kl x30puvA1sjvVDId/FPhtHsL1f3meFw5kSU/Ds1t/UrOJU669nNjRz/zt/vHw4i5clQ1e u64Z2idxIPU7eyMo6JYDi3ESlWzXx+ccI8NIgYjIt9+Hsn8gz5S1pLfiiWRsnUgcJAQZ v6y6V/CVG3045zDOB/45zYmWqIBKAyO0vrGPVnTJRYUSz60mTBVVPWz5I4bWzzrWCMM0 sATcANPJsskPlh91GJyS97xC5l/rwfITAJFi3KNF0XphD2wn800OR3Y1vE4l510vkYXg jY8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=8O8Tqng2iz/bl7DUGvYAebBBK9GgsLgWWEwLnuI/Udo=; b=umF0QLPMuWBF7/xn031DtaZMtJWUBNX1cOZpBgh95lVrFMQsbuTE2OkFqf0cCUwxHc KBqtxx45spqilpkcDSVnRI79mapHVApKURk0ZaI9QMZzx7IsYQTKKRv0sJBl+WlU97S0 k+LdAhwwrdBp7vXf/xIKnw22qkVIug4GUJABZ/OFTf3r76cIXZs8l/mdJWyXp9Lo+scH 4kc3GcokTiVF2uO9KmUWw9wQm0K0nzF7kacFyDs3eFJoP+CuqcIfh7oEI0oC/Qyuui3E 0yrmQ29nokyj/EXMRVnRkyqEmIjAcepTZ0xAOhJxM4XjEmdlS4zdL/5xWgm81wiQUk+O 8HXA== 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 gn3si2629379plb.321.2019.06.21.07.26.16; Fri, 21 Jun 2019 07:26:32 -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; 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 S1726058AbfFUOZY (ORCPT + 99 others); Fri, 21 Jun 2019 10:25:24 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:33500 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1725975AbfFUOZY (ORCPT ); Fri, 21 Jun 2019 10:25:24 -0400 Received: (qmail 2413 invoked by uid 2102); 21 Jun 2019 10:25:23 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 21 Jun 2019 10:25:23 -0400 Date: Fri, 21 Jun 2019 10:25:23 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri 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 In-Reply-To: <20190621084129.GA6827@andrea> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Jun 2019, Andrea Parri wrote: > 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:"... Yeah, sure. That's the sort of detail I have a hard time remembering. > - The report preceded the patch; we might as well reflect this in the > order of the tags. Either way is okay with me. Alan