Re: [RFC PATCH] samples:bpf: introduce task detector
From: 王贇 <hidden>
Date: 2020-05-29 02:24:53
Also in:
bpf, lkml
On 2020/5/29 上午2:34, Andrii Nakryiko wrote: [snip]
quoted
quoted
With CO-RE, it also will allow to compile this tool once and run it on many different kernels without recompilation. Please do take a look and submit a PR there, it will be a good addition to the toolkit (and will force you write a bit of README explaining use of this tool as well ;).Aha, I used to think bcc only support python and cpp :-Plibbpf-tools don't use BCC at all, they are just co-located with BCC and BCC tools in the same repository and are lightweight alternatives to BCC-based tools. But it needs kernel with BTF built-in, which is the only (temporary) downside.
I see, thanks for the explain :-) We prefer libbpf since we feel it's more friendly for kernel folks to do develop, less suspects when meet any BUG, while BCC is a good way to package and distribute, glad to know that we can have them in one piece now. Regards, Michael Wang
quoted
I'll try to rework it and submit PR, I'm glad to know that you think this tool as a helpful one, we do solved some tough issue with it already.quoted
As for the code itself, I haven't gone through it much, but please convert map definition syntax to BTF-defined one. The one you are using is a legacy one. Thanks! [0] https://github.com/iovisor/bcc/tree/master/libbpf-toolsWill check the example there :-) Regards, Michael Wangquoted
quoted
samples/bpf/Makefile | 3 + samples/bpf/task_detector.h | 382 +++++++++++++++++++++++++++++++++++++++ samples/bpf/task_detector_kern.c | 329 +++++++++++++++++++++++++++++++++ samples/bpf/task_detector_user.c | 314 ++++++++++++++++++++++++++++++++ 4 files changed, 1028 insertions(+) create mode 100644 samples/bpf/task_detector.h create mode 100644 samples/bpf/task_detector_kern.c create mode 100644 samples/bpf/task_detector_user.c[...]