[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8fb64c8-ec53-4087-bbbc-72c7e59d8dbf@rowland.harvard.edu>
Date: Wed, 5 Jun 2024 09:40:20 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Jonas Oberhauser <jonas.oberhauser@...weicloud.com>, paulmck@...nel.org,
parri.andrea@...il.com, will@...nel.org, peterz@...radead.org,
npiggin@...il.com, dhowells@...hat.com, j.alglave@....ac.uk,
luc.maranget@...ia.fr, akiyks@...il.com, dlustig@...dia.com,
joel@...lfernandes.org, urezki@...il.com, quic_neeraju@...cinc.com,
frederic@...nel.org, linux-kernel@...r.kernel.org,
Viktor Vafeiadis <viktor@...-sws.org>
Subject: Re: [PATCHv2 3/4] tools/memory-model: Define effect of Mb tags on
RMWs in tools/...
On Tue, Jun 04, 2024 at 09:28:42PM -0700, Boqun Feng wrote:
> On Tue, Jun 04, 2024 at 06:04:40PM +0200, Jonas Oberhauser wrote:
> > --- 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]) |
>
> I couldn't help suggestting:
>
> ([M] ; po ; [Mb & domain(rmw)]) |
> ([Mb & range(rmw)] ; po ; [M]) |
>
> , it's a bit more clear to me, but maybe the comment above is good
> enough?
We may want to use the patch's approach for other things besides RMW.
For instance, it would be a good way to implement smp_store_mb() --
compare it to the existing implementation in the .def file.
Alan
Powered by blists - more mailing lists