Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp578525lqs; Tue, 5 Mar 2024 10:01:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8pkqL5IZZytjew0kOAVJ3j+RPYid2wx962Be+GF+R9pVL4owd+/j5QQSrcEvm/KvmjWxl5JL6QwsvcUSPZzJCARd5tLuq8qP7nS+TgQ== X-Google-Smtp-Source: AGHT+IE1kfwWiuAcKSNOqlz5M+I1I4YpbQWvPfFjoD9fRMy9gAHba4WoneJOcrFMMiUWk2JVIQNr X-Received: by 2002:a17:902:ea0b:b0:1dc:8790:6824 with SMTP id s11-20020a170902ea0b00b001dc87906824mr3228332plg.15.1709661671548; Tue, 05 Mar 2024 10:01:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709661671; cv=pass; d=google.com; s=arc-20160816; b=TGaUYa64FoukWKSN5wZKfk2XHl8m+VH4f5VWzc0a5FbWIdumGRXryy3xJCXSNyIeiC WPAkCUBg1/aviV3Ebzkr13oF1PweeXCchsgUU/9sPU7DaHh0O+9lHADFqAzet9b0Gzw5 oKlKO0OfoQeWL+4HvQD0tGG8m+D/UTA4tQ8Cl3NT0p8QMlN2F6lAmo+JUYRxXwx7OQ5V CY7qx9eIiEsSDwttJde8lGSQtEOAfzd4hUP8Fx2p0qEa+1QpIjW9FtkvjsItRqxPrkg3 j+ECUIltPnK67wjEsBHdkH4gfVTCmgrld9nlQvHw6pImVMzGBQO84RkRaX+a2Qs+uBVY 6zLg== 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:dkim-signature; bh=27cpkDliv4phKeyXY6if7yaIXftfTDK3iYfOFdeql1g=; fh=/BGcxPOnajH3qfppiKF0glHJZqeyHPEOfAv8mPqGYYs=; b=Klc6pRcBSC4ugdx19z0gv019H2Fxc+9Hp8DbuQl6CRAIvh2JbZB4Q52mP9chOeLQ3Z KLmYrsbrZ9gGqbvZKIlKqhu46yihfe68x6/SqoIq5LP8gQggVnhZYa+gI1e4OlqJr7v0 6zO7RLVXqXT6vL41GAM0uIlh4PXgY1QdDHjTxLBxxoUZikD1UdUYF+W7a0WGRe5dsa9A mZ+OArVZftpRb+pw2gj3mEV3upjDw+ywU1RnMG61jdizb4jLMoptRlrQ0ABXfbuJJ1zH /SNB8LGfMflECzLK1GHBgbzJTdr4+wrlWfFbETUiHw4EvbUzqZg2G/Pnx3rJuF9S/kz3 QF3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NIEjZitG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-92800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y6-20020a63ce06000000b005e19d15689bsi10434588pgf.819.2024.03.05.10.01.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 10:01:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NIEjZitG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-92800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8999D2833A7 for ; Tue, 5 Mar 2024 18:01:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4450117C61; Tue, 5 Mar 2024 18:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NIEjZitG" Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C563E17BAF for ; Tue, 5 Mar 2024 18:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661663; cv=none; b=nAiXEgdrIBmWTw7SH+QjtU0ayZRgSh9EpMFVdx9HIUTseKbSZGpPeWOuJtPKHP49Oxbkx1sylzOWXzIpnnkKlrpXJJ7LkM3DXAULppztEOdCq/ecHrFU6I+Dg8FiGfrC0TAINuVCEvEV2udVPOCWJr3AVd6nh2SIT97sw/rlMZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661663; c=relaxed/simple; bh=rEM1Wot+0yLrpjry9XjrxZc/2orBsoOXWjzQ3b1DJu4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uCWCWQpquEsF1kGme/WbaxbrLUus0srBU+P31SqNCqrZtCQRfSjxtFrcx0QqgoRKGBhR9dO55t32vXw1ySx7Ff7vM8qI71Q3R3UiuHKtL5qOEbx2we9w4MXR92Odj1zhxNJKgWvU0wc9reA6YGWBBVgpeOgzVjz3dl0gq5rweG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NIEjZitG; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so76015661fa.3 for ; Tue, 05 Mar 2024 10:01:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709661660; x=1710266460; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=27cpkDliv4phKeyXY6if7yaIXftfTDK3iYfOFdeql1g=; b=NIEjZitG6kXmbvtbAmoZiLOYQBEWQOPxSguAgcgXJo4fUEnqN/np8uk7zZAGljJSd+ mYCprHlY1ltJ6nZf7DmJt9YR+jqztoHX3VCKdsNtKelCbxLHe1x9x8XcaigLbSWxUSys K3BDkb3R3vdclM1Clke3x+WieqxYgBX0/TrvuPHFPWoaw8heupc9Kzm5V1dEYsUfz4dK eaFNnHL6QgA5+iwkfe9yzJmXeUUItC5wA8dCPRNrEaUdGltpGbS7KY4HJ/6FzoCsUlVu 2XIQiMyxCgLMcOoWO+uOKZim/0wCUp6jNVEkbhi+RYOCk5wmXPsfMpmFxAq/mtn1Lev4 rcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709661660; x=1710266460; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=27cpkDliv4phKeyXY6if7yaIXftfTDK3iYfOFdeql1g=; b=sRatKNHLorr3Mdl3Es9OfapbCW8WnEnBKSkR7Ablhti5/cVLt9zEnbNuWcdSfll01C 1YxESUqlvBGdUkIaLwRTilQTZ8htcxMLZs4zxWRGQf+Fu5QVXxfj+CgS8f+lbTTRa9nE L0Pj59OcsHlO6OkCaJY53gAo626X+ILjEpvdrincWz6HVscgSAh6i0fuKhes5jjLvXWg OHgL8J5nG2YVKGBt9MlngBOzASVJyjOsDU7HZFUX3DuA78624gFcbrcCMB0peA1KZWFM 6wlHSmd+J5XqmM64LRBShFLDgcgYb4vpSzWYx+dvRARLet8AlTgRt8Z712GWaanBfIFz sJAg== X-Gm-Message-State: AOJu0Yyncj9u2rtDEgCrFR10xj7ZWnnqImXp2w74VJIhVGb6JA/s4sRn /ne9jxiHZhHpDHQZT+a5WIVuoKBDSM9DzahptZ0QoZ17mC3tLA9R+/OCnX/N X-Received: by 2002:a2e:8e21:0:b0:2d2:c1dd:4877 with SMTP id r1-20020a2e8e21000000b002d2c1dd4877mr1543116ljk.32.1709661659472; Tue, 05 Mar 2024 10:00:59 -0800 (PST) Received: from andrea ([31.189.122.3]) by smtp.gmail.com with ESMTPSA id c28-20020a50d65c000000b00565a9c11987sm6292454edj.76.2024.03.05.10.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 10:00:59 -0800 (PST) Date: Tue, 5 Mar 2024 19:00:55 +0100 From: Andrea Parri To: Kenneth-Lee-2012@foxmail.com Cc: linux-kernel@vger.kernel.org, stern@rowland.harvard.edu, 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: (Expanding Cc:,) > In the LKMM document, it said the pb link: > > E ->coe W ->cumul-fence* X ->rfe? Y ->strong-fence Z ->hb* F > > can make sure E execute before F. But the cat file define pb as follow: > > let pb = prop ; strong-fence ; hb* ; [Marked] > acyclic pb as propagation > > So the acyclic rule is only on pb relationshit itself. So it won't > forbid F -rfe-> E, will it? It only forgit F -pb-> E. So how can > propagation rule ensure E execute before F? With regard to your first question, the propagation rule does indeed forbid F ->rfe E. To see why, suppose that F ->rfe E (in particular, E is a load and the first link in your sequence is fre instead of coe). Then E ->fre W ->cumul-fence* X ->rfe? Y ->strong-fence Z ->hb* F ->rfe E. Since any rfe-link is an hb-link (by definition of the hb-relation), the previous expression can be written as follows: E ->fre W ->cumul-fence* X ->rfe? Y ->strong-fence Z ->hb* F ->hb E, that is, given that hb* is the reflexive transitive closure of hb, E ->fre W ->cumul-fence* X ->rfe? Y ->strong-fence Z ->hb* E, contradicting the fact that pb is acyclic. An argument similar to the one reported above can show that the propagation rule forbids F ->hb E. To address the second question, I'd start by first remarking that the CAT file doesn't define an "execute-before" relation currently. This file does however include the following comment: (* * The happens-before, propagation, and rcu constraints are all * expressions of temporal ordering. They could be replaced by * a single constraint on an "executes-before" relation, xb: * * let xb = hb | pb | rb * acyclic xb as executes-before *) In this sense, the propagation rule (like other "acyclicity"-constraints of the LKMM) expresses "temporal ordering", and any pb-link is (by definition) an "execute-before"-link. The file explanation.txt can provide additional context/information, based on the (informal) operational model described in that file, about this matter. Notice that, as examples in tools/memory-model/litmus-tests/ can illustrate, none of the three components of the xb-relation is redundant. Specifically, there do exist pb-links/cycles which are not hb-link/cycles (and viceversa). Maintaining three distinct/separate constraints (happens-before, propagation, and rcu) instead of a single "executes-before" constraint, although formally unnecessary, highlights the modularity and eases the debugging of the LKMM.