Skip to content

perf event array: failed to create perf ring for CPU XYZ: can't create perf event: invalid argument #1029

Answered by lmb
lmb asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is that the map size is larger than the total number of possible CPUs in the system. In the example the system probably has 16 cores / 32 hyperthreads numbered from 0-31, hence the error when trying to create a perf ring for CPU 32.

The fix is to not specify max_elems for perf event arrays, which makes the loader determine the correct size for the current system. This is supported both by cilium/ebpf and newer libbpf / iproute2 versions.

Replies: 3 comments

Comment options

lmb
Apr 27, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by lmb
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants