Skip to content

Commit

Permalink
ebpf: increase number of stack delta buckets
Browse files Browse the repository at this point in the history
With
#230 an
issue is reported, where the number of stack delta buckets is not
sufficient.
Increase stack delta bucket to be able to unwind also such executables.

Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Nov 8, 2024
1 parent 8ea42ea commit d823d2f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions processmanager/ebpf/ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ var outerMapsName = [...]string{
"exe_id_to_19_stack_deltas",
"exe_id_to_20_stack_deltas",
"exe_id_to_21_stack_deltas",
"exe_id_to_22_stack_deltas",
"exe_id_to_23_stack_deltas",
}

// Compile time check to make sure ebpfMapsImpl satisfies the interface .
Expand Down
2 changes: 1 addition & 1 deletion processmanager/ebpf/ebpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ func TestMapID(t *testing.T) {
})
}

_, err := getMapID(1 << 22)
_, err := getMapID(1 << 24)
require.Error(t, err)
}
2 changes: 2 additions & 0 deletions support/ebpf/extmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern bpf_map_def exe_id_to_18_stack_deltas;
extern bpf_map_def exe_id_to_19_stack_deltas;
extern bpf_map_def exe_id_to_20_stack_deltas;
extern bpf_map_def exe_id_to_21_stack_deltas;
extern bpf_map_def exe_id_to_22_stack_deltas;
extern bpf_map_def exe_id_to_23_stack_deltas;
extern bpf_map_def hotspot_procs;
extern bpf_map_def kernel_stackmap;
extern bpf_map_def dotnet_procs;
Expand Down
4 changes: 4 additions & 0 deletions support/ebpf/native_stack_trace.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ STACK_DELTA_BUCKET(18);
STACK_DELTA_BUCKET(19);
STACK_DELTA_BUCKET(20);
STACK_DELTA_BUCKET(21);
STACK_DELTA_BUCKET(22);
STACK_DELTA_BUCKET(23);

// Unwind info value for invalid stack delta
#define STACK_DELTA_INVALID (STACK_DELTA_COMMAND_FLAG | UNWIND_COMMAND_INVALID)
Expand Down Expand Up @@ -154,6 +156,8 @@ void *get_stack_delta_map(int mapID) {
case 19: return &exe_id_to_19_stack_deltas;
case 20: return &exe_id_to_20_stack_deltas;
case 21: return &exe_id_to_21_stack_deltas;
case 22: return &exe_id_to_22_stack_deltas;
case 23: return &exe_id_to_23_stack_deltas;
default: return NULL;
}
}
Expand Down
Binary file modified support/ebpf/tracer.ebpf.release.amd64
Binary file not shown.
Binary file modified support/ebpf/tracer.ebpf.release.arm64
Binary file not shown.
4 changes: 2 additions & 2 deletions support/ebpf/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ void decode_bias_and_unwind_program(u64 bias_and_unwind_program, u64* bias, int*

// Smallest stack delta bucket that holds up to 2^8 entries
#define STACK_DELTA_BUCKET_SMALLEST 8
// Largest stack delta bucket that holds up to 2^21 entries
#define STACK_DELTA_BUCKET_LARGEST 21
// Largest stack delta bucket that holds up to 2^23 entries
#define STACK_DELTA_BUCKET_LARGEST 23

// Struct of the `system_config` map. Contains various configuration variables
// determined and set by the host agent.
Expand Down

0 comments on commit d823d2f

Please sign in to comment.