-
Notifications
You must be signed in to change notification settings - Fork 165
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
update(modern_bpf): reduce the execve
instrumentation time with new APIs
#648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
/approve
LGTM label has been added. Git tree hash: 6210ba75c3a3c29c0dbbf33c60a4e419f49a50ee
|
@Andreagit97 , very nice tooling for measurements. I will have a look at it. I left a comment on #633 regarding the args/env max discussion. So far, you change here looks nice. |
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/execve.bpf.c
Show resolved
Hide resolved
3bcbd53
to
c9388df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Andreagit97 LGTM
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/execve.bpf.c
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Andreagit97 , I have spot some places for reviewing the right constant. I will give this PR a try later this week. Thanks.
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/fsconfig.bpf.c
Outdated
Show resolved
Hide resolved
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/mount.bpf.c
Outdated
Show resolved
Hide resolved
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/mount.bpf.c
Outdated
Show resolved
Hide resolved
… APIs Signed-off-by: Andrea Terzolo <[email protected]>
hey @hbrueckner the problem is even worst, the |
Signed-off-by: Andrea Terzolo <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]>
Hi @Andreagit97
This indeed looks very strange. Also had a look add kernel driver and kernel sources, and agree they basically use the same |
Hi @Andreagit97, thanks for the update and, yeah, also agree on sticking with |
I've just pushed a possible solution. In ARM we already need to catch the clone/clone3 child events from another tracepoint ( Sorry for the PR dimension this is quite huge but there are a lot of tests inside... I still need to address this comment #648 (comment)
Agree on opening the issue, the best solution would be to find another way to take the args from the kernel but i would address it in another PR probably as you suggested :) |
Fully agree with the solution; simple and effective! |
the good news is that this PR should be the last one to have a full working implementation of the modern bpf probe 🥳 |
Agreed too! Thanks a lot @Andreagit97 ! |
Hi @Andreagit97
No problem ... I will need some time for a deeper review on the recent changes ... and, awesome that we now have a full working modern bpf probe! |
@@ -39,6 +39,9 @@ | |||
/* Proc name */ | |||
#define MAX_PROC_EXE 4096 | |||
|
|||
/* Task comm */ | |||
#define MAX_TASK_COMM 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Andreagit97 ,
for reference, here is the link to the kernel source as background: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/sched.h#n286
Reading it a bit more carefully, the len has been redefined as enum
to make it available to BPF programs with commit:
commit 3087c61ed2c48548b74dd343a5209b87082c682d
Author: Yafang Shao <[email protected]>
Date: Wed Jan 19 18:08:40 2022 -0800
tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN
As the sched:sched_switch tracepoint args are derived from the kernel,
we'd better make it same with the kernel. So the macro TASK_COMM_LEN is
converted to type enum, then all the BPF programs can get it through
BTF.
The BPF program which wants to use TASK_COMM_LEN should include the
header vmlinux.h. Regarding the test_stacktrace_map and
test_tracepoint, as the type defined in linux/bpf.h are also defined in
vmlinux.h, so we don't need to include linux/bpf.h again.
For s390x
, it is already included in the generated driver/modern_bpf/definitions/vmlinux.h
definitions. So question here is whether we keep it that way or update the definitions and use directly the enum
? Wdyt?
P.S. the remaining changes looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I think we can add it manually to x86
and aarch64
without updating all the vmlinux files and use this already defined enum, btw great catch this saves us an additional macro :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
Signed-off-by: Andrea Terzolo <[email protected]> Co-authored-by: Hendrik Brueckner <[email protected]>
542524d
to
ecd21b0
Compare
Tested on all three architectures (x86, aarch64, s390x) and it should work! |
Hi @Andreagit97 ,
Confirmed for
Further, I went through your commits and they are fine! @Andreagit97 Incredible and awesome work as usual! /lgtm |
LGTM label has been added. Git tree hash: 37fc8e72aaa5b99bbcef12263541fdaf6a073d6b
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, FedeDP, hbrueckner, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR completes #513 |
/milestone 4.0.0+driver |
What type of PR is this?
/kind cleanup
/kind feature
Any specific area of the project related to this PR?
/area driver-modern-bpf
Does this PR require a change in the driver versions?
No
What this PR does / why we need it:
Playing with https://github.com/Andreagit97/BPF-perftool we noticed that the
execveat
instrumentation time was strangely high compared to the old probe one:This overhead seems related to the use of
extract__charbuf_pointer_from_array
inline function, for some reason clang increases the complexity of the programs causing overhead in the prog execution. With the new APIsauxmap__store_execve_exe
andauxmap__store_execve_args
I've recorded these new data:Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: