Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracepoint support #232

Closed
brendangregg opened this issue Sep 18, 2015 · 7 comments
Closed

tracepoint support #232

brendangregg opened this issue Sep 18, 2015 · 7 comments

Comments

@brendangregg
Copy link
Member

Primarily so that tools are much more stable, but there's also some tracepoints that are easier to fetch as tracepoints than kprobes.

@brendangregg
Copy link
Member Author

Asking for future reference: is it possible this can be done with just bcc changes, and not require kernel changes?

Eg, I'd take bpf_attach_kprobe() from src/cc/libbpf.c, and have it work on tracepoints (it already enables probes from /sys/kernel/debug/tracing/events/, so it doesn't look far off). Then add the bpf_attach_kprobe wrappers in src/python/bcc/init.py.

@4ast
Copy link
Member

4ast commented Sep 21, 2015

I think attaching to native tracepoints is must have as well, but as workaround we can use such hack. I mean enable a tracepoint via debugfs and kprobe into raw tracepoint handler. It will be more reliable from kernel to kernel, but not officially stable hook.

@brendangregg
Copy link
Member Author

Does it need kprobes? Instead of mucking with kprobe_events, I was thinking it could write 1 to the tracepoint enable file (eg, /sys/kernel/debug/tracing/events/block/block_rq_insert/enable), then feed that path (/sys/kernel/debug/tracing/events/block/block_rq_insert) to bpf_attach_tracing_event(). And maybe it'd just work. ... I should try it.

@4ast
Copy link
Member

4ast commented Sep 21, 2015

perf_event_open() will be able to open such event, but bpf program will not be called. For 'trace_kfree_skb' tracepoint the opening of such perf_event will lead to call into perf_trace_kfree_skb() function, but currently there is no hook for bpf there. We can add kprobe to this perf_trace_kfree_skb() as a hack.

@tuxology
Copy link
Contributor

I remember, till 3.17-rcX, there as a patchset submitted by @4ast with BPF_PROG_TYPE_TRACING as a type to attach to events. Something like https://lkml.org/lkml/2014/7/18/10 We need something like that with bcc now to make our lives easier.

@brendangregg
Copy link
Member Author

In case anyone is looking, a short term workaround for tracepoint support is being developed as #419 .

@2opremio 2opremio mentioned this issue Apr 5, 2016
25 tasks
@brendangregg
Copy link
Member Author

closed, fixed, by #590, #596, #602, #608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants