summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray
Commit message (Collapse)AuthorAgeFilesLines
...
* [XRay] Fix gtest error code comparison. NFC.Tim Shen2017-02-151-4/+8
| | | | llvm-svn: 295248
* [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64elSagar Thakur2017-02-158-2/+587
| | | | | | | | | Summary: Adds support for xray on mips/mipsel/mips64/mips64el. Reviewed by sdardis, dberris Differential: D27699 llvm-svn: 295166
* Revert r295017 "Re-commit r294826 and r294781, with a fix on the cmake file ↵Tim Shen2017-02-147-328/+0
| | | | | | to only" llvm-svn: 295097
* Re-commit r294826 and r294781, with a fix on the cmake file to onlyTim Shen2017-02-147-0/+328
| | | | | | | | | | | | | 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 llvm-svn: 295017
* Re-submit r294826 "Fix -Wsign-compare" reverted in r294842 by mistake.Vitaly Buka2017-02-112-5/+2
| | | | | | Fix -Wsign-compare - this might not be quite right, but preserves behavior llvm-svn: 294868
* This reverts commits r294826 and r294781 as they break linking on powerpc.Vitaly Buka2017-02-119-330/+5
| | | | | | | | | | 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. llvm-svn: 294842
* Fix -Wsign-compare - this might not be quite right, but preserves behaviorDavid Blaikie2017-02-112-5/+2
| | | | llvm-svn: 294826
* [XRay] Implement powerpc64le xray.Tim Shen2017-02-107-0/+328
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 294781
* [XRay] Refactor TSC related functions into a single header. NFC.Tim Shen2017-02-1010-106/+39
| | | | | | | | | | | | | 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 llvm-svn: 294777
* [XRAY] [compiler-rt] [NFC] Fixing the bit twiddling of Function Id in FDR ↵Dean Michael Berris2017-02-091-1/+1
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 294563
* [XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functionsDean Michael Berris2017-02-0710-47/+47
| | | | | | | | | | | | | | | 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 llvm-svn: 294373
* [XRay][compiler-rt] Use gettid instead of getpid in FDR mode.Dean Michael Berris2017-02-061-2/+3
| | | | | | | | | | | | | | 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 llvm-svn: 294166
* [XRay] Probe for CPU features that XRay needsDean Michael Berris2017-02-026-3/+38
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 293870
* [XRay][ARM32][AArch64] Fix unstable FDR tests on weak-ordering CPUsSerge Rogatch2017-01-301-4/+4
| | | | | | | | | | | | | | 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 llvm-svn: 293505
* [XRay][Arm32] Reduce the portion of the stub and implement more staging for ↵Serge Rogatch2017-01-262-3/+34
| | | | | | | | | | | | | | | | | | | tail calls - in compiler-rt Summary: This patch provides more staging for tail calls in XRay Arm32 . When the logging part of XRay is ready for tail calls, its support in the core part of XRay Arm32 may be as easy as changing the number passed to the handler from 1 to 2. Coupled patch: - https://reviews.llvm.org/D28673 Reviewers: dberris, rengolin Reviewed By: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D28674 llvm-svn: 293186
* [XRay][AArch64] More staging for tail call support in XRay AArch64 - in ↵Serge Rogatch2017-01-252-3/+52
| | | | | | | | | | | | | | | | | | compiler-rt Summary: This patch provides a trampoline for function tail exit tracing. Still, it's staging because code `1` is passed to the handler function (indicating a normal exit) instead of `2`, which would indicate tail exit. This is so until the logging part of XRay supports tail exits too. Related: https://reviews.llvm.org/D28947 (LLVM) Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: aemerson, llvm-commits, iid_iunknown Differential Revision: https://reviews.llvm.org/D28948 llvm-svn: 293082
* [compiler-rt] Fix xray compilation errors: errno and size_tKrzysztof Parzyszek2017-01-252-1/+2
| | | | | | | Include errno.h, and use size_t instead of std::size_t, since stddef.h was included (and not cstddef). llvm-svn: 293057
* [XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris2017-01-2515-114/+1142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 llvm-svn: 293015
* [XRay][Arm] Enable back XRay testing on Arm32 and fix the failing testsSerge Rogatch2017-01-191-1/+6
| | | | | | | | | | | | | | | | | Summary: Testing of XRay was occasionally disabled on 32-bit Arm targets (someone assumed that XRay was supported on 64-bit targets only). This patch should fix that problem. Also here the instruction&data cache incoherency problem is fixed, because it may be causing a test to fail. This patch is one of a series: see also - https://reviews.llvm.org/D28624 Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown Differential Revision: https://reviews.llvm.org/D28623 llvm-svn: 292517
* Revert "[XRay][Arm] Enable back XRay testing on Arm32 and fix the failing tests"Renato Golin2017-01-181-6/+1
| | | | | | | | | This reverts commit r292211, as it broke the Thumb buldbot with: clang-5.0: error: the clang compiler does not support '-fxray-instrument on thumbv7-unknown-linux-gnueabihf' llvm-svn: 292356
* [XRay][Arm] Enable back XRay testing on Arm32 and fix the failing testsSerge Rogatch2017-01-171-1/+6
| | | | | | | | | | | | | | | | | Summary: Testing of XRay was occasionally disabled on 32-bit Arm targets (someone assumed that XRay was supported on 64-bit targets only). This patch should fix that problem. Also here the instruction&data cache incoherency problem is fixed, because it may be causing a test to fail. This patch is one of a series: see also - https://reviews.llvm.org/D28624 Reviewers: dberris, rengolin Reviewed By: rengolin Subscribers: llvm-commits, aemerson, rengolin, dberris, iid_iunknown Differential Revision: https://reviews.llvm.org/D28623 llvm-svn: 292211
* Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky2017-01-121-2/+1
| | | | | | | | This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e llvm-svn: 291736
* [sancov] moving sancov rt to sancov/ directoryMike Aizatsky2017-01-121-1/+2
| | | | | | | | Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 llvm-svn: 291734
* [XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch2017-01-101-1/+7
| | | | | | | | | | | | | | the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin, pelikan, rovka Subscribers: rovka, llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 llvm-svn: 291568
* [XRay] [compiler-rt] Include argv[0] in the log file name.Dean Michael Berris2017-01-031-6/+15
| | | | | | | | | | | | | | | | | Summary: If you decide to recompile parts of your Linux distro with XRay, it may be useful to know which trace belongs to which binary. While there, get rid of the incorrect strncat() usage; it always returns a pointer to the start which makes that if() always true. Replace with snprintf which is bounded so that enough from both strings fits nicely. Reviewers: dberris Subscribers: danalbert, srhines, kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D27912 llvm-svn: 290861
* Revert "[XRay][compiler-rt] XRay Flight Data Recorder Mode"Dean Michael Berris2017-01-0314-1128/+121
| | | | | | This reverts rL290852 as it breaks aarch64 and arm. llvm-svn: 290854
* [XRay][compiler-rt] XRay Flight Data Recorder ModeDean Michael Berris2017-01-0314-121/+1128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In this change we introduce the notion of a "flight data recorder" mode for XRay logging, where XRay logs in-memory first, and write out data on-demand as required (as opposed to the naive implementation that keeps logging while tracing is "on"). This depends on D26232 where we implement the core data structure for holding the buffers that threads will be using to write out records of operation. This implementation only currently works on x86_64 and depends heavily on the TSC math to write out smaller records to the inmemory buffers. Also, this implementation defines two different kinds of records with different sizes (compared to the current naive implementation): a MetadataRecord (16 bytes) and a FunctionRecord (8 bytes). MetadataRecord entries are meant to write out information like the thread ID for which the metadata record is defined for, whether the execution of a thread moved to a different CPU, etc. while a FunctionRecord represents the different kinds of function call entry/exit records we might encounter in the course of a thread's execution along with a delta from the last time the logging handler was called. While this implementation is not exactly what is described in the original XRay whitepaper, this one gives us an initial implementation that we can iterate and build upon. Reviewers: echristo, rSerge, majnemer Subscribers: mehdi_amini, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D27038 llvm-svn: 290852
* Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by ↵Renato Golin2016-12-231-6/+1
| | | | | | | | | flushing the instruction cache after code modification" This reverts commit r290452, not quite there yet. We need to test this offline. llvm-svn: 290453
* [XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch2016-12-231-1/+6
| | | | | | | | | | | | | | the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 llvm-svn: 290452
* Revert "[XRay][AArch64] An attempt to fix test patching-unpatching.cc by ↵Renato Golin2016-12-221-4/+1
| | | | | | | | | flushing the instruction cache after code modification" This reverts commit r290354, as it broke the build. We need to make sure this builds on AArch64 before committing again. llvm-svn: 290362
* [XRay][AArch64] An attempt to fix test patching-unpatching.cc by flushing ↵Serge Rogatch2016-12-221-1/+4
| | | | | | | | | | | | | | the instruction cache after code modification Summary: This patch attempts to fix test patching-unpatching.cc . The new code flushes the instruction cache after modifying the program at runtime. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson Differential Revision: https://reviews.llvm.org/D27996 llvm-svn: 290354
* [compiler-rt] Add missing includes of <errno.h> and <iterator>Krzysztof Parzyszek2016-12-221-0/+2
| | | | | | | The compilation failed due to undeclared identifiers: distance, errno, and EINTR. llvm-svn: 290343
* [XRay] [compiler-rt] Move machine-dependent code into machine-dependent filesDiana Picus2016-12-227-139/+209
| | | | | | | | | | Reapply r290077. Authors: pelikan Differential Revision: https://reviews.llvm.org/D27979 llvm-svn: 290330
* Revert "[XRay] [compiler-rt] Move machine-dependent code into ↵Diana Picus2016-12-197-208/+139
| | | | | | | | machine-dependent files." This reverts commit r290077, 78, 79 and 83. llvm-svn: 290101
* [XRay][compiler-rt] Fix missing include of <cerrno>Dean Michael Berris2016-12-191-0/+1
| | | | | | | | Futher attempt to un-break ARM and AArch64 build. Follow-up on D25360. llvm-svn: 290083
* [XRay][compiler-rt] Post-commit review fixup of XRay refactoring.Dean Michael Berris2016-12-192-5/+36
| | | | | | | | | | | | Missed a couple of files: - Using #pragma once - Missing top-matter for headers - Missing an include for <cstdint> Follow-up on D25360. llvm-svn: 290079
* [XRay][compiler-rt] Explicitly include <cstdint> for typesDean Michael Berris2016-12-191-2/+2
| | | | | | | | This is an attempt to un-break the ARM7, AArch64 builds. Follow-up on D25360. llvm-svn: 290078
* [XRay] [compiler-rt] Move machine-dependent code into machine-dependent files.Dean Michael Berris2016-12-197-139/+176
| | | | | | | | | | | | Summary: Include the necessary headers while there. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25360 llvm-svn: 290077
* [XRay] [compiler-rt] Fix format string; sanitizers' internal printf() ↵Dean Michael Berris2016-12-191-12/+6
| | | | | | | | | | | | | | | | | | | | | | | doesn't support %ld. Summary: Getting rid of the distance number altogether because: - a person knowledgeable enough to know what the message means will also know how to do hexadecimal math (with the help of a calculator) - numbers outside INT_MIN - INT_MAX are hard to comprehend anyway This unbreaks the case when you dynamically link a library with XRay and it exits pre-main() with a not very informative static string. Author: pelikan Reviewers: dberris Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D27894 llvm-svn: 290074
* xray: fix assembly macro definitionSaleem Abdulrasool2016-12-151-2/+2
| | | | | | | | | | | | | | projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:33:7: error: unexpected token in '.endm' directive .endm SAVE_REGISTERS ^ projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:52:7: error: unexpected token in '.endm' directive .endm RESTORE_REGISTERS ^ Remove the trailing name on the `.endm` which does not take the name of the macro. This should bring the compiler-rt build bot back into working state. llvm-svn: 289852
* [XRay][compiler-rt][NFC] Deduplicate code in x86-64 trampolines.Dean Michael Berris2016-12-151-62/+37
| | | | | | | | | | | | | | | | | Summary: The layout of all registers saved on stack shouldn't deviate and will be reused in future trampolines as well. While there, fix whitespace and clarify comments. Author: mpel Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27799 llvm-svn: 289789
* [XRay][compiler-rt] Use explicit comparisons in unit tests.Dean Michael Berris2016-12-131-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This should improve the error messages generated providing a bit more information when the failures are printed out. One example of a contrived error looks like: ``` Expected: (Buffers.getBuffer(Buf)) != (std::error_code()), actual: system:0 vs system:0 ``` Because we're using error codes, the default printing gets us more useful information in case of failure. This is a follow-up on D26232. Reviewers: rSerge Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27495 llvm-svn: 289501
* [XRay][compiler-rt] Explicitly add dependency to pthreadDean Michael Berris2016-12-061-0/+1
| | | | | | | | This should fix the sanitizer bootstrap builds. Follow-up to D26232. llvm-svn: 288860
* [XRay][compiler-rt] Only add unit tests if we're building XRay.Dean Michael Berris2016-12-061-1/+1
| | | | | | | | | | As constructed before this patch, in case we run into case where we don't actually build the XRay library, we really ought to not be adding the unit test runs. This should fix the bootstrap build failures. This is a follow-up further to D26232. llvm-svn: 288788
* [XRay][compiler-rt] Explicitly initialise members.Dean Michael Berris2016-12-061-1/+1
| | | | | | | | | | | Before this, the change committed in D26232 might have an uninitialised std::atomic<bool> that may or may not have a valid state. On aarch64 this breaks consistently, while it doesn't manifest as a problem in x86_64. This is an attempt to un-break this in aarch64. llvm-svn: 288776
* [XRay][compiler-rt] XRay Buffer QueueDean Michael Berris2016-12-067-17/+347
| | | | | | | | | | | | | | | | | | | | | | | | This implements a simple buffer queue to manage a pre-allocated queue of fixed-sized buffers to hold XRay records. We need this to support Flight Data Recorder (FDR) mode. We also implement this as a sub-library first to allow for development before actually using it in an implementation. Some important properties of the buffer queue: - Thread-safe enqueueing/dequeueing of fixed-size buffers. - Pre-allocation of buffers at construction. This is a re-roll of the previous attempt to submit, because it caused failures in arm and aarch64. Reviewers: majnemer, echristo, rSerge Subscribers: tberghammer, danalbert, srhines, modocache, mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26232 llvm-svn: 288775
* [XRay][AArch64] Attempt to fix unstable test ↵Serge Rogatch2016-12-051-2/+2
| | | | | | | | | | | | | | XRay-aarch64-linux::patching-unpatching.cc Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris Differential Revision: https://reviews.llvm.org/D27421 llvm-svn: 288729
* Revert "[XRay][compiler-rt] XRay Buffer Queue"Dean Michael Berris2016-11-257-347/+17
| | | | | | Broke the build on arm7 and aarch64. llvm-svn: 287911
* [XRay][compiler-rt] XRay Buffer QueueDean Michael Berris2016-11-257-17/+347
| | | | | | | | | | | | | | | | | | | | | | Summary: This implements a simple buffer queue to manage a pre-allocated queue of fixed-sized buffers to hold XRay records. We need this to support Flight Data Recorder (FDR) mode. We also implement this as a sub-library first to allow for development before actually using it in an implementation. Some important properties of the buffer queue: - Thread-safe enqueueing/dequeueing of fixed-size buffers. - Pre-allocation of buffers at construction. Reviewers: majnemer, rSerge, echristo Subscribers: mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26232 llvm-svn: 287910
* [XRay][compiler-rt] Add newlines to error messages (NFC).Dean Michael Berris2016-11-232-8/+8
| | | | | | | This goes through all the calls to `Report(...)` to make sure that each one would have a newline at the end of the message for readability. llvm-svn: 287736
OpenPOWER on IntegriCloud