From 76189089b519639bd1a06378efcfe523e1a73e8e Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 2 Jun 2021 11:17:29 -0700 Subject: [PATCH] svm: release mem order for fifo chunk list CAS Type: fix Signed-off-by: Florin Coras Signed-off-by: Dave Wallace Change-Id: Ifad679f46abd6e9c18a3eaf7e55800a09f3791ab (cherry picked from commit 324d161963025a595a79a10cf953b23250f825a1) --- src/svm/fifo_segment.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c index cb1f08a7e9f..b680d27fe33 100644 --- a/src/svm/fifo_segment.c +++ b/src/svm/fifo_segment.c @@ -161,8 +161,9 @@ fss_chunk_free_list_push (fifo_segment_header_t *fsh, c->next = old_head & FS_CL_HEAD_MASK; new_head = csp + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK); } - while (!clib_atomic_cmp_and_swap_acq_relax ( - &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */)); + while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head, + &new_head, 0 /* weak */, __ATOMIC_RELEASE, + __ATOMIC_ACQUIRE)); } static void @@ -181,8 +182,9 @@ fss_chunk_free_list_push_list (fifo_segment_header_t *fsh, tail->next = old_head & FS_CL_HEAD_MASK; new_head = headsp + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK); } - while (!clib_atomic_cmp_and_swap_acq_relax ( - &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */)); + while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head, + &new_head, 0 /* weak */, __ATOMIC_RELEASE, + __ATOMIC_ACQUIRE)); } static svm_fifo_chunk_t * @@ -210,8 +212,9 @@ fss_chunk_free_list_pop (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, c = fs_chunk_ptr (fsh, old_head & FS_CL_HEAD_MASK); new_head = c->next + ((old_head + FS_CL_HEAD_TINC) & FS_CL_HEAD_TMASK); } - while (!clib_atomic_cmp_and_swap_acq_relax ( - &fss->free_chunks[fl_index], &old_head, &new_head, 1 /* weak */)); + while (!__atomic_compare_exchange (&fss->free_chunks[fl_index], &old_head, + &new_head, 0 /* weak */, __ATOMIC_RELEASE, + __ATOMIC_ACQUIRE)); return c; }