kepler icon indicating copy to clipboard operation
kepler copied to clipboard

fix(bpf): Fix issue(s) introduced with bpf refactor

Open dave-tucker opened this issue 1 year ago • 2 comments

This fixes a few issues identified with the bpf code format and refactor.

  1. Zero initialize all variables
  2. Use the bpf_perf_event_read_value helper exlusively
  3. Cherry-pick of PR #1410 - reported by @vimalk78 - which correctly sizes the processes and pid_time maps. Without this patch entries won't be created in the processes map for pids that are > number of cpu cores which fundamentally breaks power reporting.

In addition, add some logging around eBPF array resizing.

Fixes: #1402 #1411

dave-tucker avatar May 07 '24 08:05 dave-tucker

@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 avatar May 08 '24 12:05 dave-tucker

@dave-tucker , thanks a lot for cleaning up the code quite a bit 👼 !

sthaha avatar May 09 '24 00:05 sthaha

@dave-tucker , could you please rebase this PR? There are some open comments as well which you may want to address.

sthaha avatar May 12 '24 02:05 sthaha

@dave-tucker for 5.4 kernel, bpf_perf_event_read_value has an issue (discussed here)

rootfs avatar Jun 02 '24 00:06 rootfs