public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Cc: Andrea Parri <parri.andrea@gmail.com>,
	Hernan Ponce de Leon <hernan.poncedeleon@huaweicloud.com>,
	stern@rowland.harvard.edu, will@kernel.org, peterz@infradead.org,
	npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk,
	luc.maranget@inria.fr, paulmck@kernel.org, akiyks@gmail.com,
	dlustig@nvidia.com, joel@joelfernandes.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal) representation
Date: Tue, 28 May 2024 10:58:53 -0700	[thread overview]
Message-ID: <ZlYbXZSLPmjTKtaE@boqun-archlinux> (raw)
In-Reply-To: <41bc01fa-ce02-4005-a3c2-abfabe1c6927@huaweicloud.com>

On Mon, May 27, 2024 at 03:40:13PM +0200, Jonas Oberhauser wrote:
> 
> 
> Am 5/27/2024 um 3:28 PM schrieb Andrea Parri:
> > > > +    |                smp_store_mb | W[once] ->po F[mb]                        |
> > > 
> > > I expect this one to be hard-coded in herd7 source code, but I cannot find
> > > it. Can you give me a pointer?
> > 
> > smp_store_mb() is currently mapped to { __store{once}(X,V); __fence{mb}; } in
> > the .def file, so it's semantically equivalent to "WRITE_ONCE(); smp_mb();".
> 
> By the way, I experimented a little with these kind of mappings to see if we
> can just explicitly encode the mapping there. E.g., I had an idea to use
>     { __fence{mb-successful-rmw}; __cmpxchg{once}...;
> __fence{mb-successful-rmw}; }
> 
> for defining (almost) the current mapping of cmpxchg explicitly.
> 
> But none of the changes I made were accepted by herd7.
> 
> Do you know how the syntax works?
> 

This may not be trivial. Note that cmpxchg() is an expression (it has a
value), so in .def, we want to define it as an expression. However, the
C-like multiple-statement expression is not supported by herd parser, in
other words we want:

	{
		__fence{mb-successful-rmw};
		int tmp = __cmpxchg{once}(...);
		__fence{mb-successful-rmw};
		tmp;
	}

but herd parser doesn't support this as a valid expression.

Regards,
Boqun

>     jonas
> 

  reply	other threads:[~2024-05-28 18:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 15:13 [PATCH] tools/memory-model: Document herd7 (internal) representation Andrea Parri
2024-05-24 15:37 ` Andrea Parri
2024-05-24 15:51   ` Alan Stern
2024-05-24 15:55     ` Andrea Parri
2024-05-24 20:04   ` Alan Stern
2024-05-25 19:37   ` Alan Stern
2024-05-27  8:07     ` Andrea Parri
2024-06-05 15:31       ` Alan Stern
2024-06-05 17:05         ` Andrea Parri
2024-06-05 19:26           ` Andrea Parri
2024-06-05 19:40             ` Alan Stern
2024-05-27 13:16   ` Jonas Oberhauser
2024-05-24 15:53 ` Alan Stern
2024-05-24 16:00   ` Andrea Parri
2024-05-27 12:25     ` Hernan Ponce de Leon
2024-05-27 13:14       ` Jonas Oberhauser
2024-05-27 13:32       ` Andrea Parri
2024-05-27 13:33       ` Alan Stern
2024-05-27 12:22 ` Hernan Ponce de Leon
2024-05-27 13:28   ` Andrea Parri
2024-05-27 13:37     ` Alan Stern
2024-05-27 13:47       ` Jonas Oberhauser
2024-05-27 13:40     ` Jonas Oberhauser
2024-05-28 17:58       ` Boqun Feng [this message]
2024-05-29 12:37         ` Jonas Oberhauser
2024-05-29 14:07           ` Alan Stern
2024-05-29 14:17             ` Jonas Oberhauser
2024-05-29 14:24               ` Alan Stern
2024-05-29 14:33                 ` Jonas Oberhauser
2024-05-27 17:57     ` Hernan Ponce de Leon

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=ZlYbXZSLPmjTKtaE@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=akiyks@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=hernan.poncedeleon@huaweicloud.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=joel@joelfernandes.org \
    --cc=jonas.oberhauser@huaweicloud.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stern@rowland.harvard.edu \
    --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