summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2020-06-30 08:28:44 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-07-01 17:23:19 +0200
commitfa28dcb82a38f8e3993b0fae9106b1a80b59e4f0 (patch)
treedf5f451d9328757debc8dd7b81a5e34149577f90 /scripts
parentperf: Expose get/put_callchain_entry() (diff)
downloadlinux-fa28dcb82a38f8e3993b0fae9106b1a80b59e4f0.tar.xz
linux-fa28dcb82a38f8e3993b0fae9106b1a80b59e4f0.zip
bpf: Introduce helper bpf_get_task_stack()
Introduce helper bpf_get_task_stack(), which dumps stack trace of given task. This is different to bpf_get_stack(), which gets stack track of current task. One potential use case of bpf_get_task_stack() is to call it from bpf_iter__task and dump all /proc/<pid>/stack to a seq_file. bpf_get_task_stack() uses stack_trace_save_tsk() instead of get_perf_callchain() for kernel stack. The benefit of this choice is that stack_trace_save_tsk() doesn't require changes in arch/. The downside of using stack_trace_save_tsk() is that stack_trace_save_tsk() dumps the stack trace to unsigned long array. For 32-bit systems, we need to translate it to u64 array. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200630062846.664389-3-songliubraving@fb.com
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bpf_helpers_doc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
index 6bab40ff442e..6843376733df 100755
--- a/scripts/bpf_helpers_doc.py
+++ b/scripts/bpf_helpers_doc.py
@@ -426,6 +426,7 @@ class PrinterHelpers(Printer):
'struct tcp_timewait_sock',
'struct tcp_request_sock',
'struct udp6_sock',
+ 'struct task_struct',
'struct __sk_buff',
'struct sk_msg_md',
@@ -468,6 +469,7 @@ class PrinterHelpers(Printer):
'struct tcp_timewait_sock',
'struct tcp_request_sock',
'struct udp6_sock',
+ 'struct task_struct',
}
mapped_types = {
'u8': '__u8',