Skip to content

Commit

Permalink
tetragon: Use FUNC_LOCAL for some generic_kprobe_filter_arg functions
Browse files Browse the repository at this point in the history
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             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.csv:

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]>
  • Loading branch information
olsajiri committed May 23, 2024
1 parent 8e3cdc5 commit 0bb01eb
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions bpf/process/types/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ FUNC_INLINE void *get_string_map(int index, __u32 map_idx)
return 0;
}

FUNC_INLINE long
FUNC_LOCAL long
filter_char_buf_equal(struct selector_arg_filter *filter, char *arg_str, uint orig_len)
{
__u32 *map_ids = (__u32 *)&filter->value;
Expand Down Expand Up @@ -791,7 +791,7 @@ filter_char_buf_equal(struct selector_arg_filter *filter, char *arg_str, uint or
return !!pass;
}

FUNC_INLINE long
FUNC_LOCAL long
filter_char_buf_prefix(struct selector_arg_filter *filter, char *arg_str, uint arg_len)
{
void *addrmap;
Expand Down Expand Up @@ -854,7 +854,7 @@ FUNC_INLINE void copy_reverse(__u8 *dest, uint len, __u8 *src, uint offset)
}
}

FUNC_INLINE long
FUNC_LOCAL long
filter_char_buf_postfix(struct selector_arg_filter *filter, char *arg_str, uint arg_len)
{
void *addrmap;
Expand Down Expand Up @@ -887,7 +887,7 @@ FUNC_INLINE bool is_not_operator(__u32 op)
return (op == op_filter_neq || op == op_filter_str_notprefix || op == op_filter_str_notpostfix || op == op_filter_notin);
}

FUNC_INLINE long
FUNC_LOCAL long
filter_char_buf(struct selector_arg_filter *filter, char *args, int value_off)
{
long match = 0;
Expand Down Expand Up @@ -923,7 +923,7 @@ struct string_buf {
* and the filter file path in the normal order. For the 'postfix' operator we do
* a reverse search.
*/
FUNC_INLINE long
FUNC_LOCAL long
filter_file_buf(struct selector_arg_filter *filter, struct string_buf *args)
{
long match = 0;
Expand Down Expand Up @@ -1009,7 +1009,7 @@ filter_addr_map(struct selector_arg_filter *filter, __u64 *addr, __u16 family)
/* filter_inet: runs a comparison between the IPv4/6 addresses and ports in
* the sock or skb in the args aginst the filter parameters.
*/
FUNC_INLINE long
FUNC_LOCAL long
filter_inet(struct selector_arg_filter *filter, char *args)
{
__u64 addr[2] = { 0, 0 };
Expand Down Expand Up @@ -1256,7 +1256,7 @@ FUNC_INLINE bool is_signed_type(int type)
}

// filter on values provided in the selector itself
FUNC_INLINE long
FUNC_LOCAL long
filter_64ty_selector_val(struct selector_arg_filter *filter, char *args)
{
__u64 *v = (__u64 *)&filter->value;
Expand Down Expand Up @@ -1312,7 +1312,7 @@ filter_64ty_selector_val(struct selector_arg_filter *filter, char *args)

// use the selector value to determine a hash map, and do a lookup to determine whether the argument
// is in the defined set.
FUNC_INLINE long
FUNC_LOCAL long
filter_64ty_map(struct selector_arg_filter *filter, char *args, bool set32bit)
{
void *argmap;
Expand All @@ -1338,7 +1338,7 @@ filter_64ty_map(struct selector_arg_filter *filter, char *args, bool set32bit)
return 0;
}

FUNC_INLINE long
FUNC_LOCAL long
filter_64ty(struct selector_arg_filter *filter, char *args, bool set32bit)
{
switch (filter->op) {
Expand All @@ -1356,7 +1356,7 @@ filter_64ty(struct selector_arg_filter *filter, char *args, bool set32bit)
return 0;
}

FUNC_INLINE long
FUNC_LOCAL long
filter_32ty_selector_val(struct selector_arg_filter *filter, char *args)
{
__u32 *v = (__u32 *)&filter->value;
Expand Down Expand Up @@ -1413,7 +1413,7 @@ filter_32ty_selector_val(struct selector_arg_filter *filter, char *args)

// use the selector value to determine a hash map, and do a lookup to determine whether the argument
// is in the defined set.
FUNC_INLINE long
FUNC_LOCAL long
filter_32ty_map(struct selector_arg_filter *filter, char *args)
{
void *argmap;
Expand Down Expand Up @@ -1442,7 +1442,7 @@ filter_32ty_map(struct selector_arg_filter *filter, char *args)
return 0;
}

FUNC_INLINE long
FUNC_LOCAL long
filter_32ty(struct selector_arg_filter *filter, char *args)
{
switch (filter->op) {
Expand Down

0 comments on commit 0bb01eb

Please sign in to comment.