Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4570856imm; Wed, 30 May 2018 08:02:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKvZmUxaybvKc9ysXvTQInRjsoU33TFuK3B4c8rOijCWbMl6ubAf4FOikNGnEDQIGmOVmws X-Received: by 2002:a62:1fd6:: with SMTP id l83-v6mr3158323pfj.182.1527692521283; Wed, 30 May 2018 08:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527692521; cv=none; d=google.com; s=arc-20160816; b=K89HSLvXyvQFB8P/xJFyn2vvJuIkzc9mnquXToyLMn/jAhPo3eDDRkWi41ukPK3i0f sw/xKB5NaPBe/f6FGax7tPs98UL5wNPkucA2NuQLRs/E1b9AhRyPLuj93ATOK0OmmqA9 OqiJJGYmDsHxw1sPKyIGUmvBlwao02zRU/mxB/DJAtI7Gwwd3iBWCHpFolgPFqKUgdzq CQOU1SmKvoc6spbKwkHIz1QtdQnxzgygaLfop11qyjXpVuAUJqg2YUVjjHKYhYCLHQ8j R0vVXF4+Mw/4SFUnw2O4XkkirDwIZI8mMwd8eAEaWw2nUPxKeCbRJibLb2N8gd7cRmvV QaGw== 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=HuEYhWl+tYU8Jwd1+csLCgf4Ab+db5emTdKy+IsBGls=; b=uPlO+wLEFMhslQyl+nkgOY9x5SBkIxUZb9wGnlBwi06+vusQUC7vfqISp7l/iMsqfe IxtTDF/BnMzxy2jpoGSG9b5JADBp3SqEVsur3owCaX8n4GVI8LY8lx8stOiQ+YSd6WE9 5uKye1NVdOpGd9I+a615HpXGbGM1hFar3YhVju5WJmA0k9YBTx9Cupni8/SwLgCZy2B8 /r0iAfhVp0L2zKC+EU9NpCyImMSekCgJNh1ADhmdGShUjJ3UgCvjbPJMx1IVNlZWM00g x1dKhBET/sZhJMA2NaYRAFe9v4ZJ4TnYp9XlYR6hO39S4f9ThQa5hHdD3ogEae6VoiqW jchA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=asZ7UCeS; 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 h3-v6si128034plb.100.2018.05.30.08.01.34; Wed, 30 May 2018 08:02:01 -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=asZ7UCeS; 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 S1753516AbeE3O7o (ORCPT + 99 others); Wed, 30 May 2018 10:59:44 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:39150 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751548AbeE3O7k (ORCPT ); Wed, 30 May 2018 10:59:40 -0400 Received: by mail-io0-f193.google.com with SMTP id 200-v6so20960287ioz.6; Wed, 30 May 2018 07:59:40 -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=HuEYhWl+tYU8Jwd1+csLCgf4Ab+db5emTdKy+IsBGls=; b=asZ7UCeShjxmoe9rtDMnD4Wc74egtImpdu0Pudz9gyCM2OXSbJMHHNChGezLCn7fFc lRBzdN3r1t6FkdU/UMAHwjH2hG8OJIvWXg++dr8SJYXe7wUJktuJdgYpYMAypLftkPch dyXkeCu4IIcP4dqWP1mVNUWBw4oAPFJY9hvn8= 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=HuEYhWl+tYU8Jwd1+csLCgf4Ab+db5emTdKy+IsBGls=; b=WVio0VqKCTv+Z2y3+SIeo5YT25jFBSll6M8a0xsbN85X865pP+xWUk4dbzYJbyQHSq htoEbR0WYUNmOFS0jhvyG+TrkZeeKyPKK3bjPrpyc2FhsrcXdbFPdwHwlsYdlk03RihZ EaZvVZ/YyOBdWHjWj2bW4+yK/1HFKQeMl8Wj3WpdGo/T9iBl7npp36XxBEIOPu3V9WCc 6X64CREOWPZSrTrM3gtlNhrB18oZKikm9YoD5v+8lRuNXf9HK8wYrpIuGnksUn1LZ6pF kjkv4GQGa386WzgXTUAhjqomOieejX/2PL1VL4fNiRijJ6dgK62XGLfDzpLviRWaWUZ4 1tow== X-Gm-Message-State: APt69E3QVmRWW9WB085p/h3KwMQVJLN0rZlQdiEsPVCX4HyV8l6N4hpC VdDqrMhpSNXPQrnDBTeGbdGUFeEIw36uaf/s/h0= X-Received: by 2002:a6b:f914:: with SMTP id j20-v6mr2734735iog.238.1527692379607; Wed, 30 May 2018 07:59:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 30 May 2018 09:59:28 -0500 Message-ID: Subject: Re: LKMM litmus test for Roman Penyaev's rcu-rr To: Alan Stern Cc: Paul McKenney , 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 , Roman Pen 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, May 30, 2018 at 9:29 AM Alan Stern wrote: > > > > Can't we simplify the whole sequence as basically > > > > A > > if (!B) > > D > > > > for that "not B" case, and just think about that. IOW, let's ignore the > > whole "not executed" code. > Your listing is slightly misleading. No. You're confused. You're confused because you're conflating two *entirely* different things. You're conflating the static source code with the dynamic execution. They are NOT THE SAME. It really should be: > A > if (!B) > ; // NOP > D No it really really shouldn't. There are two completely different situations: (1) there is the source code: A if (B) C D where C contains a barrier, and B depends on A and is not statically determinable. In the source code, 'D' looks unconditional BUT IT DAMN WELL IS NOT. It's not unconditional - it's just done in both conditions! That's a big big difference. > In other words, D should be beyond the end of the "if" statement, not > inside one of the branches. You're just completely confused. What you are stating makes no sense at all. Seriously, your reading of the code is entirely monsenscal, and seems to be about syntax, not about semantics. Which is crazy. Lookie here, you can change the syntactic model of that code to just be A if (B) C D else D and that code obviously has the EXACT SAME SEMANTICS. So if you get hung up on trivial syntactic issues, you are by definition confused, and your tool is garbage. You're doing memory ordering analysis, not syntax parsing, for chrissake! > At run time, of course, it doesn't matter; > CPUs don't try to detect where the two branches of an "if" recombine. > (Leaving aside issues like implementing an "if" as a move-conditional.) You cannot do it as a move-conditional, since that code generation would have been buggy shit, exactly because of C. But that's a code generation issue, not a run-time decision. So at run-time, the code ends up being A if (!B) D and D cannot be written before A has been read, because B depends on A, and you cannot expose specutive writes before the preconditions have been evaluated. > Remember, the original code was: > A > if (!B) > C > D > So the execution of D is _not_ conditional, and it doesn't depend on A > or B. (Again, CPUs don't make this distinction, but compilers do.) Again, the above is nothing but confused bullshit. D depends on B, which depends on A. Really. Really really. Anybody - or any tool - that doesn't see that is fundamentally wrong, and has been confused by syntax. A *compiler* will very much also make that distinction. If it doesn't make that distinction, it's not a compiler, it's a buggy piece of shit. Because semantics matter. Think about it. Linus