From: Peter Zijlstra <peterz@infradead.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Daniel Xu <dxu@dxuuu.xyz>,
mingo@redhat.com, will@kernel.org, longman@redhat.com,
boqun.feng@gmail.com, linux-kernel@vger.kernel.org,
linux-toolchains@vger.kernel.org
Subject: Re: [PATCH] seqlock: Use WRITE_ONCE() when updating sequence
Date: Thu, 19 Dec 2024 18:53:33 +0100 [thread overview]
Message-ID: <20241219175333.GE26279@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <87v7vfwrj8.fsf@oldenburg.str.redhat.com>
On Thu, Dec 19, 2024 at 05:45:15PM +0100, Florian Weimer wrote:
> > Peter's "(*(volatile unsigned int *)&s->sequence)++;" qualifies as sane.
>
> I think the reference was originally to machine code.
Correct; however more tinkering with godbolt got me:
https://godbolt.org/z/6xoxjdYPx
Where we can see that clang can even optimize the WRITE_ONCE(foo,
READ_ONCE(foo) + 1) case, which I though it would not be able to do.
So perhaps we just need to get GCC fixed.
next prev parent reply other threads:[~2024-12-19 17:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0eaea03ecc9df536649763cfecda356fc38b6938.1734477414.git.dxu@dxuuu.xyz>
[not found] ` <20241218103000.GK11133@noisy.programming.kicks-ass.net>
[not found] ` <ff2aecbc-cd5d-4a9c-92b1-792555300301@paulmck-laptop>
[not found] ` <20241218162325.GH2354@noisy.programming.kicks-ass.net>
[not found] ` <20241218162934.GJ12500@noisy.programming.kicks-ass.net>
[not found] ` <9b6d585a-c17f-4dd1-9518-b28ac2dfd855@paulmck-laptop>
2024-12-18 17:12 ` [PATCH] seqlock: Use WRITE_ONCE() when updating sequence Peter Zijlstra
2024-12-18 19:15 ` Paul E. McKenney
2024-12-18 19:56 ` Florian Weimer
2024-12-19 16:10 ` Paul E. McKenney
2024-12-19 16:45 ` Florian Weimer
2024-12-19 17:48 ` Paul E. McKenney
2024-12-19 17:53 ` Peter Zijlstra [this message]
2024-12-19 16:34 ` Will Deacon
2024-12-19 17:53 ` Paul E. McKenney
2024-12-19 17:58 ` Will Deacon
2024-12-19 18:06 ` Paul E. McKenney
2024-12-19 18:31 ` Will Deacon
2024-12-20 17:40 ` Paul E. McKenney
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=20241219175333.GE26279@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=boqun.feng@gmail.com \
--cc=dxu@dxuuu.xyz \
--cc=fweimer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--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