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

tetragon: Use static funcs in few places #2453

Merged
merged 11 commits into from
May 29, 2024
Merged

Conversation

olsajiri
Copy link
Contributor

@olsajiri olsajiri commented May 20, 2024

bpf_generic_kprobe_v61.o:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             63972      27387  -36585 (-57.19%)        1927         993   -934 (-48.47%)
generic_kprobe_event                 357        357       +0 (+0.00%)          26          26      +0 (+0.00%)
generic_kprobe_filter_arg         167281     159736    -7545 (-4.51%)        5409        4838   -571 (-10.56%)
generic_kprobe_output                281        281       +0 (+0.00%)          21          21      +0 (+0.00%)
generic_kprobe_override               20         20       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event       63664      27264  -36400 (-57.18%)        1439         773   -666 (-46.28%)
generic_kprobe_process_filter     178641     145524  -33117 (-18.54%)        7346        5477  -1869 (-25.44%)
generic_kprobe_setup_event         74037      27430  -46607 (-62.95%)        1558         782   -776 (-49.81%)

similar stats for:
bpf_generic_tracepoint_v61.o
bpf_generic_uprobe_v61.o
bpf_multi_kprobe_v61.o
bpf_multi_uprobe_v61.o
bpf_multi_retkprobe_v61.o

@olsajiri olsajiri added the release-note/minor This PR introduces a minor user-visible change label May 20, 2024
olsajiri added 4 commits May 22, 2024 14:07
Add support to mark some functions as static, local and not inlined.
That will give us faster verification on recent kernels. Enabling this
for v6.1 onwards for now.

Signed-off-by: Jiri Olsa <[email protected]>
Program       Insns (A)  Insns (B)  Insns    (DIFF)  States (A)  States (B)  States  (DIFF)
------------  ---------  ---------  ---------------  ----------  ----------  --------------
event_execve      58536      64755  +6219 (+10.62%)        1462        1691  +229 (+15.66%)
execve_rate         196        196      +0 (+0.00%)          12          12     +0 (+0.00%)
execve_send        1026       1026      +0 (+0.00%)          66          66     +0 (+0.00%)

bpf_generic_kprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns      (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  -----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18        +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             86858      86858        +0 (+0.00%)        2724        2724      +0 (+0.00%)
generic_kprobe_event                 404        404        +0 (+0.00%)          29          29      +0 (+0.00%)
generic_kprobe_filter_arg         181622     181622        +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_kprobe_output                409        409        +0 (+0.00%)          31          31      +0 (+0.00%)
generic_kprobe_override               20         20        +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event      129477      28117  -101360 (-78.28%)        2488         870  -1618 (-65.03%)
generic_kprobe_process_filter     178641     178641        +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_kprobe_setup_event         76647      30362   -46285 (-60.39%)        1731        1022   -709 (-40.96%)

bpf_multi_kprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns      (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  -----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18        +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             86858      86858        +0 (+0.00%)        2724        2724      +0 (+0.00%)
generic_kprobe_event                 419        419        +0 (+0.00%)          30          30      +0 (+0.00%)
generic_kprobe_filter_arg         181622     181622        +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_kprobe_output                409        409        +0 (+0.00%)          31          31      +0 (+0.00%)
generic_kprobe_override               20         20        +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event      129477      28117  -101360 (-78.28%)        2488         870  -1618 (-65.03%)
generic_kprobe_process_filter     178641     178641        +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_kprobe_setup_event         76647      30362   -46285 (-60.39%)        1731        1022   -709 (-40.96%)

Signed-off-by: Jiri Olsa <[email protected]>
Passing maps in exatr object for generic_actions, which will
allow us to save some argument and make some functions static
in following changes .

Signed-off-by: Jiri Olsa <[email protected]>
bpf_generic_kprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             86858      27758  -59100 (-68.04%)        2724        1013  -1711 (-62.81%)
generic_kprobe_event                 404        404       +0 (+0.00%)          29          29      +0 (+0.00%)
generic_kprobe_filter_arg         181622     181622       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_kprobe_output                409        409       +0 (+0.00%)          31          31      +0 (+0.00%)
generic_kprobe_override               20         20       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event       28117      28117       +0 (+0.00%)         870         870      +0 (+0.00%)
generic_kprobe_process_filter     178641     178641       +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_kprobe_setup_event         30362      30362       +0 (+0.00%)        1022        1022      +0 (+0.00%)

bpf_generic_retkprobe_v61.o.csv:

Program                       Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_retkprobe_actions         76370      26393  -49977 (-65.44%)        2380         970  -1410 (-59.24%)
generic_retkprobe_event           30157      30157       +0 (+0.00%)        2148        2148      +0 (+0.00%)
generic_retkprobe_filter_arg     181597     181597       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_retkprobe_output             41         41       +0 (+0.00%)           3           3      +0 (+0.00%)

bpf_generic_tracepoint_v61.o.csv:

Program                           Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
--------------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_tracepoint_actions            90074      27431  -62643 (-69.55%)        2743         999  -1744 (-63.58%)
generic_tracepoint_arg               181622     181622       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_tracepoint_event               1776       1776       +0 (+0.00%)          86          86      +0 (+0.00%)
generic_tracepoint_filter            178641     178641       +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_tracepoint_output               409        409       +0 (+0.00%)          31          31      +0 (+0.00%)
generic_tracepoint_process_event       5544       5544       +0 (+0.00%)         390         390      +0 (+0.00%)

bpf_generic_uprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_uprobe_actions             76370      26393  -49977 (-65.44%)        2380         970  -1410 (-59.24%)
generic_uprobe_event                 281        281       +0 (+0.00%)          17          17      +0 (+0.00%)
generic_uprobe_filter_arg         181622     181622       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_uprobe_output                409        409       +0 (+0.00%)          31          31      +0 (+0.00%)
generic_uprobe_process_event        5544       5544       +0 (+0.00%)         390         390      +0 (+0.00%)
generic_uprobe_process_filter     178641     178641       +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_uprobe_setup_event          5419       5419       +0 (+0.00%)         382         382      +0 (+0.00%)

bpf_multi_kprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             86858      27758  -59100 (-68.04%)        2724        1013  -1711 (-62.81%)
generic_kprobe_event                 419        419       +0 (+0.00%)          30          30      +0 (+0.00%)
generic_kprobe_filter_arg         181622     181622       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_kprobe_output                409        409       +0 (+0.00%)          31          31      +0 (+0.00%)
generic_kprobe_override               20         20       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event       28117      28117       +0 (+0.00%)         870         870      +0 (+0.00%)
generic_kprobe_process_filter     178641     178641       +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_kprobe_setup_event         30362      30362       +0 (+0.00%)        1022        1022      +0 (+0.00%)

bpf_multi_retkprobe_v61.o.csv:

Program                       Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_retkprobe_actions         76370      26393  -49977 (-65.44%)        2380         970  -1410 (-59.24%)
generic_retkprobe_event           28135      28135       +0 (+0.00%)        1923        1923      +0 (+0.00%)
generic_retkprobe_filter_arg     181597     181597       +0 (+0.00%)        6252        6252      +0 (+0.00%)
generic_retkprobe_output             41         41       +0 (+0.00%)           3           3      +0 (+0.00%)

bpf_multi_uprobe_v61.o.csv:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_uprobe_actions             76370      26393  -49977 (-65.44%)        2380         970  -1410 (-59.24%)
generic_uprobe_event                 284        284       +0 (+0.00%)          17          17      +0 (+0.00%)
generic_uprobe_filter_arg         169723     169723       +0 (+0.00%)        5358        5358      +0 (+0.00%)
generic_uprobe_output                409        409       +0 (+0.00%)          31          31      +0 (+0.00%)
generic_uprobe_process_event        5544       5544       +0 (+0.00%)         390         390      +0 (+0.00%)
generic_uprobe_process_filter     178641     178641       +0 (+0.00%)        7346        7346      +0 (+0.00%)
generic_uprobe_setup_event          5419       5419       +0 (+0.00%)         382         382      +0 (+0.00%)

bpf_fork.o.csv:

Program                 Insns (A)  Insns (B)  Insns (DIFF)  States (A)  States (B)  States (DIFF)
----------------------  ---------  ---------  ------------  ----------  ----------  -------------
event_wake_up_new_task       1536       1536   +0 (+0.00%)          82          82    +0 (+0.00%)

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the pr/olsajiri/static_funcs branch 2 times, most recently from 6810cb3 to 9f99281 Compare May 23, 2024 11:28
olsajiri added 2 commits May 23, 2024 11:53
Passing heap map to generic_process_filter to reduce the
number of passed arguments, which results in simpler code
generated by clang and allows us to make some calls static.

Signed-off-by: Jiri Olsa <[email protected]>
Passing heap object to selector_process_filter to reduce the
number of passed arguments, which results in simpler code
generated by clang and allows us to make some calls static.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the pr/olsajiri/static_funcs branch 2 times, most recently from 0bb01eb to b422c22 Compare May 23, 2024 12:06
olsajiri added 5 commits May 24, 2024 07:06
…ruct

Passing selector_filter object to selector_match to reduce the number
of passed arguments, which results in simpler code generated by clang
and allows us to make some calls static.

Signed-off-by: Jiri Olsa <[email protected]>
Passing heap object to selector_match to reduce the number of passed
arguments, which results in simpler code generated by clang and allows
us to make some calls static.

Signed-off-by: Jiri Olsa <[email protected]>
bpf_generic_kprobe_v61.o:

Program                        Insns (A)  Insns (B)  Insns     (DIFF)  States (A)  States (B)  States   (DIFF)
-----------------------------  ---------  ---------  ----------------  ----------  ----------  ---------------
generic_fmodret_override              18         18       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_actions             27387      27387       +0 (+0.00%)         993         993      +0 (+0.00%)
generic_kprobe_event                 357        357       +0 (+0.00%)          26          26      +0 (+0.00%)
generic_kprobe_filter_arg         167281     167281       +0 (+0.00%)        5409        5409      +0 (+0.00%)
generic_kprobe_output                281        281       +0 (+0.00%)          21          21      +0 (+0.00%)
generic_kprobe_override               20         20       +0 (+0.00%)           2           2      +0 (+0.00%)
generic_kprobe_process_event       27264      27264       +0 (+0.00%)         773         773      +0 (+0.00%)
generic_kprobe_process_filter     178641     145524  -33117 (-18.54%)        7346        5477  -1869 (-25.44%)
generic_kprobe_setup_event         27430      27430       +0 (+0.00%)         782         782      +0 (+0.00%)

similar stats for:
  bpf_generic_tracepoint_v61.o
  bpf_generic_uprobe_v61.o
  bpf_multi_kprobe_v61.o
  bpf_multi_uprobe_v61.o

Signed-off-by: Jiri Olsa <[email protected]>
bpf_generic_kprobe_v61.o:

Program                        Insns (A)  Insns (B)  Insns   (DIFF)  States (A)  States (B)  States  (DIFF)
-----------------------------  ---------  ---------  --------------  ----------  ----------  --------------
generic_fmodret_override              18         18     +0 (+0.00%)           2           2     +0 (+0.00%)
generic_kprobe_actions             27387      27387     +0 (+0.00%)         993         993     +0 (+0.00%)
generic_kprobe_event                 357        357     +0 (+0.00%)          26          26     +0 (+0.00%)
generic_kprobe_filter_arg         167281     159736  -7545 (-4.51%)        5409        4838  -571 (-10.56%)
generic_kprobe_output                281        281     +0 (+0.00%)          21          21     +0 (+0.00%)
generic_kprobe_override               20         20     +0 (+0.00%)           2           2     +0 (+0.00%)
generic_kprobe_process_event       27264      27264     +0 (+0.00%)         773         773     +0 (+0.00%)
generic_kprobe_process_filter     145598     145524    -74 (-0.05%)        5485        5477     -8 (-0.15%)
generic_kprobe_setup_event         27430      27430     +0 (+0.00%)         782         782     +0 (+0.00%)

similar stats for:
  bpf_generic_tracepoint_v61.o
  bpf_generic_uprobe_v61.o
  bpf_multi_kprobe_v61.o
  bpf_multi_uprobe_v61.o

bpf_multi_retkprobe_v61.o:

Program                       Insns (A)  Insns (B)  Insns    (DIFF)  States (A)  States (B)  States  (DIFF)
----------------------------  ---------  ---------  ---------------  ----------  ----------  --------------
generic_retkprobe_actions         25974      25974      +0 (+0.00%)         946         946     +0 (+0.00%)
generic_retkprobe_event           21341      18385  -2956 (-13.85%)        1476        1259  -217 (-14.70%)
generic_retkprobe_filter_arg     167256     159771   -7485 (-4.48%)        5409        4835  -574 (-10.61%)
generic_retkprobe_output             41         41      +0 (+0.00%)           3           3     +0 (+0.00%)

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri force-pushed the pr/olsajiri/static_funcs branch from b422c22 to 775e579 Compare May 24, 2024 07:11
@olsajiri olsajiri marked this pull request as ready for review May 24, 2024 08:00
@olsajiri olsajiri requested a review from a team as a code owner May 24, 2024 08:00
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@olsajiri olsajiri merged commit 3c3787c into main May 29, 2024
43 checks passed
@olsajiri olsajiri deleted the pr/olsajiri/static_funcs branch May 29, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants