From d56b90fb4c637cef59f64bd18ea2710fb861427b Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 12 Sep 2017 01:37:59 +0000 Subject: [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 --- compiler-rt/lib/xray/xray_fdr_logging_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler-rt/lib/xray/xray_fdr_logging_impl.h') 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!"); -- cgit v1.2.3