Skip to content

Commit 216d567

Browse files
Thomas Richternamhyung
Thomas Richter
authored andcommitted
perf trace: Fix wrong size to bpf_map__update_elem call
In linux-next commit c760174 ("perf cpumap: Reduce cpu size from int to int16_t") causes the perf tests 100 126 to fail on s390: Output before: # ./perf test 100 100: perf trace BTF general tests : FAILED! # The root cause is the change from int to int16_t for the cpu maps. The size of the CPU key value pair changes from four bytes to two bytes. However a two byte key size is not supported for bpf_map__update_elem(). Note: validate_map_op() in libbpf.c emits warning libbpf: map '__augmented_syscalls__': \ unexpected key size 2 provided, expected 4 when key size is set to int16_t. Therefore change to variable size back to 4 bytes for invocation of bpf_map__update_elem(). Output after: # ./perf test 100 100: perf trace BTF general tests : Ok # Fixes: c760174 ("perf cpumap: Reduce cpu size from int to int16_t") Signed-off-by: Thomas Richter <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Acked-by: Howard Chu <[email protected]> Cc: James Clark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 9a352a9 commit 216d567

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/perf/builtin-trace.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -4476,10 +4476,12 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
44764476
* CPU the bpf-output event's file descriptor.
44774477
*/
44784478
perf_cpu_map__for_each_cpu(cpu, i, trace->syscalls.events.bpf_output->core.cpus) {
4479+
int mycpu = cpu.cpu;
4480+
44794481
bpf_map__update_elem(trace->skel->maps.__augmented_syscalls__,
4480-
&cpu.cpu, sizeof(int),
4482+
&mycpu, sizeof(mycpu),
44814483
xyarray__entry(trace->syscalls.events.bpf_output->core.fd,
4482-
cpu.cpu, 0),
4484+
mycpu, 0),
44834485
sizeof(__u32), BPF_ANY);
44844486
}
44854487
}

0 commit comments

Comments
 (0)