From: Akira Yokosawa <akiyks@gmail.com>
To: Jonas Oberhauser <jonas.oberhauser@huaweicloud.com>, paulmck@kernel.org
Cc: stern@rowland.harvard.edu, parri.andrea@gmail.com,
will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com,
npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk,
luc.maranget@inria.fr, 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,
Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH v3 4/5] tools/memory-model: Switch to softcoded herd7 tags
Date: Sat, 21 Sep 2024 20:28:04 +0900 [thread overview]
Message-ID: <a333f5f9-ffc0-4dea-80de-92e275492235@gmail.com> (raw)
In-Reply-To: <c0b25884-b22a-46d6-949a-81fa9ce8f836@huaweicloud.com>
Hi,
On Sat, 21 Sep 2024 09:39:05 +0200, Jonas Oberhauser wrote:
> Thanks Akira for your continued eagle eyes!
> Will include in next revision.
>
> One question below.
> jonas
>
>
>
> Am 9/21/2024 um 4:44 AM schrieb Akira Yokosawa:
>> This litmus test is not compatible with klitmus7, which is much
>> stricter than herd7's C parser.
>>
>> You can have only int or int* variables in the exists clause.
I should have said:
By default, you can have only int or int* variables in the exists clause.
You can find an example where an atomic_t variable is listed in its exists
clause at:
Documentation/litmus-tests/atomic/Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
, where the atomic_t variable is declared explicitly in the initialization
block as follows:
{
atomic_t v = ATOMIC_INIT(1);
}
>> Register variables need their declarations at the top of each Pn()
>> (classic C).
>>
>> See below for klitmus7 ready code.
>>
>> And tools/memory-model/litmus-tests/README need to mention this
>> litmus test.
>>
>> Thanks, Akira
>>
>> ---------------------------------------------
>> P0(int *x, int *y, atomic_t *z)
>> {
>> int r0;
>>
>> WRITE_ONCE(*x, 1);
>> r0 = atomic_add_unless(z,1,5);
>> WRITE_ONCE(*y, 1);
>> }
>>
>> P1(int *x, int *y)
>> {
>> int r0;
>>
>> r0 = READ_ONCE(*y);
>> if (r0 == 1)
>> WRITE_ONCE(*x, 2);
>> }
>>
>> exists (1:r0=1 /\ x=1)
>> ---------------------------------------------
>>
>
> Should z also be changed from atomic_t to int?
>
No, it should not.
Such a change would make z incompatible with atomic_add_unless().
Thanks, Akira
next prev parent reply other threads:[~2024-09-21 11:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 13:06 [PATCH v3 0/5] tools/memory-model: Define more of LKMM in tools/memory-model Jonas Oberhauser
2024-09-19 13:06 ` [PATCH v3 1/5] tools/memory-model: Legitimize current use of tags in LKMM macros Jonas Oberhauser
2024-09-19 13:06 ` [PATCH v3 2/5] tools/memory-model: Define applicable tags on operation in tools/ Jonas Oberhauser
2024-09-19 13:06 ` [PATCH v3 3/5] tools/memory-model: Define effect of Mb tags on RMWs " Jonas Oberhauser
2024-09-19 13:06 ` [PATCH v3 4/5] tools/memory-model: Switch to softcoded herd7 tags Jonas Oberhauser
2024-09-20 12:23 ` Hernan Ponce de Leon
2024-09-21 2:44 ` Akira Yokosawa
2024-09-21 7:39 ` Jonas Oberhauser
2024-09-21 11:28 ` Akira Yokosawa [this message]
2024-09-19 13:06 ` [PATCH v3 5/5] tools/memory-model: Distinguish between syntactic and semantic tags Jonas Oberhauser
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=a333f5f9-ffc0-4dea-80de-92e275492235@gmail.com \
--to=akiyks@gmail.com \
--cc=boqun.feng@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=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).