Skip to content

Commit 5008bb4

Browse files
authored
Merge pull request #6044 from hjelmn/v3.0.x_fix_a_memory_barrier_bug_that_is_totally_related_to_6014_but_in_the_pmix_code
v3.0.x: pmix2x: fix potential memory barrier bug with __atomic builtin atomics
2 parents a0bfe6b + e2c3fa6 commit 5008bb4

File tree

1 file changed

+9
-0
lines changed
  • opal/mca/pmix/pmix2x/pmix/src/atomics/sys/gcc_builtin

1 file changed

+9
-0
lines changed

opal/mca/pmix/pmix2x/pmix/src/atomics/sys/gcc_builtin/atomic.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2016-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2018 Intel, Inc. All rights reserved.
19+
* Copyright (c) 2018 Triad National Security, LLC. All rights
20+
* reserved.
1921
* $COPYRIGHT$
2022
*
2123
* Additional copyrights may follow
@@ -58,7 +60,14 @@ static inline void pmix_atomic_mb(void)
5860

5961
static inline void pmix_atomic_rmb(void)
6062
{
63+
#if OPAL_ASSEMBLY_ARCH == OPAL_X86_64
64+
/* work around a bug in older gcc versions where ACQUIRE seems to get
65+
* treated as a no-op instead of being equivalent to
66+
* __asm__ __volatile__("": : :"memory") */
67+
__atomic_thread_fence (__ATOMIC_SEQ_CST);
68+
#else
6169
__atomic_thread_fence (__ATOMIC_ACQUIRE);
70+
#endif
6271
}
6372

6473
static inline void pmix_atomic_wmb(void)

0 commit comments

Comments
 (0)