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>
This commit is contained in:
@@ -1764,7 +1764,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
|
||||
*/
|
||||
int mix_chain_nr = i + 1 + lbr_nr + 1;
|
||||
|
||||
if (mix_chain_nr > PERF_MAX_STACK_DEPTH + PERF_MAX_BRANCH_DEPTH) {
|
||||
if (mix_chain_nr > (int)sysctl_perf_event_max_stack + PERF_MAX_BRANCH_DEPTH) {
|
||||
pr_warning("corrupted callchain. skipping...\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1825,7 +1825,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
|
||||
* Based on DWARF debug information, some architectures skip
|
||||
* a callchain entry saved by the kernel.
|
||||
*/
|
||||
if (chain->nr < PERF_MAX_STACK_DEPTH)
|
||||
if (chain->nr < sysctl_perf_event_max_stack)
|
||||
skip_idx = arch_skip_callchain_idx(thread, chain);
|
||||
|
||||
/*
|
||||
@@ -1886,7 +1886,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
|
||||
}
|
||||
|
||||
check_calls:
|
||||
if (chain->nr > PERF_MAX_STACK_DEPTH && (int)chain->nr > max_stack) {
|
||||
if (chain->nr > sysctl_perf_event_max_stack && (int)chain->nr > max_stack) {
|
||||
pr_warning("corrupted callchain. skipping...\n");
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user