From: Hernan Ponce de Leon <hernan.poncedeleon@huaweicloud.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
kernel-team@meta.com, parri.andrea@gmail.com,
boqun.feng@gmail.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr,
Joel Fernandes <joel@joelfernandes.org>
Subject: Re: LKMM: Making RMW barriers explicit
Date: Thu, 23 May 2024 16:26:23 +0200 [thread overview]
Message-ID: <a25f9654-e681-1bad-47ae-ddc519610504@huaweicloud.com> (raw)
In-Reply-To: <35b3fd07-fa85-4244-b9cb-50ea54d9de6a@rowland.harvard.edu>
On 5/23/2024 4:05 PM, Alan Stern wrote:
> On Thu, May 23, 2024 at 02:54:05PM +0200, Jonas Oberhauser wrote:
>>
>>
>> Am 5/22/2024 um 4:20 PM schrieb Alan Stern:
>>> It would be better if there was a way to tell herd7 not to add the 'mb
>>> tag to failed instructions in the first place. This approach is
>>> brittle; see below.
>>
>> Hernan told me that in fact that is actually currently the case in herd7.
>> Failing RMW get assigned the Once tag implicitly.
>> Another thing that I'd suggest to change.
>
> Indeed.
>
>>> An alternative would be to have a way for the .cat file to remove the
>>> 'mb tag from a failed RMW instruction. But I don't know if this is
>>> feasible.
>>
>> For Mb it's feasible, as there is no Mb read or Mb store.
>>
>> Mb = Mb & (~M | dom(rmw) | range(rmw))
>>
>> However one would want to do the same for Acq and Rel.
>>
>> For that one would need to distinguish e.g. between a read that comes from a
>> failed rmw instruction, and where the tag would disappear, or a normal
>> standalone read.
>>
>> For example, by using two different acquire tags, 'acquire and 'rmw-acquire,
>> and defining
>>
>> Acquire = Acquire | Rmw-acquire & (dom(rmw) | range(rmw))
>>
>> Anyways we can do this change independently. So for now, we don't need
>> RMW_MB.
>
> Overall, it seems better to have herd7 assign the right tag, but change
> the way the .def file works so that it can tell herd7 which tag to use
> in each of the success and failure cases.
I am not fully sure how herd7 uses the .def file, but I guess something
like adding a second memory tag to __cmpxchg could work
cmpxchg(X,V,W) __cmpxchg{mb, once}(X,V,W)
cmpxchg_relaxed(X,V,W) __cmpxchg{once, once}(X,V,W)
cmpxchg_acquire(X,V,W) __cmpxchg{acquire, acquire}(X,V,W)
cmpxchg_release(X,V,W) __cmpxchg{release, release}(X,V,W)
Hernan
>
>>> [M] ; po ; [RMW_MB]
>>>
>>> [RMW_MB] ; po ; [M]
>>>
>>> This is because events tagged with RMW_MB always are memory accesses,
>>> and accesses that aren't part of the RMW are already covered by the
>>> fencerel(Mb) thing above.
>>
>> This has exactly the issue mentioned above - it will cause the rmw to have
>> an internal strong fence that on powerpc probably isn't there.
>
> Oops, that's right. Silly oversight on my part. But at least you
> understood what I meant.
>
>> We could do (with the assumption that Mb applies only to successful rmw):
>>
>> [M] ; po ; [Mb & R]
>> [Mb & W] ; po ; [M]
>
> That works.
>
> Alan
next prev parent reply other threads:[~2024-05-23 14:26 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 1:43 Alan Stern
2024-05-16 8:31 ` Jonas Oberhauser
2024-05-16 8:44 ` Hernan Ponce de Leon
2024-05-18 0:31 ` Alan Stern
2024-05-21 9:57 ` Jonas Oberhauser
2024-05-21 15:36 ` Alan Stern
2024-05-22 9:20 ` Jonas Oberhauser
2024-05-22 14:20 ` Alan Stern
2024-05-22 16:54 ` Andrea Parri
2024-05-22 18:20 ` Alan Stern
2024-05-22 19:48 ` Hernan Ponce de Leon
2024-05-23 9:04 ` Andrea Parri
2024-05-23 14:27 ` Jonas Oberhauser
2024-05-23 16:35 ` Andrea Parri
2024-05-23 20:30 ` Jonas Oberhauser
2024-05-24 3:30 ` Andrea Parri
2024-05-24 8:16 ` Hernan Ponce de Leon
2024-05-23 12:54 ` Jonas Oberhauser
2024-05-23 13:35 ` Paul E. McKenney
2024-05-23 14:05 ` Alan Stern
2024-05-23 14:26 ` Hernan Ponce de Leon [this message]
2024-05-23 15:14 ` Boqun Feng
2024-05-24 1:38 ` Alan Stern
2024-05-24 2:50 ` Boqun Feng
2024-05-24 14:14 ` Alan Stern
2024-05-24 14:34 ` Boqun Feng
2024-05-24 14:53 ` Alan Stern
2024-05-24 18:09 ` Jonas Oberhauser
2024-05-24 18:47 ` Boqun Feng
2024-05-24 18:48 ` Alan Stern
2024-05-23 16:05 ` Alan Stern
2024-05-23 14:36 ` Jonas Oberhauser
2024-05-21 11:38 ` 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=a25f9654-e681-1bad-47ae-ddc519610504@huaweicloud.com \
--to=hernan.poncedeleon@huaweicloud.com \
--cc=boqun.feng@gmail.com \
--cc=j.alglave@ucl.ac.uk \
--cc=joel@joelfernandes.org \
--cc=jonas.oberhauser@huaweicloud.com \
--cc=kernel-team@meta.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.maranget@inria.fr \
--cc=parri.andrea@gmail.com \
--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
all inboxes | Powered by JetHome®