All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Donnefort <vincent.donnefort@arm.com>
To: peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org,
	vincent.guittot@linaro.org, qperret@google.com
Cc: linux-pm@vger.kernel.org, ionela.voinescu@arm.com,
	lukasz.luba@arm.com, dietmar.eggemann@arm.com, mka@chromium.org,
	Vincent Donnefort <vincent.donnefort@arm.com>
Subject: [PATCH v6 3/7] PM / EM: Extend em_perf_domain with a flag field
Date: Tue, 31 Aug 2021 11:24:09 +0100	[thread overview]
Message-ID: <1630405453-275784-4-git-send-email-vincent.donnefort@arm.com> (raw)
In-Reply-To: <1630405453-275784-1-git-send-email-vincent.donnefort@arm.com>

Merge the current "milliwatts" option into a "flag" field. This intends to
prepare the extension of this structure for inefficient states support in
the Energy Model.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 629f5f63a7d7..ac2f7d0ab946 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -40,8 +40,7 @@ struct em_perf_state {
  * em_perf_domain - Performance domain
  * @table:		List of performance states, in ascending order
  * @nr_perf_states:	Number of performance states
- * @milliwatts:		Flag indicating the power values are in milli-Watts
- *			or some other scale.
+ * @flags:		See "em_perf_domain flags"
  * @cpus:		Cpumask covering the CPUs of the domain. It's here
  *			for performance reasons to avoid potential cache
  *			misses during energy calculations in the scheduler
@@ -56,10 +55,18 @@ struct em_perf_state {
 struct em_perf_domain {
 	struct em_perf_state *table;
 	int nr_perf_states;
-	int milliwatts;
+	unsigned long flags;
 	unsigned long cpus[];
 };
 
+/*
+ *  em_perf_domain flags:
+ *
+ *  EM_PERF_DOMAIN_MILLIWATTS: The power values are in milli-Watts or some
+ *  other scale.
+ */
+#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)
+
 #define em_span_cpus(em) (to_cpumask((em)->cpus))
 
 #ifdef CONFIG_ENERGY_MODEL
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 6d8438347535..3a7d1573b214 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -56,7 +56,8 @@ DEFINE_SHOW_ATTRIBUTE(em_debug_cpus);
 static int em_debug_units_show(struct seq_file *s, void *unused)
 {
 	struct em_perf_domain *pd = s->private;
-	char *units = pd->milliwatts ? "milliWatts" : "bogoWatts";
+	char *units = (pd->flags & EM_PERF_DOMAIN_MILLIWATTS) ?
+		"milliWatts" : "bogoWatts";
 
 	seq_printf(s, "%s\n", units);
 
@@ -330,7 +331,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
 	if (ret)
 		goto unlock;
 
-	dev->em_pd->milliwatts = milliwatts;
+	if (milliwatts)
+		dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS;
 
 	em_debug_create_pd(dev);
 	dev_info(dev, "EM: created perf domain\n");
-- 
2.7.4


  parent reply	other threads:[~2021-08-31 10:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 10:24 [PATCH v6 0/7] Inefficient OPPs Vincent Donnefort
2021-08-31 10:24 ` [PATCH v6 1/7] PM / EM: Fix inefficient states detection Vincent Donnefort
2021-08-31 10:24 ` [PATCH v6 2/7] PM / EM: Mark inefficient states Vincent Donnefort
2021-08-31 10:24 ` Vincent Donnefort [this message]
2021-08-31 10:24 ` [PATCH v6 4/7] PM / EM: Allow skipping " Vincent Donnefort
2021-08-31 10:24 ` [PATCH v6 5/7] cpufreq: Add an interface to mark inefficient frequencies Vincent Donnefort
2021-09-01  4:55   ` Viresh Kumar
2021-09-01 17:25   ` Rafael J. Wysocki
2021-08-31 10:24 ` [PATCH v6 6/7] cpufreq: Skip " Vincent Donnefort
2021-09-01  5:30   ` Viresh Kumar
2021-09-01 18:13   ` Rafael J. Wysocki
2021-09-02 10:50     ` Vincent Donnefort
2021-09-02 13:09       ` Rafael J. Wysocki
2021-09-02 13:49         ` Vincent Donnefort
2021-09-03 18:14           ` Rafael J. Wysocki
2021-09-06  8:17             ` Vincent Donnefort
2021-09-06 12:08               ` Rafael J. Wysocki
2021-09-06 12:53                 ` Vincent Donnefort
2021-09-06 15:16                   ` Rafael J. Wysocki
2021-09-06 15:32                     ` Rafael J. Wysocki
2021-09-06 15:38                     ` Vincent Donnefort
2021-09-06 16:04                       ` Rafael J. Wysocki
2021-08-31 10:24 ` [PATCH v6 7/7] PM / EM: Mark inefficiencies in CPUFreq Vincent Donnefort
2021-09-01  5:31   ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1630405453-275784-4-git-send-email-vincent.donnefort@arm.com \
    --to=vincent.donnefort@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=ionela.voinescu@arm.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mka@chromium.org \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.