From: Peter Zijlstra <peterz@infradead.org>
To: Boqun Feng <boqun@kernel.org>
Cc: "Will Deacon" <will@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
linux-mm@kvack.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] rust: page: add byte-wise atomic memory copy methods
Date: Wed, 18 Feb 2026 12:20:30 +0100 [thread overview]
Message-ID: <20260218112030.GE1282955@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <aZShEW2b9-71r18I@tardis.local>
On Tue, Feb 17, 2026 at 09:10:42AM -0800, Boqun Feng wrote:
> To me, having a atomic_bytewise_memcpy() at least clear things out about
> what is actually needed (at the very minimal) to have a concurrent-safe
> memcpy(). Moving forward, since the concept has been already somehow
> proposed to C/C++, it's likely to be standardized (we can push it from
> the kernel end as well) so we don't need to implement a concurrent-safe
> memcpy() for all architectures on our own.
>
> Hope this makes some sense ;-)
So all of this is about compilers being silly, not about there being a
problem with memcpy().
memcpy() as implemented by all architectures is *FINE*.
The proposal you refer to is:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1478r7.html
(as shared by Will on IRC) and right from the start it goes sideways:
"But fences only order atomic accesses,"
This is of course complete and utter bollocks.
No actual hardware works that way, so for the C virtual machine to be
specified that way is complete insanity. This insanity then leads to all
sorts of problems, and then these imaginary problems need solutions and
we're up a creek that smells real bad.
Can we please just 'fix' things by stating that *all* loads and stores
are properly affected by the relevant barriers. Then things like:
https://lkml.kernel.org/r/cbbea9ecb994df975109d97a7756d73e@garyguo.net
also instantly resolve themselves, because the compiler just isn't
allowed to be *that* stupid^Wclever.
next prev parent reply other threads:[~2026-02-18 11:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 6:42 Andreas Hindborg
2026-02-13 11:28 ` Peter Zijlstra
2026-02-13 12:45 ` Andreas Hindborg
2026-02-13 14:35 ` Peter Zijlstra
2026-02-13 16:42 ` Boqun Feng
2026-02-14 8:18 ` Andreas Hindborg
2026-02-17 18:47 ` Boqun Feng
2026-02-13 17:44 ` Boqun Feng
2026-02-14 8:04 ` Andreas Hindborg
2026-02-17 8:55 ` Peter Zijlstra
2026-02-17 9:42 ` Gary Guo
2026-02-17 10:47 ` Will Deacon
2026-02-17 17:10 ` Boqun Feng
2026-02-18 8:53 ` Peter Zijlstra
2026-02-18 11:20 ` Peter Zijlstra [this message]
2026-02-17 12:03 ` Alice Ryhl
2026-02-17 17:32 ` Boqun Feng
2026-02-17 23:10 ` Gary Guo
2026-02-18 9:40 ` Alice Ryhl
2026-02-18 10:20 ` Peter Zijlstra
2026-02-18 11:36 ` Gary Guo
2026-02-18 12:12 ` Peter Zijlstra
2026-02-18 11:56 ` Miguel Ojeda
2026-02-18 12:00 ` Alice Ryhl
2026-02-18 12:07 ` Miguel Ojeda
2026-02-18 12:33 ` Andreas Hindborg
2026-02-18 14:42 ` Benno Lossin
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=20260218112030.GE1282955@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lossin@kernel.org \
--cc=mark.rutland@arm.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--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