diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-27 09:16:24 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-27 09:29:07 -0400 |
| commit | 4cb93446c587d56e2a54f4f83113daba2c0b6dee (patch) | |
| tree | a251b1d510831dc071eadbbbe3e38a85fe643365 /tools/perf/util | |
| parent | c5dfd78eb79851e278b7973031b9ca363da87a7e (diff) | |
perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack
There is an upper limit to what tooling considers a valid callchain,
and it was tied to the hardcoded value in the kernel,
PERF_MAX_STACK_DEPTH (127), now that this can be tuned via a sysctl,
make it read it and use that as the upper limit, falling back to
PERF_MAX_STACK_DEPTH for kernels where this sysctl isn't present.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-yjqsd30nnkogvj5oyx9ghir9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/machine.c | 6 | ||||
| -rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/util.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/util.h | 1 |
4 files changed, 7 insertions, 4 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 656c1d7ee7d4..2cb95bbf9ea6 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -1764,7 +1764,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread, | |||
| 1764 | */ | 1764 | */ |
| 1765 | int mix_chain_nr = i + 1 + lbr_nr + 1; | 1765 | int mix_chain_nr = i + 1 + lbr_nr + 1; |
| 1766 | 1766 | ||
| 1767 | if (mix_chain_nr > PERF_MAX_STACK_DEPTH + PERF_MAX_BRANCH_DEPTH) { | 1767 | if (mix_chain_nr > (int)sysctl_perf_event_max_stack + PERF_MAX_BRANCH_DEPTH) { |
| 1768 | pr_warning("corrupted callchain. skipping...\n"); | 1768 | pr_warning("corrupted callchain. skipping...\n"); |
| 1769 | return 0; | 1769 | return 0; |
| 1770 | } | 1770 | } |
| @@ -1825,7 +1825,7 @@ static int thread__resolve_callchain_sample(struct thread *thread, | |||
| 1825 | * Based on DWARF debug information, some architectures skip | 1825 | * Based on DWARF debug information, some architectures skip |
| 1826 | * a callchain entry saved by the kernel. | 1826 | * a callchain entry saved by the kernel. |
| 1827 | */ | 1827 | */ |
| 1828 | if (chain->nr < PERF_MAX_STACK_DEPTH) | 1828 | if (chain->nr < sysctl_perf_event_max_stack) |
| 1829 | skip_idx = arch_skip_callchain_idx(thread, chain); | 1829 | skip_idx = arch_skip_callchain_idx(thread, chain); |
| 1830 | 1830 | ||
| 1831 | /* | 1831 | /* |
| @@ -1886,7 +1886,7 @@ static int thread__resolve_callchain_sample(struct thread *thread, | |||
| 1886 | } | 1886 | } |
| 1887 | 1887 | ||
| 1888 | check_calls: | 1888 | check_calls: |
| 1889 | if (chain->nr > PERF_MAX_STACK_DEPTH && (int)chain->nr > max_stack) { | 1889 | if (chain->nr > sysctl_perf_event_max_stack && (int)chain->nr > max_stack) { |
| 1890 | pr_warning("corrupted callchain. skipping...\n"); | 1890 | pr_warning("corrupted callchain. skipping...\n"); |
| 1891 | return 0; | 1891 | return 0; |
| 1892 | } | 1892 | } |
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index ae1cebc307c5..62c7f6988e0e 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
| @@ -265,7 +265,7 @@ static SV *perl_process_callchain(struct perf_sample *sample, | |||
| 265 | 265 | ||
| 266 | if (thread__resolve_callchain(al->thread, &callchain_cursor, evsel, | 266 | if (thread__resolve_callchain(al->thread, &callchain_cursor, evsel, |
| 267 | sample, NULL, NULL, | 267 | sample, NULL, NULL, |
| 268 | PERF_MAX_STACK_DEPTH) != 0) { | 268 | sysctl_perf_event_max_stack) != 0) { |
| 269 | pr_err("Failed to resolve callchain. Skipping\n"); | 269 | pr_err("Failed to resolve callchain. Skipping\n"); |
| 270 | goto exit; | 270 | goto exit; |
| 271 | } | 271 | } |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 9473d46c00bb..619ba2061b62 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
| @@ -33,6 +33,8 @@ struct callchain_param callchain_param = { | |||
| 33 | unsigned int page_size; | 33 | unsigned int page_size; |
| 34 | int cacheline_size; | 34 | int cacheline_size; |
| 35 | 35 | ||
| 36 | unsigned int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH; | ||
| 37 | |||
| 36 | bool test_attr__enabled; | 38 | bool test_attr__enabled; |
| 37 | 39 | ||
| 38 | bool perf_host = true; | 40 | bool perf_host = true; |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 26a924651e7b..88f607af1f47 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
| @@ -267,6 +267,7 @@ void sighandler_dump_stack(int sig); | |||
| 267 | 267 | ||
| 268 | extern unsigned int page_size; | 268 | extern unsigned int page_size; |
| 269 | extern int cacheline_size; | 269 | extern int cacheline_size; |
| 270 | extern unsigned int sysctl_perf_event_max_stack; | ||
| 270 | 271 | ||
| 271 | struct parse_tag { | 272 | struct parse_tag { |
| 272 | char tag; | 273 | char tag; |
