Message ID | 20240117095714.1524808-1-lukasz.luba@arm.com |
---|---|
Headers | show |
Series | Introduce runtime modifiable Energy Model | expand |
On 17/01/2024 09:56, Lukasz Luba wrote: > Fix missing newline for the string long in the error code path. > > Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> > --- > kernel/power/energy_model.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c > index 7b44f5b89fa1..8b9dd4a39f63 100644 > --- a/kernel/power/energy_model.c > +++ b/kernel/power/energy_model.c > @@ -250,7 +250,7 @@ static void em_cpufreq_update_efficiencies(struct device *dev) > > policy = cpufreq_cpu_get(cpumask_first(em_span_cpus(pd))); > if (!policy) { > - dev_warn(dev, "EM: Access to CPUFreq policy failed"); > + dev_warn(dev, "EM: Access to CPUFreq policy failed\n"); > return; > } > Reviewed-by: Hongyan Xia <hongyan.xia2@arm.com>
On 17/01/2024 09:56, Lukasz Luba wrote: > The Energy Model might be updated at runtime and the energy efficiency > for each OPP may change. Thus, there is a need to update also the > cpufreq framework and make it aligned to the new values. In order to > do that, use a first active CPU from the Performance Domain. This is > needed since the first CPU in the cpumask might be offline when we > run this code path. > > Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> > --- > kernel/power/energy_model.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c > index 42486674b834..aa7c89f9e115 100644 > --- a/kernel/power/energy_model.c > +++ b/kernel/power/energy_model.c > @@ -243,12 +243,19 @@ em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table) > struct em_perf_domain *pd = dev->em_pd; > struct cpufreq_policy *policy; > int found = 0; > - int i; > + int i, cpu; > > if (!_is_cpu_device(dev) || !pd) > return; > > - policy = cpufreq_cpu_get(cpumask_first(em_span_cpus(pd))); > + /* Try to get a CPU which is active and in this PD */ > + cpu = cpumask_first_and(em_span_cpus(pd), cpu_active_mask); > + if (cpu >= nr_cpu_ids) { > + dev_warn(dev, "EM: No online CPU for CPUFreq policy\n"); > + return; > + } > + > + policy = cpufreq_cpu_get(cpu); > if (!policy) { > dev_warn(dev, "EM: Access to CPUFreq policy failed\n"); > return; Reviewed-by: Hongyan Xia <hongyan.xia2@arm.com>
Hi Rafael, On 1/17/24 09:56, Lukasz Luba wrote: > Hi all, > > This patch set adds a new feature which allows to modify Energy Model (EM) > power values at runtime. It will allow to better reflect power model of > a recent SoCs and silicon. Different characteristics of the power usage > can be leveraged and thus better decisions made during task placement in EAS. > [snip] > > > Lukasz Luba (23): > PM: EM: Add missing newline for the message log > PM: EM: Extend em_cpufreq_update_efficiencies() argument list > PM: EM: Find first CPU active while updating OPP efficiency > PM: EM: Refactor em_pd_get_efficient_state() to be more flexible > PM: EM: Introduce em_compute_costs() > PM: EM: Check if the get_cost() callback is present in > em_compute_costs() > PM: EM: Split the allocation and initialization of the EM table > PM: EM: Introduce runtime modifiable table > PM: EM: Use runtime modified EM for CPUs energy estimation in EAS > PM: EM: Add functions for memory allocations for new EM tables > PM: EM: Introduce em_dev_update_perf_domain() for EM updates > PM: EM: Add em_perf_state_from_pd() to get performance states table > PM: EM: Add performance field to struct em_perf_state and optimize > PM: EM: Support late CPUs booting and capacity adjustment > PM: EM: Optimize em_cpu_energy() and remove division > powercap/dtpm_cpu: Use new Energy Model interface to get table > powercap/dtpm_devfreq: Use new Energy Model interface to get table > drivers/thermal/cpufreq_cooling: Use new Energy Model interface > drivers/thermal/devfreq_cooling: Use new Energy Model interface > PM: EM: Change debugfs configuration to use runtime EM table data > PM: EM: Remove old table > PM: EM: Add em_dev_compute_costs() > Documentation: EM: Update with runtime modification design > > Documentation/power/energy-model.rst | 183 ++++++++++- > drivers/powercap/dtpm_cpu.c | 39 ++- > drivers/powercap/dtpm_devfreq.c | 34 +- > drivers/thermal/cpufreq_cooling.c | 45 ++- > drivers/thermal/devfreq_cooling.c | 49 ++- > include/linux/energy_model.h | 165 ++++++---- > kernel/power/energy_model.c | 472 +++++++++++++++++++++++---- > 7 files changed, 819 insertions(+), 168 deletions(-) > The patch set went through decent review. If you don't have any issues, I will collect the tags and send the v8 which will be re-based on some recent linux next (or please tell me your preferred branch). Regards, Lukasz
Hi Lukasz, On Wed, Feb 7, 2024 at 10:15 AM Lukasz Luba <lukasz.luba@arm.com> wrote: > > Hi Rafael, > > On 1/17/24 09:56, Lukasz Luba wrote: > > Hi all, > > > > This patch set adds a new feature which allows to modify Energy Model (EM) > > power values at runtime. It will allow to better reflect power model of > > a recent SoCs and silicon. Different characteristics of the power usage > > can be leveraged and thus better decisions made during task placement in EAS. > > > > [snip] > > > > > > > Lukasz Luba (23): > > PM: EM: Add missing newline for the message log > > PM: EM: Extend em_cpufreq_update_efficiencies() argument list > > PM: EM: Find first CPU active while updating OPP efficiency > > PM: EM: Refactor em_pd_get_efficient_state() to be more flexible > > PM: EM: Introduce em_compute_costs() > > PM: EM: Check if the get_cost() callback is present in > > em_compute_costs() > > PM: EM: Split the allocation and initialization of the EM table > > PM: EM: Introduce runtime modifiable table > > PM: EM: Use runtime modified EM for CPUs energy estimation in EAS > > PM: EM: Add functions for memory allocations for new EM tables > > PM: EM: Introduce em_dev_update_perf_domain() for EM updates > > PM: EM: Add em_perf_state_from_pd() to get performance states table > > PM: EM: Add performance field to struct em_perf_state and optimize > > PM: EM: Support late CPUs booting and capacity adjustment > > PM: EM: Optimize em_cpu_energy() and remove division > > powercap/dtpm_cpu: Use new Energy Model interface to get table > > powercap/dtpm_devfreq: Use new Energy Model interface to get table > > drivers/thermal/cpufreq_cooling: Use new Energy Model interface > > drivers/thermal/devfreq_cooling: Use new Energy Model interface > > PM: EM: Change debugfs configuration to use runtime EM table data > > PM: EM: Remove old table > > PM: EM: Add em_dev_compute_costs() > > Documentation: EM: Update with runtime modification design > > > > Documentation/power/energy-model.rst | 183 ++++++++++- > > drivers/powercap/dtpm_cpu.c | 39 ++- > > drivers/powercap/dtpm_devfreq.c | 34 +- > > drivers/thermal/cpufreq_cooling.c | 45 ++- > > drivers/thermal/devfreq_cooling.c | 49 ++- > > include/linux/energy_model.h | 165 ++++++---- > > kernel/power/energy_model.c | 472 +++++++++++++++++++++++---- > > 7 files changed, 819 insertions(+), 168 deletions(-) > > > > The patch set went through decent review. If you don't have any issues, > I will collect the tags and send the v8 which will be re-based on some > recent linux next (or please tell me your preferred branch). Blease base it on 6.8-rc3.
On 2/7/24 10:31, Rafael J. Wysocki wrote: > Hi Lukasz, > > On Wed, Feb 7, 2024 at 10:15 AM Lukasz Luba <lukasz.luba@arm.com> wrote: >> >> Hi Rafael, >> >> On 1/17/24 09:56, Lukasz Luba wrote: >>> Hi all, >>> >>> This patch set adds a new feature which allows to modify Energy Model (EM) >>> power values at runtime. It will allow to better reflect power model of >>> a recent SoCs and silicon. Different characteristics of the power usage >>> can be leveraged and thus better decisions made during task placement in EAS. >>> >> >> [snip] >> >>> >>> >>> Lukasz Luba (23): >>> PM: EM: Add missing newline for the message log >>> PM: EM: Extend em_cpufreq_update_efficiencies() argument list >>> PM: EM: Find first CPU active while updating OPP efficiency >>> PM: EM: Refactor em_pd_get_efficient_state() to be more flexible >>> PM: EM: Introduce em_compute_costs() >>> PM: EM: Check if the get_cost() callback is present in >>> em_compute_costs() >>> PM: EM: Split the allocation and initialization of the EM table >>> PM: EM: Introduce runtime modifiable table >>> PM: EM: Use runtime modified EM for CPUs energy estimation in EAS >>> PM: EM: Add functions for memory allocations for new EM tables >>> PM: EM: Introduce em_dev_update_perf_domain() for EM updates >>> PM: EM: Add em_perf_state_from_pd() to get performance states table >>> PM: EM: Add performance field to struct em_perf_state and optimize >>> PM: EM: Support late CPUs booting and capacity adjustment >>> PM: EM: Optimize em_cpu_energy() and remove division >>> powercap/dtpm_cpu: Use new Energy Model interface to get table >>> powercap/dtpm_devfreq: Use new Energy Model interface to get table >>> drivers/thermal/cpufreq_cooling: Use new Energy Model interface >>> drivers/thermal/devfreq_cooling: Use new Energy Model interface >>> PM: EM: Change debugfs configuration to use runtime EM table data >>> PM: EM: Remove old table >>> PM: EM: Add em_dev_compute_costs() >>> Documentation: EM: Update with runtime modification design >>> >>> Documentation/power/energy-model.rst | 183 ++++++++++- >>> drivers/powercap/dtpm_cpu.c | 39 ++- >>> drivers/powercap/dtpm_devfreq.c | 34 +- >>> drivers/thermal/cpufreq_cooling.c | 45 ++- >>> drivers/thermal/devfreq_cooling.c | 49 ++- >>> include/linux/energy_model.h | 165 ++++++---- >>> kernel/power/energy_model.c | 472 +++++++++++++++++++++++---- >>> 7 files changed, 819 insertions(+), 168 deletions(-) >>> >> >> The patch set went through decent review. If you don't have any issues, >> I will collect the tags and send the v8 which will be re-based on some >> recent linux next (or please tell me your preferred branch). > > Blease base it on 6.8-rc3. OK, thanks