Re: [PATCH v4 07/18] PM: EM: Refactor struct em_perf_domain and add default_table

From: Lukasz Luba
Date: Fri Sep 29 2023 - 04:45:12 EST




On 9/26/23 19:52, Rafael J. Wysocki wrote:
On Mon, Sep 25, 2023 at 10:11 AM Lukasz Luba <lukasz.luba@xxxxxxx> wrote:

The Energy Model is going to support runtime modifications. Refactor old
implementation which accessed struct em_perf_state and introduce
em_perf_domain::default_table to clean up the design. This new field
will help to better distinguish 2 performance state tables.

Update all drivers or frameworks which used the old field:
em_perf_domain::table and now should use em_perf_domain::default_table.

Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>

[snip]

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 8069f526c9d8..d236e08e80dc 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -36,9 +36,19 @@ struct em_perf_state {
*/
#define EM_PERF_STATE_INEFFICIENT BIT(0)

+/**
+ * struct em_perf_table - Performance states table
+ * @state: List of performance states, in ascending order
+ * @rcu: RCU used for safe access and destruction
+ */
+struct em_perf_table {
+ struct em_perf_state *state;
+ struct rcu_head rcu;

There is no explanation of the role of this rcu_head in the changelog
or anywhere in this patch.

It is also not used as of this patch AFAICS.

It would be better to add it when it actually gets used IMV.

That's a good point. I will introduce this 'rcu' field later.