summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_fdr_logging_impl.h
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-09-12 01:37:59 +0000
committerDean Michael Berris <dberris@google.com>2017-09-12 01:37:59 +0000
commitd56b90fb4c637cef59f64bd18ea2710fb861427b (patch)
treede7c335418c451b842b02b3a77627943c3ff3c89 /compiler-rt/lib/xray/xray_fdr_logging_impl.h
parent66e4ace1c82f04e11d4ea2242e38118347bd831a (diff)
downloadbcm5719-llvm-d56b90fb4c637cef59f64bd18ea2710fb861427b.tar.gz
bcm5719-llvm-d56b90fb4c637cef59f64bd18ea2710fb861427b.zip
[XRay][compiler-rt] Use a single global volatile recursion guard for FDR handlers
Summary: Before this change, the recursion guard for the flight data recorder (FDR) mode handlers were independent. This change makes it so that when a handler is already in the process of running and somehow the same or another handler starts running -- say in a signal handler, while the XRay handler is executing -- then we can use the same thread-local recursion guard to stop the second handler from running. Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37612 llvm-svn: 312992
Diffstat (limited to 'compiler-rt/lib/xray/xray_fdr_logging_impl.h')
-rw-r--r--compiler-rt/lib/xray/xray_fdr_logging_impl.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/xray/xray_fdr_logging_impl.h b/compiler-rt/lib/xray/xray_fdr_logging_impl.h
index ce81e4364a9..b2f7f3f239e 100644
--- a/compiler-rt/lib/xray/xray_fdr_logging_impl.h
+++ b/compiler-rt/lib/xray/xray_fdr_logging_impl.h
@@ -571,6 +571,8 @@ inline void endBufferIfFull() XRAY_NEVER_INSTRUMENT {
}
}
+thread_local volatile bool Running = false;
+
inline void processFunctionHook(
int32_t FuncId, XRayEntryType Entry, uint64_t TSC, unsigned char CPU,
int (*wall_clock_reader)(clockid_t, struct timespec *),
@@ -581,7 +583,6 @@ inline void processFunctionHook(
// don't want to be clobbering potentially partial writes already happening in
// the thread. We use a simple thread_local latch to only allow one on-going
// handleArg0 to happen at any given time.
- thread_local volatile bool Running = false;
RecursionGuard Guard{Running};
if (!Guard) {
assert(Running == true && "RecursionGuard is buggy!");
OpenPOWER on IntegriCloud