bpf_perf_event_output() from pinned program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey All,

I've been struggling to try to get an eBPF program attached to XDP to output to a perf_event buffer. I have read the kernel samples [1][2] and found Toke's sample[3] but I can't seem to get my eBPF program to output to the PERF_EVENT_ARRAY. 

My current approach is that I have a binary which pins my maps and loads my elf object and attaches the program to XDP. I then have a second binary which allocates a file descriptor for each cpu with sys_perf_event_open() and stores that to the index of the map. I then use perf_event_mmap_header() to mmap all of the fds. I end by calling perf_event_poll_multi(). 

I have determined that bpf_perf_event_output() is returning ENOENT. Which makes sense when the program is first loaded but shouldn't the program use the fds in the map after they are put there by the second binary? or is this incorrect?

Summary: Is my approach of using two binaries valid? Can I update the PERF_EVENT_ARRY with the mmap'd fds after the program is running?

Any insight would be greatly appreciated!

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/bpf/trace_output_user.c
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/samples/bpf/trace_output_kern.c
[3] https://lore.kernel.org/netdev/152830792912.21161.3609946361971472545.stgit@alrua-kau/



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux