Thread (51 messages) 51 messages, 4 authors, 2025-09-17

Re: [PATCH RESEND v7 4/6] arm64: futex: refactor futex atomic operation

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2025-09-16 07:02:12
Also in: kvmarm, lkml

On Mon, Sep 15, 2025 at 09:35:55PM +0100, Will Deacon wrote:
On Mon, Sep 15, 2025 at 08:40:33PM +0100, Catalin Marinas wrote:
quoted
On Mon, Sep 15, 2025 at 11:32:39AM +0100, Yeoreum Yun wrote:
quoted
So I think it would be better to keep the current LLSC implementation
in LSUI.
I think the code would look simpler with LL/SC but you can give it a try
and post the code sample here (not in a new series).
If you stick the cas*t instruction in its own helper say, cmpxchg_user(),
then you can do all the shifting/masking in C and I don't reckon it's
that bad. It means we (a) get rid of exclusives, which is the whole
point of this and (b) don't have to mess around with PAN.
We get rid of PAN toggling already since FEAT_LSUI introduces
LDTXR/STTXR. But, I'm all for CAS if it doesn't look too bad. Easier
I think if we do a get_user() of a u64 and combine it with the futex u32
while taking care of CPU endianness. All in a loop. Hopefully the
compiler is smart enough to reduce masking/or'ing to fewer instructions.

-- 
Catalin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help