On Fri, Nov 04, 2022 at 10:15:08AM -0700, Linus Torvalds wrote: > On Fri, Nov 4, 2022 at 9:01 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > > > So cmpxchg_double() does a cmpxchg on a double long value and is > > currently supported by: i386, x86_64, arm64 and s390. > > > > On all those, except i386, two longs are u128. > > > > So how about we introduce u128 and cmpxchg128 -- then it directly > > mirrors the u64 and cmpxchg64 usage we already have. It then also > > naturally imposses the alignment thing. > > Ack, except that we might have some "u128" users that do *not* > necessarily want any alignment thing. > > But maybe we could at least start with an u128 type that is marked as > being fully aligned, and if some other user comes in down the line > that wants relaxed alignment we can call it "u128_unaligned" or > something. Hm, sounds maybe not so nice for another use case: arithmetic code that makes use of u128 for efficient computations, but otherwise has no particular alignment requirements. For example, `typedef __uint128_t u128;` in: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/crypto/poly1305-donna64.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/crypto/curve25519-hacl64.c I always thought it'd be nice to see that typedef alongside the others in the shared kernel headers, but figured the requirement for 64-bit and libgcc for some operations on some architectures made it a bit less general purpose, so I never proposed it. Jason