Re: [WIP 0/3] Memory model and atomic API in Rust

From: Peter Zijlstra
Date: Tue Apr 09 2024 - 06:50:53 EST


On Mon, Mar 25, 2024 at 01:59:55PM -0700, Boqun Feng wrote:
> On Mon, Mar 25, 2024 at 10:44:45AM +0000, Mark Rutland wrote:
> [...]
> > >
> > > * I choose to re-implement atomics in Rust `asm` because we are still
> > > figuring out how we can make it easy and maintainable for Rust to call
> > > a C function _inlinely_ (Gary makes some progress [2]). Otherwise,
> > > atomic primitives would be function calls, and that can be performance
> > > bottleneck in a few cases.
> >
> > I don't think we want to maintain two copies of each architecture's atomics.
> > This gets painful very quickly (e.g. as arm64's atomics get patched between
> > LL/SC and LSE forms).
> >
>
> No argument here ;-)

Didn't we talk about bindgen being able to convert inline C functions
into equivalent inline Rust functions? ISTR that getting stuck on Rust
not having a useful inline asm.

But fixing all that in a hurry seems like the much saner path forward.