[PATCH v15 5/8] nptl: Introduce <rseq-access.h> for RSEQ_* accessors
Michael Jeanson
mjeanson@efficios.com
Wed Jan 8 16:22:00 GMT 2025
On 2025-01-08 04:17, Florian Weimer wrote:
> * Michael Jeanson:
>
>> In preparation to move the rseq area to the 'extra TLS' block, we need
>> accessors based on the thread pointer and the rseq offset. The VOLATILE
>> variant of the accessors ensures single-copy atomicity for loads and
>> stores which is required for all fields once the registration is active.
>
> This isn't generally how we use the term “volatile”, though. Torn reads
> and writes perfectly fine for volatile access. Maybe it's closer to
> relaxed memory order? Or if you don't really like that, use ONCE in the
> macro names?
I like "ONCE", I initially used VOLATILE because I derived these macros
from the tcb accessors macros but these new ones do indeed offer
stricter guarantees, I'll update the names.
>
> The implementation looks okay, but code-generation on Clang is
> suboptimal for x86-64. It reloads __rseq_offset from memory for each
> RSEQ_GETMEM_VOLATILE usage, while GCC keeps referring to the
> already-loaded value in a register. We can rework this later if this
> proves to be a problem.
I'll make a note to look into this once the patchset is merged.
>
> Thanks,
> Florian
>
More information about the Libc-alpha
mailing list