[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <581606cc-79ca-4f49-8ae4-cf4a18def0cb@arm.com>
Date: Tue, 19 Dec 2023 08:47:07 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: Xuewen Yan <xuewen.yan94@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
rafael@...nel.org, dietmar.eggemann@....com, rui.zhang@...el.com,
amit.kucheria@...durent.com, amit.kachhap@...il.com,
daniel.lezcano@...aro.org, viresh.kumar@...aro.org, len.brown@...el.com,
pavel@....cz, mhiramat@...nel.org, qyousef@...alina.io, wvw@...gle.com
Subject: Re: [PATCH v5 23/23] Documentation: EM: Update with runtime
modification design
On 12/19/23 04:42, Xuewen Yan wrote:
> On Wed, Nov 29, 2023 at 7:11 PM Lukasz Luba <lukasz.luba@....com> wrote:
[snip]
>> +
>> + -> drivers/soc/example/example_em_mod.c
>> +
>> + 01 static void foo_get_new_em(struct device *dev)
>> + 02 {
>> + 03 struct em_perf_table __rcu *runtime_table;
>> + 04 struct em_perf_state *table, *new_table;
>> + 05 struct em_perf_domain *pd;
>> + 06 unsigned long freq;
>> + 07 int i, ret;
>> + 08
>> + 09 pd = em_pd_get(dev);
>> + 10 if (!pd)
>> + 11 return;
>> + 12
>> + 13 runtime_table = em_allocate_table(pd);
>> + 14 if (!runtime_table)
>> + 15 return;
>> + 16
>> + 17 new_table = runtime_table->state;
>> + 18
>> + 19 table = em_get_table(pd);
>> + 20 for (i = 0; i < pd->nr_perf_states; i++) {
>> + 21 freq = table[i].frequency;
>> + 22 foo_get_power_perf_values(dev, freq, &new_table[i]);
>> + 23 }
>> + 24 em_put_table();
>> + 25
>> + 26 /* Calculate 'cost' values for EAS */
>> + 27 ret = em_dev_compute_costs(dev, table, pd->nr_perf_states);
>> + 28 if (ret) {
>> + 29 dev_warn(dev, "EM: compute costs failed %d\n", ret);
>> + 30 em_free_table(runtime_table);
>> + 31 return;
>> + 32 }
>> + 33
>> + 34 ret = em_dev_update_perf_domain(dev, runtime_table);
>> + 35 if (ret) {
>> + 36 dev_warn(dev, "EM: update failed %d\n", ret);
>> + 37 em_free_table(runtime_table);
>> + 38 return;
>> + 39 }
>> + 40
>> + 41 ctx->runtime_table = runtime_table;
>
> Because here is ctx, maybe the foo_get_new_em(struct device *dev)
> shoule be foo_get_new_em(struct foo_context *ctx)?
Make sense, I will change that bit. Thanks!
Powered by blists - more mailing lists