summaryrefslogtreecommitdiff
path: root/lib/xray
AgeCommit message (Collapse)Author
2017-05-10[XRay] Fix XRay PPC return value bug.Tim Shen
Summary: This bug is caused by the incorrect handling of return-value registers. According to OpenPOWER 64-Bit ELF V2 ABI 2.2.5, up to 2 general-purpose registers are going to be used for return values, and up to 8 floating point registers or vector registers are going to be used for return values. Reviewers: dberris, echristo Subscribers: nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D33027 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302691 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05[XRay][compiler-rt] Add function id utilities for XRayDean Michael Berris
Summary: This change allows us to provide users and implementers of XRay handlers a means of converting XRay function id's to addresses. This, in combination with the facilities provided in D32695, allows users to find out: - How many function id's there are defined in the current binary. - Get the address of the function associated with this function id. - Patch only specific functions according to their requirements. While we don't directly provide symbolization support in XRay, having the function's address lets users determine this information easily either during runtime, or offline with tools like 'addr2line'. Reviewers: dblaikie, echristo, pelikan Subscribers: kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D32846 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302210 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04[XRay][compiler-rt] Support patching/unpatching specific functionsDean Michael Berris
Summary: This change allows us to patch/unpatch specific functions using the function ID. This is useful in cases where implementations might want to do coverage-style, or more fine-grained control of which functions to patch or un-patch at runtime. Depends on D32693. Reviewers: dblaikie, echristo, kpw Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32695 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01[XRay][compiler-rt] Document and update the XRay Logging APIDean Michael Berris
Summary: In this patch we document the requirements for implementations that want to install handlers for the dynamically-controlled XRay "framework". This clarifies what the expectations are for implementations that want to install their handlers using this API (similar to how the FDR logging implementation does so). It also gives users some guarantees on semantics for the APIs. If all goes well, users can decide to use the XRay APIs to control the tracing/logging at the application level, without having to depend on implementation details of the installed logging implementation. This lets users choose the implementation that comes with compiler-rt, or potentially multiple other implementations that use the same APIs. We also add one convenience function (__xray_remove_log_impl()) for explicitly removing the currently installed log implementation. Reviewers: kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32579 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301784 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20[XRay][compiler-rt] Cleanup CFI/CFA annotations on trampolinesDean Michael Berris
Summary: This is a follow-up to D32202. While the previous change (D32202) did fix the stack alignment issue, we were still at a weird state in terms of the CFI/CFA directives (as the offsets were wrong). This change cleans up the SAVE/RESTORE macros for the trampoline, accounting the stack pointer adjustments with less instructions and with some clearer math. We note that the offsets will be different on the exit trampolines, because we don't typically 'call' into this trampoline and we only ever jump into them (i.e. treated as a tail call that's patched in at runtime). Reviewers: eugenis, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32214 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300815 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19[XRay][compiler-rt] Fix up CFI annotations and stack alignmentDean Michael Berris
Summary: Previously, we had been very undisciplined about CFI annotations with the XRay trampolines. This leads to runtime crashes due to mis-alined stack pointers that some function implementations may run into (i.e. those using instructions that require properly aligned addresses coming from the stack). This patch attempts to clean that up, as well as more accurately use the correct amounts of space on the stack for stashing and un-stashing registers. Reviewers: eugenis, kcc Subscribers: kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D32202 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300660 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18[XRay][compiler-rt] Use emulated TSC when CPU supports rdtscp, but cannot ↵Douglas Yung
determine the CPU frequency A problem arises if a machine supports the rdtscp instruction, but the processor frequency cannot be determined by the function getTSCFrequency(). In this case, we want to use the emulated TSC instead. This patch implements that by adding a call to getTSCFrequency() from probeRequiredCPUFeatures(), and the function only returns true if both the processor supports rdtscp and the CPU frequency can be determined. This should fix PR32620. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32067 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12Fix compile errorIsmail Donmez
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12[XRay] [compiler-rt] Refactor rewinding FDR logging.Martin Pelikan
Summary: While there, make the threshold in ticks for the rewind computed only once and not per function, unify the two versions we had and slightly reformat bits according to coding standards. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31971 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12[XRay] [compiler-rt] Simplify FDR logging handler. [NFC]Martin Pelikan
Summary: Not repeating screamy failure paths makes the 300+ line function a bit shorter. There's no need to overload the variable name "Buffer" if it only works on the thread local buffer. Fix some comments while there. I plan to move the rewinding logic into a separate function too, but in this diff it would be too much of a mess to comprehend. This is trivially NFC. Reviewers: kpw, dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31930 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12[XRay][compiler-rt] Add another work-around to XRay FDR tests when TSC ↵Douglas Yung
emulation is needed This patch applies a work-around to the XRay FDR tests when TSC emulation is needed because the processor frequency cannot be determined. This fixes PR32620 using the suggestion given by Dean in comment 1. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31967 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300017 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11[XRay][compiler-rt] Add support for TSC emulation for x86_64 to ↵Douglas Yung
xray_fdr_logging.cc Previously in r297800, a work-around was created to use TSC emulation on x86_64 when RDTSCP was not available on the host. A similar change was needed in the file xray_fdr_logging.cc which this patch ports over to that file. Eventually the code should be refactored as there will be 3 locations with the same code, but that can be done as a separate step. This patch is just to keep the test from failing on my machine due to an illegal instruction since RDTSCP is not available on my x86_64 linux VM. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31909 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11[XRay][compiler-rt] Remove the xray_fdr_log_printer_toolDean Michael Berris
Summary: We can move this functionality into LLVM's tools instead, as it no longer is strictly required for the compiler-rt testing infrastructure. It also is blocking the successful bootstrapping of the clang compiler due to a missing virtual destructor in one of the flag parsing library. Since this binary isn't critical for the XRay runtime testing effort anymore (yet), we remove it in the meantime with the hope of moving the functionality in LLVM proper instead. Reviewers: kpw, pelikan, rnk, seurer, eugenis Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D31926 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299916 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06[XRay][compiler-rt] Remove unused local variableDean Michael Berris
The local was only referenced in assertions. Follow-up to D31345. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299644 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06[XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.Dean Michael Berris
Summary: "short" is defined as an xray flag, and buffer rewinding happens for both exits and tail exits. I've made the choice to seek backwards finding pairs of FunctionEntry, TailExit record pairs and erasing them if the FunctionEntry occurred before exit from the currently exiting function. This is a compromise so that we don't skip logging tail calls if the function that they call into takes longer our duration. This works by counting the consecutive function and function entry, tail exit pairs that proceed the current point in the buffer. The buffer is rewound to check whether these entry points happened recently enough to be erased. It is still possible we will omit them if they call into a child function that is not instrumented which calls a fast grandchild that is instrumented before doing other processing. Reviewers: pelikan, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31345 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299629 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-29[XRay] [compiler-rt] Write buffer length to FDR log before writing buffer.Dean Michael Berris
Summary: Currently the FDR log writer, upon flushing, dumps a sequence of buffers from its freelist to disk. A reader can read the first buffer up to an EOB record, but then it is unclear how far ahead to scan to find the next threads traces. There are a few ways to handle this problem. 1. The reader has externalized knowledge of the buffer size. 2. The size of buffers is in the file header or otherwise encoded in the log. 3. Only write out the portion of the buffer with records. When released, the buffers are marked with a size. 4. The reader looks for memory that matches a pattern and synchronizes on it. 2 and 3 seem the most flexible and 2 does not rule 3 out. This is an implementation of 2. In addition, the function handler for fdr more aggressively checks for finalization and makes an attempt to release its buffer. Reviewers: pelikan, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31384 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298982 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-29[XRay][compiler-rt] Add an end-to-end test for FDR LoggingDean Michael Berris
Summary: This change exercises the end-to-end functionality defined in the FDR logging implementation. We also prepare for being able to run traces generated by the FDR logging implementation from being analysed with the llvm-xray command that comes with the LLVM distribution. This also unblocks D31385, D31384, and D31345. Reviewers: kpw, pelikan Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D31452 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27Fix build error:Ismail Donmez
In file included from /home/abuild/rpmbuild/BUILD/llvm/projects/compiler-rt/lib/xray/tests/unit/xray_fdr_log_printer_tool.cc:15: ../projects/compiler-rt/lib/xray/tests/../xray_fdr_logging_impl.h:221:21: error: use of undeclared identifier 'CLOCK_MONOTONIC' wall_clock_reader(CLOCK_MONOTONIC, &TS); ^ 1 error generated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298837 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27[XRay][compiler-rt] Use sanitizer_common's atomic opsDean Michael Berris
Instead of std::atomic APIs for atomic operations, we instead use APIs include with sanitizer_common. This allows us to, at runtime, not have to depend on potentially dynamically provided implementations of these atomic operations. Fixes http://llvm.org/PR32274. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24[XRay] [compiler-rt] Plug a file descriptor leak in a failure case.Martin Pelikan
Summary: Fd needs to be closed before the number gets out of scope. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31278 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22[XRay][compiler-rt] Remove dependency on <system_error>Dean Michael Berris
Summary: Depending on C++11 <system_error> introduces a link-time requirement to C++11 symbols. Removing it allows us to depend on header-only C++11 and up libraries. Partially fixes http://llvm.org/PR32274 -- we know there's more invasive work to be done, but we're doing it incrementally. Reviewers: dblaikie, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31233 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17[XRay][compiler-rt] Add missing include to <string>Dean Michael Berris
Fixes a build break when using clang-3.9.1 (reported upstream, post-commit review of D30850). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298039 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17[XRay][compiler-rt] Add missing include for <functional>Dean Michael Berris
Fixes http://llvm.org/PR32313 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298037 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15Add NO_EXEC_STACK_DIRECTIVE to xray assembly files.Dean Michael Berris
Summary: Add NO_EXEC_STACK_DIRECTIVE to xray assembly files Reviewers: dberris, javed.absar Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30953 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297894 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15[XRay] [compiler-rt] Refactor logic for xray fdr logging. NFC.Dean Michael Berris
Summary: Separated the IO and the thread local storage state machine of logging from the writing of log records once the contents are deterministic. Finer granularity functions are provided as inline functions in the same header such that stack does not grow due to the functions being separated. An executable utility xray_fdr_log_printer is also implemented to use the finest granularity functions to produce binary test data in the FDR format with a relatively convenient text input. For example, one can take a file with textual contents layed out in rows and feed it to the binary to generate data that llvm-xray convert can then read. This is a convenient way to build a test suite for llvm-xray convert to ensure it's robust to the fdr format. Example: $cat myFile.txt NewBuffer : { time = 2 , Tid=5} NewCPU : { CPU =1 , TSC = 123} Function : { FuncId = 5, TSCDelta = 3, EntryType = Entry } Function : { FuncId = 5, TSCDelta = 5, EntryType = Exit} TSCWrap : { TSC = 678 } Function : { FuncId = 6, TSCDelta = 0, EntryType = Entry } Function : { FuncId = 6, TSCDelta = 50, EntryType = Exit } EOB : { } $cat myFile.txt | ./bin/xray_fdr_log_printer > /tmp/binarydata.bin $./bin/llvm-xray convert -output-format=yaml -output=- /tmp/binarydata.bin yaml format comes out as expected. Reviewers: dberris, pelikan Reviewed By: dberris Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D30850 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297801 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15[XRay][compiler-rt] Support TSC emulation even for x86_64Dean Michael Berris
Summary: Use TSC emulation in cases where RDTSCP isn't available on the host running an XRay instrumented binary. We can then fall back into emulation instead of not even installing XRay's runtime functionality. We only do this for now in the naive/basic logging implementation, but should be useful in even FDR mode. Should fix http://llvm.org/PR32148. Reviewers: pelikan, rnk, sdardis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30677 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297800 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14Fix a build break with xrayDean Michael Berris
Summary: Building compiler-rt with clang 3.7 broken, could not find mkstemp Reviewers: dberris, bkramer Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D30389 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297794 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06[XRay] [compiler-rt] Stub out architectures we don't do arg1 logging on.Tim Shen
rL297000 forgot to include code for three architectures that appeared since I wrote the first version. This gives them the same treatment as ARMs have for now - write stubs and wait for someone to actually implement it. Patched by pelikan (Martin Pelikán)! Differential Revision: https://reviews.llvm.org/D30634 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297003 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-06[XRay] [compiler-rt] Allow logging the first argument of a function call.Dean Michael Berris
Summary: Functions with the LOG_ARGS_ENTRY sled kind at their beginning will be handled in a way to (optionally) pass their first call argument to your logging handler. For practical and performance reasons, only the first argument is supported, and only up to 64 bits. Reviewers: javed.absar, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29703 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297000 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28[XRay] [compiler-rt] [NFC] Annotate unused variables for the compiler.Dean Michael Berris
Summary: Use a common definition of a "this variable is unused" annotation for useless variables only present for their lambda global initializers, to silence gcc's warning. Reviewers: dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29860 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296449 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-28[XRay][compiler-rt] Switch default XRay 'patch_premain' to falseDean Michael Berris
Summary: Currently, we assume that applications built with XRay would like to have the instrumentation sleds patched before main starts. This patch changes the default so that we do not patch the instrumentation sleds before main. This default is more helpful for deploying applications in environments where changing the current default is harder (i.e. on remote machines, or work-pool-like systems). This default (not to patch pre-main) makes it easier to selectively run applications with XRay instrumentation enabled, than with the current state. Reviewers: echristo, timshen Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30396 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@296445 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23[xray] Unbreak unittest after r295967.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23[Xray] fix building the runtime with GCC.Benjamin Kramer
GCC has a warning about enum bitfields that cannot be disabled. Do the ugly thing and go through uint8_t for all the values. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22[XRay] Change the ppc trampoline asm file into a different name, to not ↵Tim Shen
collide with the cc file. NFC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18[XRay][compiler-rt] Allow for defining defaults at compile-timeDean Michael Berris
Summary: Currently, defaulted options cannot be overriden easily. As an example, we always patch the binary pre-main unless the user defines the option at the commandline to inhibit this behaviour. This change allows for building different versions of the XRay archive with different defaults (whether to patch pre-main, or whether to use FDR mode by default, etc.) and giving that choice at link-time. For now we don't create different archives that have different defaults, but those could be added in later revisions. This change just enables the possibility. Reviewers: pelikan, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30022 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15Re-commit r295017, since we have a potential fix of the tests, r295248, landed.Tim Shen
Differential Revision: https://reviews.llvm.org/D29742 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295251 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15[XRay] Fix gtest error code comparison. NFC.Tim Shen
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15[Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64elSagar Thakur
Summary: Adds support for xray on mips/mipsel/mips64/mips64el. Reviewed by sdardis, dberris Differential: D27699 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14Revert r295017 "Re-commit r294826 and r294781, with a fix on the cmake file ↵Tim Shen
to only" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14Re-commit r294826 and r294781, with a fix on the cmake file to onlyTim Shen
compile on powerpc64le. I cannot locally reproduce this test failure: http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux/builds/1363/steps/test%20standalone%20compiler-rt/logs/stdio Let's see how the buildbot goes. Differential Revision: https://reviews.llvm.org/D29742 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295017 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-11Re-submit r294826 "Fix -Wsign-compare" reverted in r294842 by mistake.Vitaly Buka
Fix -Wsign-compare - this might not be quite right, but preserves behavior git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-11This reverts commits r294826 and r294781 as they break linking on powerpc.Vitaly Buka
Revert "Fix -Wsign-compare - this might not be quite right, but preserves behavior" Revert "[XRay] Implement powerpc64le xray." This reverts commit r294826. This reverts commit r294781. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-11Fix -Wsign-compare - this might not be quite right, but preserves behaviorDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294826 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10[XRay] Implement powerpc64le xray.Tim Shen
Summary: powerpc64 big-endian is not supported, but I believe that most logic can be shared, except for xray_powerpc64.cc. Also add a function InvalidateInstructionCache to xray_util.h, which is copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest, and I don't know how. Reviewers: dberris, echristo, iteratee, kbarton, hfinkel Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29742 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10[XRay] Refactor TSC related functions into a single header. NFC.Tim Shen
Summary: The implementation, however, is in different arch-specific files, unless it's emulated. Reviewers: dberris, pelikan, javed.absar Subscribers: aemerson, llvm-commits Differential Revision: https://reviews.llvm.org/D29796 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09[XRAY] [compiler-rt] [NFC] Fixing the bit twiddling of Function Id in FDR ↵Dean Michael Berris
logging mode. Summary: Fixing a bug I found when testing a reader for the FDR format. Function ID is now correctly packed into the 28 bits which are documented for it instead of being masked to all ones. Reviewers: dberris, pelikan, eugenis Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29698 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294563 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07[XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functionsDean Michael Berris
Summary: As pointed out in casual reading of the XRay codebase, that we had some interesting named functions that didn't quite follow the LLVM coding conventions. Reviewers: chandlerc, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29625 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294373 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06[XRay][compiler-rt] Use gettid instead of getpid in FDR mode.Dean Michael Berris
Summary: This was pointed out that FDR mode didn't quite put the thread ID in the buffers, but instead would write down the parent process ID. Reviewers: pelikan, rSerge Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29484 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[XRay] Probe for CPU features that XRay needsDean Michael Berris
Summary: In llvm.org/PR31756 it's pointed out that sometimes rdtscp isn't available. We fix it here by checking first whether it's availble before installing the logging handler. In future commits we can have alternative implementations, maybe working around some of the constraints on some systems. This change enables us to make that determination, but report an error instead when the features aren't available. Reviewers: sdardis, javed.absar, rSerge Subscribers: pelikan, llvm-commits Differential Revision: https://reviews.llvm.org/D29438 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-30[XRay][ARM32][AArch64] Fix unstable FDR tests on weak-ordering CPUsSerge Rogatch
Summary: 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. Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: aemerson, llvm-commits, iid_iunknown Differential Revision: https://reviews.llvm.org/D29286 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293505 91177308-0d34-0410-b5e6-96231b3b80d8