diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-06 10:59:36 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-06 10:59:36 -0500 |
| commit | 203b6609e0ede49eb0b97008b1150c69e9d2ffd3 (patch) | |
| tree | 7d9c1227eeec17f75b2a827e385387f640a365a6 /tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | |
| parent | 3478588b5136966c80c571cf0006f08e9e5b8f04 (diff) | |
| parent | c978b9460fe1d4a1e1effa0abd6bd69b18a098a8 (diff) | |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"Lots of tooling updates - too many to list, here's a few highlights:
- Various subcommand updates to 'perf trace', 'perf report', 'perf
record', 'perf annotate', 'perf script', 'perf test', etc.
- CPU and NUMA topology and affinity handling improvements,
- HW tracing and HW support updates:
- Intel PT updates
- ARM CoreSight updates
- vendor HW event updates
- BPF updates
- Tons of infrastructure updates, both on the build system and the
library support side
- Documentation updates.
- ... and lots of other changes, see the changelog for details.
Kernel side updates:
- Tighten up kprobes blacklist handling, reduce the number of places
where developers can install a kprobe and hang/crash the system.
- Fix/enhance vma address filter handling.
- Various PMU driver updates, small fixes and additions.
- refcount_t conversions
- BPF updates
- error code propagation enhancements
- misc other changes"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (238 commits)
perf script python: Add Python3 support to syscall-counts-by-pid.py
perf script python: Add Python3 support to syscall-counts.py
perf script python: Add Python3 support to stat-cpi.py
perf script python: Add Python3 support to stackcollapse.py
perf script python: Add Python3 support to sctop.py
perf script python: Add Python3 support to powerpc-hcalls.py
perf script python: Add Python3 support to net_dropmonitor.py
perf script python: Add Python3 support to mem-phys-addr.py
perf script python: Add Python3 support to failed-syscalls-by-pid.py
perf script python: Add Python3 support to netdev-times.py
perf tools: Add perf_exe() helper to find perf binary
perf script: Handle missing fields with -F +..
perf data: Add perf_data__open_dir_data function
perf data: Add perf_data__(create_dir|close_dir) functions
perf data: Fail check_backup in case of error
perf data: Make check_backup work over directories
perf tools: Add rm_rf_perf_data function
perf tools: Add pattern name checking to rm_rf
perf tools: Add depth checking to rm_rf
perf data: Add global path holder
...
Diffstat (limited to 'tools/perf/util/intel-pt-decoder/intel-pt-decoder.c')
| -rw-r--r-- | tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index 4503f3ca45ab..6e03db142091 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include "../cache.h" | 27 | #include "../cache.h" |
| 28 | #include "../util.h" | 28 | #include "../util.h" |
| 29 | #include "../auxtrace.h" | ||
| 29 | 30 | ||
| 30 | #include "intel-pt-insn-decoder.h" | 31 | #include "intel-pt-insn-decoder.h" |
| 31 | #include "intel-pt-pkt-decoder.h" | 32 | #include "intel-pt-pkt-decoder.h" |
| @@ -867,7 +868,7 @@ static int intel_pt_get_next_packet(struct intel_pt_decoder *decoder) | |||
| 867 | 868 | ||
| 868 | ret = intel_pt_get_packet(decoder->buf, decoder->len, | 869 | ret = intel_pt_get_packet(decoder->buf, decoder->len, |
| 869 | &decoder->packet); | 870 | &decoder->packet); |
| 870 | if (ret == INTEL_PT_NEED_MORE_BYTES && | 871 | if (ret == INTEL_PT_NEED_MORE_BYTES && BITS_PER_LONG == 32 && |
| 871 | decoder->len < INTEL_PT_PKT_MAX_SZ && !decoder->next_buf) { | 872 | decoder->len < INTEL_PT_PKT_MAX_SZ && !decoder->next_buf) { |
| 872 | ret = intel_pt_get_split_packet(decoder); | 873 | ret = intel_pt_get_split_packet(decoder); |
| 873 | if (ret < 0) | 874 | if (ret < 0) |
| @@ -1394,7 +1395,6 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder) | |||
| 1394 | { | 1395 | { |
| 1395 | intel_pt_log("ERROR: Buffer overflow\n"); | 1396 | intel_pt_log("ERROR: Buffer overflow\n"); |
| 1396 | intel_pt_clear_tx_flags(decoder); | 1397 | intel_pt_clear_tx_flags(decoder); |
| 1397 | decoder->cbr = 0; | ||
| 1398 | decoder->timestamp_insn_cnt = 0; | 1398 | decoder->timestamp_insn_cnt = 0; |
| 1399 | decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC; | 1399 | decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC; |
| 1400 | decoder->overflow = true; | 1400 | decoder->overflow = true; |
| @@ -2575,6 +2575,34 @@ static int intel_pt_tsc_cmp(uint64_t tsc1, uint64_t tsc2) | |||
| 2575 | } | 2575 | } |
| 2576 | } | 2576 | } |
| 2577 | 2577 | ||
| 2578 | #define MAX_PADDING (PERF_AUXTRACE_RECORD_ALIGNMENT - 1) | ||
| 2579 | |||
| 2580 | /** | ||
| 2581 | * adj_for_padding - adjust overlap to account for padding. | ||
| 2582 | * @buf_b: second buffer | ||
| 2583 | * @buf_a: first buffer | ||
| 2584 | * @len_a: size of first buffer | ||
| 2585 | * | ||
| 2586 | * @buf_a might have up to 7 bytes of padding appended. Adjust the overlap | ||
| 2587 | * accordingly. | ||
| 2588 | * | ||
| 2589 | * Return: A pointer into @buf_b from where non-overlapped data starts | ||
| 2590 | */ | ||
| 2591 | static unsigned char *adj_for_padding(unsigned char *buf_b, | ||
| 2592 | unsigned char *buf_a, size_t len_a) | ||
| 2593 | { | ||
| 2594 | unsigned char *p = buf_b - MAX_PADDING; | ||
| 2595 | unsigned char *q = buf_a + len_a - MAX_PADDING; | ||
| 2596 | int i; | ||
| 2597 | |||
| 2598 | for (i = MAX_PADDING; i; i--, p++, q++) { | ||
| 2599 | if (*p != *q) | ||
| 2600 | break; | ||
| 2601 | } | ||
| 2602 | |||
| 2603 | return p; | ||
| 2604 | } | ||
| 2605 | |||
| 2578 | /** | 2606 | /** |
| 2579 | * intel_pt_find_overlap_tsc - determine start of non-overlapped trace data | 2607 | * intel_pt_find_overlap_tsc - determine start of non-overlapped trace data |
| 2580 | * using TSC. | 2608 | * using TSC. |
| @@ -2625,8 +2653,11 @@ static unsigned char *intel_pt_find_overlap_tsc(unsigned char *buf_a, | |||
| 2625 | 2653 | ||
| 2626 | /* Same TSC, so buffers are consecutive */ | 2654 | /* Same TSC, so buffers are consecutive */ |
| 2627 | if (!cmp && rem_b >= rem_a) { | 2655 | if (!cmp && rem_b >= rem_a) { |
| 2656 | unsigned char *start; | ||
| 2657 | |||
| 2628 | *consecutive = true; | 2658 | *consecutive = true; |
| 2629 | return buf_b + len_b - (rem_b - rem_a); | 2659 | start = buf_b + len_b - (rem_b - rem_a); |
| 2660 | return adj_for_padding(start, buf_a, len_a); | ||
| 2630 | } | 2661 | } |
| 2631 | if (cmp < 0) | 2662 | if (cmp < 0) |
| 2632 | return buf_b; /* tsc_a < tsc_b => no overlap */ | 2663 | return buf_b; /* tsc_a < tsc_b => no overlap */ |
| @@ -2689,7 +2720,7 @@ unsigned char *intel_pt_find_overlap(unsigned char *buf_a, size_t len_a, | |||
| 2689 | found = memmem(buf_a, len_a, buf_b, len_a); | 2720 | found = memmem(buf_a, len_a, buf_b, len_a); |
| 2690 | if (found) { | 2721 | if (found) { |
| 2691 | *consecutive = true; | 2722 | *consecutive = true; |
| 2692 | return buf_b + len_a; | 2723 | return adj_for_padding(buf_b + len_a, buf_a, len_a); |
| 2693 | } | 2724 | } |
| 2694 | 2725 | ||
| 2695 | /* Try again at next PSB in buffer 'a' */ | 2726 | /* Try again at next PSB in buffer 'a' */ |
