summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChangwoo Min <changwoo@igalia.com>2025-10-21 01:09:05 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2025-10-22 22:44:37 +0300
commitcbe5aeedecc72314c3a8fd0d41d9b270f576aee1 (patch)
treea117759a2c8c1082ab89d8204ddbe5c38023beb7 /include
parent211ddde0823f1442e4ad052a2f30f050145ccada (diff)
downloadlinux-cbe5aeedecc72314c3a8fd0d41d9b270f576aee1.tar.xz
PM: EM: Assign a unique ID when creating a performance domain
It is necessary to refer to a specific performance domain from a userspace. For example, the energy model of a particular performance domain is updated. To this end, assign a unique ID to each performance domain to address it, and manage them in a global linked list to look up a specific one by matching ID. IDA is used for ID assignment, and the mutex is used to protect the global list from concurrent access. Note that the mutex (em_pd_list_mutex) is not supposed to hold while holding em_pd_mutex to avoid ABBA deadlock. Signed-off-by: Changwoo Min <changwoo@igalia.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20251020220914.320832-2-changwoo@igalia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/energy_model.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 61d50571ad88..43aa6153dc57 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -54,6 +54,8 @@ struct em_perf_table {
/**
* struct em_perf_domain - Performance domain
* @em_table: Pointer to the runtime modifiable em_perf_table
+ * @node: node in em_pd_list (in energy_model.c)
+ * @id: A unique ID number for each performance domain
* @nr_perf_states: Number of performance states
* @min_perf_state: Minimum allowed Performance State index
* @max_perf_state: Maximum allowed Performance State index
@@ -71,6 +73,8 @@ struct em_perf_table {
*/
struct em_perf_domain {
struct em_perf_table __rcu *em_table;
+ struct list_head node;
+ int id;
int nr_perf_states;
int min_perf_state;
int max_perf_state;