Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1278121imm; Wed, 6 Jun 2018 13:21:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLAfyKktnerbSlMLVvcWhpkC0bYRW4m20C85+QBnBqKxdAvPypErqkAf3KUoWhZca3S4El5 X-Received: by 2002:a17:902:8d8e:: with SMTP id v14-v6mr4692753plo.387.1528316469680; Wed, 06 Jun 2018 13:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528316469; cv=none; d=google.com; s=arc-20160816; b=j9qGKaglKfUqqA+sWMLPbUk0kK7KwVFB67wTLHnXl2RCumpA7/QDg9mi5mud58318K 0hB7B54mXkDk8LwAr/bOcJbiG1KdDPa+iwXGjf1RS7uA+pCAe5dnfpdJ9BXvwKTQbP7V i88We4+L6hzoMs+jdBaW37FY60tywbYdlh2bTCfud2RcNaGBnc+RJiNnHX3FsQbVIpPe 5McWGbS1/lvTaMramKJllB1y3mWlH3tCyf5UKkhMOkYPqicAHFN6aPDMMAQEU5jfrlaQ W9qn3u6/7rS/2t5IF/q7PIJmn9xfIAv1rG/da2sNvnFml8ihO4afJs6xnGOebuL1l7uw FnCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=1fzEHrdnMy4fDy3RF8KWhekn/vU+YGUN19pv2hMo80s=; b=JCQ+16WagzAI4IXdKAGqQfsWjfKT70Fz4a9UwH/eQxxprWEeNLiNQlS/dNtV9LcORu a6CdyuJ7FR84J1rUSOQEEbQglDal/pDPoiWnOMeaN8poKX96o4SVLe8dupXvgBrzmoOS 7WxZeA5QLLOqh7fIM3b9Tn9LF9xWf2ul3UnhtTTWfMsQ3/PupuJPJ8EyAH5ETvd1H5x8 hjVsl+LrJ1XIV9qt0w2GhISUvaZXoFvxj+fiEyuzjkPb14UTqbg1vD4y6vcri9UrqNaD 9VoerRsf8fMkO7rnSwFDrI2WUiZWYZJ2am8lCNlo3aoYbptjWYMkHJZirYjRIuSdGYs7 Pg6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=d4cC9v2q; 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 n7-v6si7659620pfn.270.2018.06.06.13.20.54; Wed, 06 Jun 2018 13:21:09 -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=@linux-foundation.org header.s=google header.b=d4cC9v2q; 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 S1753068AbeFFTXr (ORCPT + 99 others); Wed, 6 Jun 2018 15:23:47 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:40420 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752492AbeFFTXp (ORCPT ); Wed, 6 Jun 2018 15:23:45 -0400 Received: by mail-io0-f169.google.com with SMTP id g22-v6so8947286iob.7; Wed, 06 Jun 2018 12:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1fzEHrdnMy4fDy3RF8KWhekn/vU+YGUN19pv2hMo80s=; b=d4cC9v2qU4IamE/vkRDhg320LW3p+O3L3BxN70u/wH+MmJLQoeiRQLIDydQCq/VuBt fNgmscey0fb1ajwwp2qk0C7qVaOqbb3QiIzCXEdd2/nb9UJUqw1d/I8uG4f25d3iJNuG 0I+bN+XZt79BrYC9xfhPEVjFDtOllh9Fz1OVc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1fzEHrdnMy4fDy3RF8KWhekn/vU+YGUN19pv2hMo80s=; b=eHEdHpfA2kP03B7Bc06Ja+KNZaelOp6csFJERFiMeITFP2i2mwSiPrBfLII1g8ZGQy ldEvRpOOJ4WV413tL+96nn/NENgU3WQCb2QXb/9RcFWn/C7AYT7Fw0nRt1I7XX67TaXR sduEay/rZ5jbcEuU9Hbvqv3TAbX2jPi6i3vwWMORBehAnnzqj1o2iA0vwwoAJv6O33Tb 8h6W7JT9RecuXMMkqREVYi6g1pG22R2NaD/Kfxeci2JIQxiKQJTW5R5k6LFurhOV5oPC VS3hl2h+2X36n1qQJUU0etdyDNwo7jBUpfW2dSmpSRmEOSG8vOHwdP8/EDHrDGycpPbR O/Ug== X-Gm-Message-State: APt69E3SmgPqMOnX5FV15tBwENfxSq5+N4Lr4kcpvWj/gfcDn9HxUWgY yKlO/IVyOwG37/sDk4UHptZ+NQG3vu6IV0nQZ8I= X-Received: by 2002:a6b:ce15:: with SMTP id p21-v6mr4079327iob.257.1528313024265; Wed, 06 Jun 2018 12:23:44 -0700 (PDT) MIME-Version: 1.0 References: <20180530183826.GI7063@linux.vnet.ibm.com> <20180606190710.GY3593@linux.vnet.ibm.com> In-Reply-To: <20180606190710.GY3593@linux.vnet.ibm.com> From: Linus Torvalds Date: Wed, 6 Jun 2018 12:23:33 -0700 Message-ID: Subject: Re: LKMM litmus test for Roman Penyaev's rcu-rr To: Paul McKenney Cc: Roman Pen , Alan Stern , Linux Kernel Mailing List , linux-arch , andrea.parri@amarulasolutions.com, Will Deacon , Peter Zijlstra , Boqun Feng , Nick Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 6, 2018 at 12:05 PM Paul E. McKenney wrote: > > 3. Introduce a new marking/attribute in the .def file that indicates > whether an access is volatile or implies a compiler barrier. > This might allow herd to be more selective about control dependencies, > for example, extending them past the end of "if" statements > containing compiler barriers. > > One tricky aspect of this approach is working out what the > compiler can do to the "if" statement. We definitely do not > want to put the complexity of all possible compilers into herd! This _smells_ like the right thing to do. Aren't the litmus-tests effectively always going to be using READ_ONCE etc volatile accesses anyway? Most of what the LKMM litmus tests test for is things with side effects, no? And honestly, that is exactly the kind of litmus test behavior we *want* our memory model to have, in that any CPU designer (or compiler designer) that uses our LKMM litmus tests should very much be aware of the fact that we expect a conditional->store memory ordering to be a ordering. We have real code that depends on it, so I think LKMM should expose those ordering requirements. I'm also perfectly happy with no markings at all: all memory accesses are "voiatile" as fat as C is concerned, and cannot be moved around by the compiler at all - and all that LKMM tests is memory _ordering_, not "compiler can do X". Because I think your option 1. is absolutely against everything we want to happen: > 1. Status quo. This works reasonably well, but we have already > seen that your scenario makes it ask for more synchronization > than necessary. We absolutely do *not* want CPU designers etc thinking that we'll add insane synchronization. We were already burned by insane bad CPU design once in the form of the garbage that alpha desigers gave us. I am personally not at all interested in seeing our memory ordering rules be "nice". They should be as tight as possible, and *not* allow any crazy shit that some insane person can come up with. No more "dependent reads out of ordetr" garbage, and no more "store done before the condition it depends on" garbage. A CPU designer (or a C++ memory ordering person) who tries to sneak shit like that past us should be shunned, and not taken seriously. And our memory ordering rules should be very explicit about it, so that people don't even _try_ to do insane things. I want any memory ordering litmus tests to say "we depend on this, so as a CPU designer don't mess it up, because then we won't run on the resulting crap". I'm not in the least interested in the LKMM litmus tests being an excuse for unnecessarily weak memory ordering. That's the *opposite* of what I would want any litmus tests to do. If people are looking to use them that way, then I'm going to remove them, because such litmus tests are not in the best interest of the kernel. Future CPU designs need to be *saner*, not perpetuate the kind of garbage insanity we have seen so far. Linus