Commit ec8415b
libbpf-tools: filelife: Fix problem when using perf-buffer
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>1 parent 7da5916 commit ec8415b
1 file changed
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 179 | | |
183 | 180 | | |
184 | 181 | | |
| |||
192 | 189 | | |
193 | 190 | | |
194 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
0 commit comments