[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b54575b9-ab29-4bcd-ae7a-6132d1e36195@rowland.harvard.edu>
Date: Wed, 29 May 2024 10:07:44 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>
Cc: Boqun Feng <boqun.feng@...il.com>, Andrea Parri <parri.andrea@...il.com>,
Hernan Ponce de Leon <hernan.poncedeleon@...weicloud.com>, will@...nel.org,
peterz@...radead.org, npiggin@...il.com, dhowells@...hat.com,
j.alglave@....ac.uk, luc.maranget@...ia.fr, paulmck@...nel.org,
akiyks@...il.com, dlustig@...dia.com, joel@...lfernandes.org,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal)
representation
On Wed, May 29, 2024 at 02:37:30PM +0200, Jonas Oberhauser wrote:
>
>
> Am 5/28/2024 um 7:58 PM schrieb Boqun Feng:
> > 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;
> > }
>
> Oh, you're right. Then probably the rule I was violating is that
> value-returning macros can not be defined with {} at all.
>
> Given herd's other syntactic limitations, perhaps the best way would be to
> introduce these macros as
>
> x = cmpxchg(...) {
> __fence{mb-successful-rmw};
> x = __cmpxchg{once}(...);
> __fence{mb-successful-rmw};
> }
>
> since I think x = M(...) is the only way we are allowed to use these macros
> anyways.
If we did this, how would the .cat file know to ignore the fence events
when the cmpxchg() fails? It doesn't look like there's anything to
connect the two of them.
Adding the MB tag to the cmpxchg itself seems like the only way forward.
Alan
Powered by blists - more mailing lists