LDREX/STREX and pre-emption on SMP hardware

Jamie Lokier jamie at shareable.org
Mon Aug 24 17:12:32 EDT 2009


Catalin Marinas wrote:
> BTW, some time ago I sent a patch to clear the exclusive monitor at
> every exception entry (interrupt, aborts etc.) but wasn't accepted. The
> main reason for that was to be able to only use STR for atomic_set()
> rather than the combination of LDREX/STREX we have now.

Would CLREX+STR work, and would it be an improvement?

> A similar reason for STR used in application signal handlers which
> are usually invoked without a __switch_to call (unless the signal
> handler is in a different application from the running one).

How about adding CLREX to the signal handling path?  Not exception
entry, but the part which sets up the signal frame.

If userspace can use STR for atomic_set normally, it's quite obscure
(and very difficult to detect) that that's fine everywhere except in
signal handlers, and even more obscure if it means siglongjmp() and
setcontext() can cause unrelated atomic ops to fail.

-- Jamie



More information about the linux-arm-kernel mailing list