Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp110957lqc; Thu, 7 Mar 2024 11:47:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4l/HSzZMKQSm0OhffIU6MLhqCnAG7Y54J9pTBDeTTpPqNjvx7dj/HKcPclseD9a45DC8QhJlQYVhiiLEP60jJpxw22sng9DgSHpzvYw== X-Google-Smtp-Source: AGHT+IFjBrTj4I6aETw3vK5tazPB4nx9ErthdoSR1yUjLxaicbg/HPo6mPwUpNtvsitoSxAu1E/H X-Received: by 2002:a05:620a:118e:b0:788:4b16:74fa with SMTP id b14-20020a05620a118e00b007884b1674famr1586114qkk.31.1709840826059; Thu, 07 Mar 2024 11:47:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709840826; cv=pass; d=google.com; s=arc-20160816; b=0tsI14cRpbP5quaS7T4iT4WeXsn+VdiR51w9wd0GoN2TkVDJkenUxjAOxH41qc0k9g JN7b8lKNwpWWOjOCkMynggOcQc2x+KTkE8v+d7WnJP6GSu7ye+WeB150XDEGeOEbXIqR WXqrrHIItBnlGiSEzK3CdVOWk6nTyIUmNanCpP0YhzFAcQPAoSkXM8cw3uxOeeD42ApD hC8rJ8aD53DJRwW1sFUQ7+ahcesEb5sPTDNfUDoYNARnOeUvGPiSfO0vyoBbZS506xJh KDZ3TX12sA0UBdu9FuBXFshIgcjZzIve6Vm2CBOyvc/9CGfkBWzYumn0J7/MwkUXrtZL aAXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=d61mNp3WlDujD5FEr/SeuZKeI/YLcBPF3hVlbNNS83E=; fh=vclOy54vrc4go6iMECrcor6hAewGQ03f2X+1SnH2p10=; b=qsoWgF5EamePLJn70aAAJdVZ/M+cacfgqmlXLyywJiarLcp1HgTaudQ5e0j2VIBcAy ofJfT7hXBT6BAk2qsuPBKAAncsMTIgx/NwDZxE+wi5IGb6zavOEAi8Co7G5laIDjDNyR HjwKv4F3NAwzj4+vFWpnLlRPPJZRLEbEvZ77VbGuLRnphOmfFpWflNUaUbIu2keQ2r+n BQoHtd53VfMPj8sg5xH+0HiEdFvCyzxv4G5aLeHKHaWKKOzJuHPLwqqzTRSYay9QWxLL +9EqhZVLCljMd6jWXvGj9+quUzDTKmRdkJmKGY8WpUWjwiHTdXf2J/pob/JFg9QRJMHN iI6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-96127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bs38-20020a05620a472600b007882fbe9c66si9585939qkb.706.2024.03.07.11.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 11:47:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-96127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C41741C20CC5 for ; Thu, 7 Mar 2024 19:47:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E83381369B4; Thu, 7 Mar 2024 19:46:59 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 3B7F1135A45 for ; Thu, 7 Mar 2024 19:46:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709840819; cv=none; b=newPl1GrokgYoa8yqQ+lNECoMiB3Kx1CM/oiGUz6S9pAebQbUrqiKGcCId+7auvecHwcR7HOhvA2922hWPanLhYqc4E5X3JgknsYxGAzbYcYdnzDYegyAeTZnxwHcssdpiQoWr3+UvXXSxFIhMusOy29uaY85mRiwYuWvuVfySU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709840819; c=relaxed/simple; bh=HODFHfKssOPLT885+7VMMgilrUGj5cbpfwyXP0arUls=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HPcLSjsPjrTNaDrtV4Jf2dHHk83xmU5laPNSdwGVeCQpz8nsJSazmPUd2VQ7w5VMgm6FEwn55iHi2aeGiBlY2gJUV7alyQbZzyzo1dEUijgjI6nFGT5Kb42zol4IX32uMVL/z1ulaV9QFDy6rh3WXqUF7blRJLngWUUypxmnFPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 230714 invoked by uid 1000); 7 Mar 2024 14:46:56 -0500 Date: Thu, 7 Mar 2024 14:46:56 -0500 From: Alan Stern To: Andrea Parri Cc: Kenneth-Lee-2012@foxmail.com, linux-kernel@vger.kernel.org, paulmck@kernel.org Subject: Re: Question about PB rule of LKMM Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Mar 07, 2024 at 08:08:46PM +0100, Andrea Parri wrote: > > > I'd disagree with these premises: certain instructions can and do execute > > > at the same time. > > > > Can you give an example? > > I think I'm starting to see where this is going..., but to address the > question: really any example where the LKMM doesn't know better, say > > C test > > {} > > P0(int *x) > { > *x = 1; > } > > P1(int *x) > { > *x = 2; > } Ah, but you see, any time you run this program one of those statements will execute before the other. Which will go first is indeterminate, but the chance of them executing at _exactly_ the same moment is zero. The LKMM can't say which will execute first because it could be either one. In other words, "I don't know which will execute first" is very different from "They will execute at the same time". > > > FWIW, in the formal model, it is not that difficult to > > > provide examples of "(not F ->xb E) and (not E ->xb F)". > > > > That's because the xb relation in the formal model does not fully > > capture our intuitive notion of "executes at the same time" in the > > informal operational model. > > > > Also, it's important to distinguish between: > > > > (1) Two instructions that are forced (say by a dependency) or known > > (say by an rfe link) to execute in a particular order; versus > > > > (2) Two instructions that may execute in either order but do execute > > in some particular order during a given run of the program. > > > > The formal xb relation corresponds more to (1), whereas the informal > > notion corresponds more to (2). > > This appears to be the key observation. For if, in the operational model, > (not F ->xb E) implies (E ->xb F) then I'll apologize for the noise. :-) Okay, so it looks like we're in violent agreement. :-) > > > > The new text says the same thing as the original, just in a more > > > > condensed way. It skips the detailed explanation of why E must execute > > > > before W propagates to E's CPU, merely saying that it is because "W is > > > > coherence-later than E". I'm not sure this is an improvement; the > > > > reader might want to know exactly how this reasoning goes. > > > > > > The current text relies on an argument by contradiction. A contradiction > > > is reached by "forcing" (F ->xb E), hence all it can be concluded is that > > > (not F ->xb E). Again, AFAICS, this doesn't match the claim in the text. > > > > That's why I suggested adding an extra sentence to the paragraph (which > > you did not quote in your reply). That sentence gave a direct argument. > > Well, I read that sentence but stopped at "These contradictions show that" > for the reason I detailed above. The way you put it also relies on argument by contradiction. This just wasn't visible, because you omitted a lot of intermediate steps in the reasoning. If you want to see this in detail, try explaining why it is that "W is coherence-later than E" implies "E must execute before W propagates to E's CPU" in the operational model. Alan