libbpf-tools: filelife: Fix problem when using perf-buffer#5432
Merged
ekyooo merged 1 commit intoiovisor:masterfrom Dec 11, 2025
Merged
libbpf-tools: filelife: Fix problem when using perf-buffer#5432ekyooo merged 1 commit intoiovisor:masterfrom
ekyooo merged 1 commit intoiovisor:masterfrom
Conversation
When ring buffers are not supported, will fallback to perf-buffer. The
map type is set for the perf buffer in `bpf_buffer__new()`. This setting
must be done before the BPF program is loaded. Otherwise,
`BPF_MAP_TYPE_RINGBUF` will be used in `bpf_perf_event_output()`,
resulting in the following error message:
; return bpf_perf_event_output(ctx, &events, BPF_F_CURRENT_CPU, buf, size); @ compat.bpf.h:46
136: (79) r1 = *(u64 *)(r10 -40) ; R1_w=ctx() R10=fp0 fp-40=ctx()
137: (18) r2 = 0xffff8bd101623c00 ; R2_w=map_ptr(map=events,ks=0,vs=0)
139: (18) r3 = 0xffffffff ; R3_w=0xffffffff
141: (bf) r4 = r7 ; R4_w=map_value(map=heap,ks=4,vs=10240) R7=map_value(map=heap,ks=4,vs=10240)
142: (b7) r5 = 8200 ; R5_w=8200
143: (85) call bpf_perf_event_output#25
cannot pass map_type 27 into func bpf_perf_event_output#25
map_type 27 is BPF_MAP_TYPE_RINGBUF.
At the same time, I also moved the notification message (Tracing...) to
after all steps were successful.
Signed-off-by: Rong Tao <rongtao@cestc.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@ekyooo When ring buffers are not supported, will fallback to perf-buffer. The map type is set for the perf buffer in
bpf_buffer__new(). This setting must be done before the BPF program is loaded. Otherwise,BPF_MAP_TYPE_RINGBUFwill be used inbpf_perf_event_output(), resulting in the following error message:map_type 27 is BPF_MAP_TYPE_RINGBUF.
At the same time, I also moved the notification message (Tracing...) to after all steps were successful.