Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libbpf: failed to open perf buffer event on cpu #103

Closed
giladreti opened this issue Dec 9, 2019 · 2 comments
Closed

libbpf: failed to open perf buffer event on cpu #103

giladreti opened this issue Dec 9, 2019 · 2 comments

Comments

@giladreti
Copy link

I'm using Ubuntu 64-bit with Linux kernel 5.0.0-37-generic. I'm running a BPF program which uses a perf_event_array whose id on the BPF VM is 14. When trying to inspect it using bpftool map event_pipe id 14 i get the following error:
libbpf: failed to open perf buffer event on cpu #4: No such device Error: failed to create perf buffer: Unknown error -19 (-19)
My machine has 4 cpus online, but 128 possible (e.g /sys/devices/system/cpu/possible contains "0-127")
I guess the problem is that libbpf reads from /sys/devices/system/cpu/possible instead of /sys/devices/system/cpu/online and thus thinks that it needs to attach to 128 cpus instead of just 4.

pb->cpu_cnt = libbpf_num_possible_cpus();

@anakryiko
Copy link
Member

Yes, thanks for reporting. It's a known libbpf problem (BCC has the same problem as well). I'm going to post a fix for this in next few days. The idea is that we still need to allocate buffers per each of possible CPU, because that's what kernel expects and how kernel operates. But we should be attaching those buffers only for CPUs that are online.

@anakryiko
Copy link
Member

Fixed a while ago in b85e83f, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants