[PATCH] D29286: [XRay][ARM32][AArch64] Fix unstable FDR tests on weak-ordering CPUs
Serge Rogatch via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 30 08:59:08 PST 2017
rSerge created this revision.
Herald added a subscriber: aemerson.
Change from `compare_exchange_weak()` to `compare_exchange_strong()` where appropriate, because on ARM ( http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3190 , http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3191 ) and AArch64 ( http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3900 ) it fails even in single-threaded scenarios.
https://reviews.llvm.org/D29286
Files:
lib/xray/xray_fdr_logging.cc
Index: lib/xray/xray_fdr_logging.cc
===================================================================
--- lib/xray/xray_fdr_logging.cc
+++ lib/xray/xray_fdr_logging.cc
@@ -59,7 +59,7 @@
size_t OptionsSize) XRAY_NEVER_INSTRUMENT {
assert(OptionsSize == sizeof(FDRLoggingOptions));
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
- if (!LoggingStatus.compare_exchange_weak(
+ if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_INITIALIZING,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;
@@ -91,7 +91,7 @@
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
XRayLogFlushStatus Result = XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
- if (!LogFlushStatus.compare_exchange_weak(
+ if (!LogFlushStatus.compare_exchange_strong(
Result, XRayLogFlushStatus::XRAY_LOG_FLUSHING,
std::memory_order_release, std::memory_order_relaxed))
return Result;
@@ -143,7 +143,7 @@
XRayLogInitStatus FDRLogging_finalize() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_INITIALIZED;
- if (!LoggingStatus.compare_exchange_weak(
+ if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_FINALIZING,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;
@@ -159,7 +159,7 @@
XRayLogInitStatus FDRLogging_reset() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_FINALIZED;
- if (!LoggingStatus.compare_exchange_weak(
+ if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_UNINITIALIZED,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29286.86296.patch
Type: text/x-patch
Size: 1902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170130/ed611e85/attachment.bin>
More information about the llvm-commits
mailing list