Re: [PATCH 2/2] cpufreq: scmi: Update Energy Model with allowed performance limits

From: Lukasz Luba
Date: Mon Apr 22 2024 - 09:55:47 EST




On 4/22/24 14:11, Dietmar Eggemann wrote:
On 03/04/2024 18:23, Lukasz Luba wrote:
The Energy Model (EM) supports performance limits updates. Use the SCMI
notifications to get information from FW about allowed frequency scope for
the CPUs.

I'm slightly confused here. IMHO this doesn't seem to be related to the
"HW dependency between 'little CPUs & L3 $ in DSU' or similar" usecase.

I assumed that this usecase is rather handled via an additional
out-of-tree driver, potentially the same which updates the EM because of
temperature change (em_dev_compute_costs(), em_dev_update_perf_domain())
or chip binning (em_dev_update_chip_binning()).

This patch allows to handle relatively simple and straight forward use
case for updating the perf limits in the EM. The one that you mention,
which would probably always live out-of-tree, is more complex and
focused on leakage estimation in different conditions.

I see those two drivers separate. We have the DSU+Littles dependency
always, because it's HW dependency, while the leakage issue can happen
in some scenarios like gaming and needs more dedicated driver to handle
it (or rely on FW, but that's another story, orthogonal as well) and
more information to do it properly.


What about other CPUFreq drivers registering an EM via
em_dev_register_perf_domain() or 'cpufreq_register_em_with_opp() ->
dev_pm_opp_of_register_em()'? Or is this 'limit notification' an SCMI FW
only thing?

Other platforms which use different drivers for CPUfreq will have to
develop their own code. Although, when we merge this upstream, they
could follow this pattern as a reference design.

In our SCMI cpufreq and our SCP firmware we have this situation:
1. Sending CPUfreq request from Big CPU to SCP e.g. via fast-channel &
it's done from sched-util w/o sugov kthread &
it has to be super fast, we don't check any other dependency CPU
for Littles or something like that.
2. The SCP firmware receives the frequency request for Big CPU &
it checks internal dependencies for other components e.g.
L3 cache min speed (DSU+Littles domian frequency)
3. The SCP changes the Big CPU frequency & changes the DSU+Littles
frequency as the depended device
4. The SCP sends updated performance limits for the depended DSU+Littles
domian to the SCMI cpufreq kernel driver, for proper Littles domain
cpufreq device
5. SCMI cpufreq kernel driver gets the SCP notification about updated
perf limits & translates the perf limits min value as the lowest
currently available frequency for the Littles
6. The SCMI cpufreq driver updates the EM perf limits for Littles
as the currently minimum available frequency.
This allows to properly simulate the energy impact when the EAS
tries to put a task on that domain, even when that PD's util signals
might show lower frequency potentially being used.

That's why I see this as part of the CPUfreq driver feature.

The leakage driver might be better suited for the thermal framework,
since there is more information available there.