]> sourceware.org Git - systemtap.git/commit
stapbpf PR22330 WIP :: decode perf_events arguments
authorSerhei Makarov <smakarov@redhat.com>
Fri, 8 Mar 2019 17:59:57 +0000 (12:59 -0500)
committerSerhei Makarov <smakarov@redhat.com>
Fri, 8 Mar 2019 22:37:32 +0000 (17:37 -0500)
commit14845fc8226c13443aabc8af0e98fde39b8c5111
tree26dac10025de05d9bcc799bf89ba0f73c77d7dbc
parent32f624163140573d3c82656fc95cdb8be712f959
stapbpf PR22330 WIP :: decode perf_events arguments

* stapbpf/bpfinterp.h (bpf_transport_context): new data structure
to hold in-progress transport calls and references to needed global state.
(bpf_handle_transport_msg): new function.
(bpf_interpret): change to take a bpf_transport_context.
* stapbpf/bpfinterp.cxx (bpf_handle_transport_msg): WIP new function;
decodes and handles transport message.
(bpf_interpret): change to take a bpf_transport_context;
add a handler for BPF_FUNC_perf_event_output.

* stapbpf/stapbpf.cxx (transport_contexts): new array;
holds a transport_context for each perf_events fd to disentangle printf() from different threads.
(init_internal_globals): fix errno usage.
(init_perf_transport): new function (separated out from init_internal_globals);
in addition to creating perf_event fds, create a transport_context for each one.
(struct perf_event_sample): new structure; apparently this is the format we get perf_events in.
(perf_event_handle): fill in implementation inspired by kernel tools/testing/selftests/bpf/trace_helpers.c
(perf_event_loop): change error handling,
add STP_EXIT handling,
avoid issuing multiple warnings.
(main): add init_perf_transport() call,
use modified bpf_interpret() interface,
clean up transport_contexts.

* bpf-internal.h (BPF_TRANSPORT_VAL): new define for message format.
(BPF_TRANSPORT_ARG): new define for message format.
(globals::STP_PRINTF_ARG_LONG): specify arg type; replaces STP_PRINTF_ARG.
(globals::STP_PRINTF_ARG_STR): specify arg type; replaces STP_PRINT_ARG.
* bpf-translate.cxx (bpf_unparser::emit_transport_msg): use BPF_TRANSPORT_* defines.
(printf_arg_type): new function; choose correct STP_PRINTF_ARG_*.
(bpf_unparser::emit_print_format): use printf_arg_type.

* stapbpf/libbpf.c (ring_buffer_write_*): comment tweak.
bpf-internal.h
bpf-translate.cxx
stapbpf/bpfinterp.cxx
stapbpf/bpfinterp.h
stapbpf/libbpf.c
stapbpf/stapbpf.cxx
This page took 0.025972 seconds and 5 git commands to generate.