Skip to content

Commit

Permalink
prov/shm: Add memory barrier before updating resp for atomic
Browse files Browse the repository at this point in the history
In smr_progress_cmd_atomic, resp is updated after calling
smr_progress_inline/inject_atomic, which involves a memcpy in
smr_do_atmoic for compare and fetch cases. Currently, there is
no memory barrier between the memcpy and the resp update, this
can make resp updated before the memcpy is done on ARM, which has
a weak memory model. This patch adds a memory barrier before updating
the resp to make the operations serialized.

Signed-off-by: Shi Jin <sjina@amazon.com>
  • Loading branch information
shijin-aws committed Sep 26, 2023
1 parent d8a9781 commit e3a97d1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions prov/shm/src/smr_progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ static int smr_progress_cmd_atomic(struct smr_ep *ep, struct smr_cmd *cmd,
if (cmd->msg.hdr.data) {
peer_smr = smr_peer_region(ep->region, cmd->msg.hdr.id);
resp = smr_get_ptr(peer_smr, cmd->msg.hdr.data);
ofi_wmb();
resp->status = -err;
}

Expand Down

0 comments on commit e3a97d1

Please sign in to comment.