mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Cc: paulmck@kernel.org, stern@rowland.harvard.edu,
	parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org,
	npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk,
	luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com,
	joel@joelfernandes.org, urezki@gmail.com,
	quic_neeraju@quicinc.com, frederic@kernel.org,
	linux-kernel@vger.kernel.org, lkmm@lists.linux.dev,
	hernan.poncedeleon@huaweicloud.com,
	Viktor Vafeiadis <viktor@mpi-sws.org>
Subject: Re: [PATCH v4 3/5] tools/memory-model: Define effect of Mb tags on RMWs in tools/...
Date: Mon, 28 Oct 2024 15:15:46 -0700	[thread overview]
Message-ID: <ZyANEod5yRL2qq9e@Boquns-Mac-mini.local> (raw)
In-Reply-To: <20240930105710.383284-4-jonas.oberhauser@huaweicloud.com>

On Mon, Sep 30, 2024 at 12:57:08PM +0200, Jonas Oberhauser wrote:
> Herd7 transforms successful RMW with Mb tags by inserting smp_mb() fences
> around them. We emulate this by considering imaginary po-edges before the
> RMW read and before the RMW write, and extending the smp_mb() ordering
> rule, which currently only applies to real po edges that would be found
> around a really inserted smp_mb(), also to cases of the only imagined po
> edges.
> 
> Reported-by: Viktor Vafeiadis <viktor@mpi-sws.org>
> Suggested-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>

Regards,
Boqun

> ---
>  tools/memory-model/linux-kernel.cat | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat
> index adf3c4f41229..d7e7bf13c831 100644
> --- a/tools/memory-model/linux-kernel.cat
> +++ b/tools/memory-model/linux-kernel.cat
> @@ -34,6 +34,16 @@ let R4rmb = R \ Noreturn	(* Reads for which rmb works *)
>  let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb]
>  let wmb = [W] ; fencerel(Wmb) ; [W]
>  let mb = ([M] ; fencerel(Mb) ; [M]) |
> +	(*
> +	 * full-barrier RMWs (successful cmpxchg(), xchg(), etc.) act as
> +	 * though there were enclosed by smp_mb().
> +	 * The effect of these virtual smp_mb() is formalized by adding
> +	 * Mb tags to the read and write of the operation, and providing
> +	 * the same ordering as though there were additional po edges
> +	 * between the Mb tag and the read resp. write.
> +	 *)
> +	([M] ; po ; [Mb & R]) |
> +	([Mb & W] ; po ; [M]) |
>  	([M] ; fencerel(Before-atomic) ; [RMW] ; po? ; [M]) |
>  	([M] ; po? ; [RMW] ; fencerel(After-atomic) ; [M]) |
>  	([M] ; po? ; [LKW] ; fencerel(After-spinlock) ; [M]) |
> -- 
> 2.34.1
> 
> 

  reply	other threads:[~2024-10-28 22:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 10:57 [PATCH v4 0/5] tools/memory-model: Define more of LKMM in tools/memory-model Jonas Oberhauser
2024-09-30 10:57 ` [PATCH v4 1/5] tools/memory-model: Legitimize current use of tags in LKMM macros Jonas Oberhauser
2024-10-28 22:11   ` Boqun Feng
2024-09-30 10:57 ` [PATCH v4 2/5] tools/memory-model: Define applicable tags on operation in tools/ Jonas Oberhauser
2024-10-28 22:12   ` Boqun Feng
2024-09-30 10:57 ` [PATCH v4 3/5] tools/memory-model: Define effect of Mb tags on RMWs " Jonas Oberhauser
2024-10-28 22:15   ` Boqun Feng [this message]
2024-09-30 10:57 ` [PATCH v4 4/5] tools/memory-model: Switch to softcoded herd7 tags Jonas Oberhauser
2024-10-02 17:34   ` Hernan Ponce de Leon
2024-10-29  0:04   ` Boqun Feng
2024-10-29 23:42     ` Paul E. McKenney
2024-10-30 11:50     ` Jonas Oberhauser
2024-10-30 13:46       ` Paul E. McKenney
2024-09-30 10:57 ` [PATCH v4 5/5] tools/memory-model: Distinguish between syntactic and semantic tags Jonas Oberhauser
2024-10-29  0:15   ` Boqun Feng
2024-10-29 23:41     ` Paul E. McKenney
2024-10-30 11:38       ` Jonas Oberhauser
2024-10-30 14:34         ` Boqun Feng
2024-10-30 16:27           ` Paul E. McKenney
2024-11-05 20:21           ` Paul E. McKenney
2024-11-06 10:28             ` Jonas Oberhauser
2024-11-06 15:04               ` Paul E. McKenney
2024-11-06 18:00                 ` Paul E. McKenney
2024-11-07  9:05                   ` Jonas Oberhauser
2024-11-07 10:51                     ` Akira Yokosawa
2024-11-07 14:04                       ` Paul E. McKenney
2024-11-08  9:10                       ` Jonas Oberhauser
2024-11-08 10:12                         ` Akira Yokosawa
2024-11-08 11:07                           ` Jonas Oberhauser
2024-11-08 18:35                             ` Paul E. McKenney
2024-11-18 15:05                               ` Paul E. McKenney
2024-11-26 15:25                                 ` Jonas Oberhauser
2024-11-26 16:03                                   ` Paul E. McKenney
2024-10-28 20:16 ` [PATCH v4 0/5] tools/memory-model: Define more of LKMM in tools/memory-model Paul E. McKenney
2024-11-10 15:17   ` Akira Yokosawa

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=ZyANEod5yRL2qq9e@Boquns-Mac-mini.local \
    --to=boqun.feng@gmail.com \
    --cc=akiyks@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=frederic@kernel.org \
    --cc=hernan.poncedeleon@huaweicloud.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=joel@joelfernandes.org \
    --cc=jonas.oberhauser@huaweicloud.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkmm@lists.linux.dev \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=quic_neeraju@quicinc.com \
    --cc=stern@rowland.harvard.edu \
    --cc=urezki@gmail.com \
    --cc=viktor@mpi-sws.org \
    --cc=will@kernel.org \
    /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

all inboxes | Powered by JetHome®