linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Parri <parri.andrea@gmail.com>
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
Date: Tue, 5 Mar 2024 19:00:55 +0100	[thread overview]
Message-ID: <Zedd18wiAkK68Lzr@andrea> (raw)
In-Reply-To: <tencent_C5266B7D6F024A916BCA7833FDEA94A74309@qq.com>

(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.

  reply	other threads:[~2024-03-05 18:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  3:18 Question about PB rule of LKMM Kenneth-Lee-2012
2024-03-05 18:00 ` Andrea Parri [this message]
2024-03-06  9:53   ` Kenneth-Lee-2012
2024-03-06 17:36     ` Andrea Parri
2024-03-06 18:29       ` Alan Stern
2024-03-06 19:24         ` Andrea Parri
2024-03-07  0:45           ` Kenneth-Lee-2012
2024-03-07 15:52           ` Andrea Parri
2024-03-07 17:25             ` Alan Stern
2024-03-07 18:18               ` Andrea Parri
2024-03-07 18:30                 ` Alan Stern
2024-03-07 19:08                   ` Andrea Parri
2024-03-07 19:46                     ` Alan Stern
2024-03-07 21:06                       ` Andrea Parri
2024-03-08 17:54                         ` Alan Stern
2024-03-08 21:29                           ` Andrea Parri
2024-03-08  3:10                     ` Kenneth-Lee-2012
2024-03-08 21:38                       ` Andrea Parri
2024-03-09  5:43                         ` Kenneth-Lee-2012
2024-03-10  2:27                           ` Andrea Parri
2024-03-10  2:52                             ` Kenneth-Lee-2012
2024-03-11  3:41                             ` Kenneth-Lee-2012
     [not found]                             ` <20240311034104.7iffcia4k5rxvgog@kllt01>
2024-03-11  8:20                               ` Kenneth-Lee-2012

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zedd18wiAkK68Lzr@andrea \
    --to=parri.andrea@gmail.com \
    --cc=Kenneth-Lee-2012@foxmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).