Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp589736imp; Wed, 20 Feb 2019 05:42:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IYXq4p4SEExeUGvuLn2hfeucIlY+exlSWct+oQCqkCIz5GgnmyTvknrRmjl89HvRvqKUphx X-Received: by 2002:a62:2284:: with SMTP id p4mr34974347pfj.115.1550670145051; Wed, 20 Feb 2019 05:42:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550670145; cv=none; d=google.com; s=arc-20160816; b=FXPGdEBTv0d9E3jPtCwEda7wqzSBZCs8GsfkT+UWjyRn4P3l9n4nsE38U88VggF7Nf 0XX3AJ5L0qd0JhmL2Vl39aKBb5TG5qRGYvHcd2My4guX7t8b+GCGInyHHePZa93ikB8H KMzsd9RvP1BxzhGWB7BXE7BIvZ9xdAJ3djaz1MZ7Og6vUf3cG0WPhwFE3r1guiwD3MeP iPOFXQmmajDE1h/m6UksuKhV4Ik32k9uVcooFpw512EofslH+VAG+MmuuuoFI+zMacaD ALwSG5QwDlfTOdZ9W4KgrUChZfOCl2zBDFH0zNfglGCgMtTO6Hoz9Zoy3o6gXw2nT8T9 B6Cg== 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; bh=oJnOuO4R/6wiR7/4cil/M1wIlSPo0y2iEP8hKnKLntg=; b=tH/OZqXfwVZEDiY43uilT9c7+5lXdoN2syuYGjnYFsgNvlMsaVeDB1c94em3h5XDV9 KxL/dryjYZ6rqBGl6bbQMTLwEgid6i0ZtNc0lSf9csQVK8/QJWqV83/ANhrvxkNsD2q9 lI+XOi2D6TK399OomAoFgD/pbOYPzdOrdC+U2TyZrXppTFolTFa1ckNfpWJ91u+W0XCC Mfexf/yPDDo+ab+jc+IK7HBVW4AgOXV9sGFRCR9p3ckWkA0KVsI0R34rpmtooUjcWDL8 /XijJ7+PXejy9SqJPYoEK7FycVu2qR+zKfbwXQsLwLvwLNGF0Y8lKI3j/050821DCkHP 6Lgw== 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 g75si2522671pfg.49.2019.02.20.05.42.09; Wed, 20 Feb 2019 05:42:25 -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 S1727470AbfBTNlP (ORCPT + 99 others); Wed, 20 Feb 2019 08:41:15 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbfBTNlO (ORCPT ); Wed, 20 Feb 2019 08:41:14 -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 F1B4FEBD; Wed, 20 Feb 2019 05:41:13 -0800 (PST) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B7E123F690; Wed, 20 Feb 2019 05:41:11 -0800 (PST) Date: Wed, 20 Feb 2019 13:41:06 +0000 From: Will Deacon To: Andrea Parri Cc: Peter Zijlstra , "Paul E. McKenney" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Alan Stern , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig Subject: Re: [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo Message-ID: <20190220134106.GA7523@fuggles.cambridge.arm.com> References: <1550617057-4911-1-git-send-email-andrea.parri@amarulasolutions.com> <20190220020117.GD11787@linux.ibm.com> <20190220092604.GD32494@hirez.programming.kicks-ass.net> <20190220131456.GA3215@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190220131456.GA3215@andrea> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 20, 2019 at 02:14:56PM +0100, Andrea Parri wrote: > On Wed, Feb 20, 2019 at 10:26:04AM +0100, Peter Zijlstra wrote: > > On Tue, Feb 19, 2019 at 06:01:17PM -0800, Paul E. McKenney wrote: > > > On Tue, Feb 19, 2019 at 11:57:37PM +0100, Andrea Parri wrote: > > > > Remove this subtle (and, AFAICT, unused) ordering: we can add it back, > > > > if necessary, but let us not encourage people to rely on this thing. > > > > > > > > For example, the following "exists" clause can be satisfied with this > > > > change: > > > > > > > > C dep-rfi > > > > > > > > { } > > > > > > > > P0(int *x, int *y) > > > > { > > > > WRITE_ONCE(*x, 1); > > > > smp_store_release(y, 1); > > > > } > > > > > > > > P1(int *x, int *y, int *z) > > > > { > > > > int r0; > > > > int r1; > > > > int r2; > > > > > > > > r0 = READ_ONCE(*y); > > > > WRITE_ONCE(*z, r0); > > > > r1 = smp_load_acquire(z); > > > > r2 = READ_ONCE(*x); > > > > } > > > > > > > > exists (1:r0=1 /\ 1:r2=0) > > > > > > Any objections? If I don't hear any in a couple days, I will apply this. > > > > IIUC you cannot build hardware that allows the above, so why would we > > allow it? > > The change/simplification was mainly intended as precautionary measure > (hence the "we can add it back, ..."): I do agree that it shouldn't be > possible to realize the above state; OTOH, you really don't need to be > too "creative" to imagine possible mis-uses/mis-interpretations of the > (dep ; rfi) term ("forget" ONCEs, trick herd7 with "false dependencies" > or simply wrongly assume that control dependencies are part this "dep", > what else? ...). So, no, I'm not that fond to this term; why should I > be? or you are simply suggesting to expand the changelog? Simplification can mean different things to different people. Whilst I completely agree that relying on the ordering provided by "dep ; rfi" is subtle and error prone, having it forbid the outcome above appeals to a hardware-based mindset of how memory ordering works. In the kernel community, I would posit that the majority of developers are writing code with the underlying hardware in mind and so allowing behaviours in the memory model which are counter to how a real machine operates is likely to make things more confusing, rather than simplifying them! IIRC, herd has a feature where you can "flag" the result of a litmus test to highlight certain internal constraint violations (e.g. warning that a data race is present in a concurrent C11 program). How about we preserve the existing semantics, but flag any use of "dep; rfi" to indicate that the ordering guarantees being relied upon are subtle and error-prone, and therefore should only be considered for fast-path code? Will