Files
linux/include/uapi/linux
Namhyung Kim ee2a098851 bpf: Adjust BPF stack helper functions to accommodate skip > 0
Let's say that the caller has storage for num_elem stack frames.  Then,
the BPF stack helper functions walk the stack for only num_elem frames.
This means that if skip > 0, one keeps only 'num_elem - skip' frames.

This is because it sets init_nr in the perf_callchain_entry to the end
of the buffer to save num_elem entries only.  I believe it was because
the perf callchain code unwound the stack frames until it reached the
global max size (sysctl_perf_event_max_stack).

However it now has perf_callchain_entry_ctx.max_stack to limit the
iteration locally.  This simplifies the code to handle init_nr in the
BPF callstack entries and removes the confusion with the perf_event's
__PERF_SAMPLE_CALLCHAIN_EARLY which sets init_nr to 0.

Also change the comment on bpf_get_stack() in the header file to be
more explicit what the return value means.

Fixes: c195651e56 ("bpf: add bpf_get_stack helper")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/30a7b5d5-6726-1cc2-eaee-8da2828a9a9c@oracle.com
Link: https://lore.kernel.org/bpf/20220314182042.71025-1-namhyung@kernel.org

Based-on-patch-by: Eugene Loh <eugene.loh@oracle.com>
2022-03-20 19:16:23 -07:00
..
2021-09-14 08:46:08 +02:00
2021-01-25 18:44:44 +01:00
2020-12-28 14:21:31 +00:00
2021-11-01 13:36:08 +00:00
2021-10-29 12:38:43 +02:00
2021-11-26 16:48:59 +01:00
2021-08-10 13:32:40 -04:00
2021-10-07 13:51:11 +02:00
2021-02-08 13:01:24 +01:00
2021-10-06 12:05:51 +00:00
2021-11-15 07:53:10 -08:00
2021-06-03 15:31:34 -07:00
2022-03-01 18:29:27 -08:00
2021-02-26 09:41:03 -08:00
2021-05-21 15:03:50 +02:00
2021-03-10 09:34:06 +01:00
2021-10-14 23:06:28 +02:00
2021-07-06 10:37:46 -05:00
2021-10-18 17:20:50 +02:00
2021-03-10 09:34:06 +01:00
2021-01-07 16:17:32 +01:00
2021-09-16 14:36:26 +01:00
2020-10-23 11:55:28 -04:00
2020-10-23 11:55:28 -04:00
2021-06-12 13:16:45 -07:00