Re: [PATCH] cpupower: Add cpu_start()/cpu_stop() callbacks for monitors

From: Shuah Khan
Date: Wed Jun 18 2025 - 18:45:07 EST


On 6/9/25 08:49, Rohan Lambture wrote:
Move per-CPU logic from inside individual monitors to the main
monitoring framework by adding cpu_start() and cpu_stop() callback
functions to the cpuidle_monitor structure.

This refactoring allows the framework to handle per-CPU scheduling
and gives higher priority to fork_it operations as mentioned in
the TODO. Individual monitors now only need to implement per-CPU
initialization and cleanup logic without managing the CPU iteration
themselves.

Changes made:
- Add cpu_start()/cpu_stop() function pointers to cpuidle_monitor struct
- Update monitoring framework to call per-CPU callbacks for each CPU
- Refactor cpuidle_sysfs and mperf monitors to use new callback pattern
- Maintain backward compatibility for monitors without per-CPU callbacks

This addresses the TODO item: "Add cpu_start()/cpu_stop() callbacks
for monitor -> This is to move the per_cpu logic from inside the
monitor to outside it."

Please share details on how this changes has been tested.
Also run checkpatch - there are a few warnings.


Signed-off-by: Rohan Lambture <rohanlambture13@xxxxxxxxx>
---

thanks,
-- Shuah