[libc][rpc] Fix the memory ordering in lock.
Prevent operation reordering with fence instead of a comment. The mailboxes are in shared memory and the locks structure in device memory. If the mailboxes are read and then the lock taken, the lock says nothing about the current or future state of those mail boxes. The relaxed atomic fetch_or can be reordered before the relaxed atomic loads of unrelated variables unless there is a fence preventing this. Patches both Client::try_open and Server::try_open, one of which is missing an optimisation and the other is missing the comment, but which otherwise could be Process::try_open followed by buffer->opcode = opcode in Client. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D149790
Loading
Please sign in to comment