Skip to content

Commit 927e669

Browse files
authored
Merge pull request #6048 from hjelmn/v2.x_fix_a_memory_barrier_bug_that_is_totally_related_to_6014_but_in_the_pmix_code
v2.x: pmix112: fix potential memory barrier bug with __atomic builtin atomics
2 parents 7c73b93 + ad1f65c commit 927e669

File tree

1 file changed

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

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2017 Intel, Inc. All rights reserved.
1919
* Copyright (c) 2017 IBM Corporation. All rights reserved.
20+
* Copyright (c) 2018 Triad National Security, LLC. All rights
21+
* reserved.
2022
* $COPYRIGHT$
2123
*
2224
* Additional copyrights may follow
@@ -55,7 +57,14 @@ static inline void pmix_atomic_mb(void)
5557

5658
static inline void pmix_atomic_rmb(void)
5759
{
60+
#if OPAL_ASSEMBLY_ARCH == OPAL_X86_64
61+
/* work around a bug in older gcc versions where ACQUIRE seems to get
62+
* treated as a no-op instead of being equivalent to
63+
* __asm__ __volatile__("": : :"memory") */
64+
__atomic_thread_fence (__ATOMIC_SEQ_CST);
65+
#else
5866
__atomic_thread_fence (__ATOMIC_ACQUIRE);
67+
#endif
5968
}
6069

6170
static inline void pmix_atomic_wmb(void)

0 commit comments

Comments
 (0)