fix(bpf): Fix issue(s) introduced with bpf refactor
This fixes a few issues identified with the bpf code format and refactor.
- Zero initialize all variables
- Use the bpf_perf_event_read_value helper exlusively
- Cherry-pick of PR #1410 - reported by @vimalk78 - which correctly sizes the
processesandpid_timemaps. Without this patch entries won't be created in theprocessesmap for pids that are >number of cpu coreswhich fundamentally breaks power reporting.
In addition, add some logging around eBPF array resizing.
Fixes: #1402 #1411
@sthaha @vimalk78 thanks for your review and comments.
I took a pass over the code and ensured that everything that needed to be zero'd, was zero'd.
In doing so I was able to fix #1411 so we now use bpf_perf_event_read_value everywhere.
In addition, I was able to verify that this solves the verifier error encountered in #1402.
Force pushed and updated commit message - I'd appreciate you both taking another look.
@dave-tucker , thanks a lot for cleaning up the code quite a bit 👼 !
@dave-tucker , could you please rebase this PR? There are some open comments as well which you may want to address.
@dave-tucker for 5.4 kernel, bpf_perf_event_read_value has an issue (discussed here)