mbox series

[0/2] perf/x86: Package residency counter improvements

Message ID 20230823055653.2964237-1-tero.kristo@linux.intel.com (mailing list archive)
Headers show
Series perf/x86: Package residency counter improvements | expand

Message

Tero Kristo Aug. 23, 2023, 5:56 a.m. UTC
Hello,

Following two patches address a couple of different issues with Intel
C-state package residency counters, which are used to track power saving
state usage on Intel chips. The patches don't have any dependencies to
each other and can be applied separately.

1) The residency counters are always read from the first CPU of the
   package via an SMP call, even if they are available from any CPU.
   This causes extra latency. Patch #1 fixes this issue by flagging
   the perf event properly and allowing to execute it on any CPU of
   the package.
2) The residency counters are completely impossible to read from a BPF
   program running on any other than the first CPU of the package, as the
   SMP call is not available in this context. Patch #2 addresses this
   issue by allowing the read of the perf event from the local CPU,
   similar to what is done in perf_read_event(). This patch also allows
   reading any other package scope perf events (RAPL/UNCORE) from
   arbitrary CPUs on a package via BPF.

-Tero