All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-pm@vger.kernel.org, peterz@infradead.org,
	rjw@rjwysocki.net, viresh.kumar@linaro.org,
	vincent.guittot@linaro.org, qperret@google.com,
	dietmar.eggemann@arm.com, vincent.donnefort@arm.com,
	lukasz.luba@arm.com, Beata.Michalska@arm.com, mingo@redhat.com,
	juri.lelli@redhat.com, rostedt@goodmis.org, segall@google.com,
	mgorman@suse.de, bristot@redhat.com, thara.gopinath@linaro.org,
	amit.kachhap@gmail.com, amitk@kernel.org, rui.zhang@intel.com,
	daniel.lezcano@linaro.org
Subject: [PATCH 1/3] thermal: cpufreq_cooling: Update also offline CPUs per-cpu thermal_pressure
Date: Mon, 14 Jun 2021 20:10:30 +0100	[thread overview]
Message-ID: <20210614191030.22241-1-lukasz.luba@arm.com> (raw)
In-Reply-To: <20210614185815.15136-1-lukasz.luba@arm.com>

The thermal pressure signal gives information to the scheduler about
reduced CPU capacity due to thermal. It is based on a value stored in a
per-cpu 'thermal_pressure' variable. The online CPUs will get the new
value there, while the offline won't. Unfortunately, when the CPU is back
online, the value read from per-cpu variable might be wrong (stale data).
This might affect the scheduler decisions, since it sees the CPU capacity
differently than what is actually available.

Fix it by making sure that all online+offline CPUs would get the proper
value in their per-cpu variable when thermal framework sets capping.

Fixes: f12e4f66ab6a3 ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping")
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/thermal/cpufreq_cooling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index eeb4e4b76c0b..43b1ae8a7789 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -478,7 +478,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
 	ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
 	if (ret >= 0) {
 		cpufreq_cdev->cpufreq_state = state;
-		cpus = cpufreq_cdev->policy->cpus;
+		cpus = cpufreq_cdev->policy->related_cpus;
 		max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus));
 		capacity = frequency * max_capacity;
 		capacity /= cpufreq_cdev->policy->cpuinfo.max_freq;
-- 
2.17.1


  reply	other threads:[~2021-06-14 19:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 18:58 [PATCH v4 0/3] Add allowed CPU capacity knowledge to EAS Lukasz Luba
2021-06-14 19:10 ` Lukasz Luba [this message]
2021-06-18  8:46   ` [tip: sched/core] thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure tip-bot2 for Lukasz Luba
2021-06-14 19:11 ` [PATCH v4 2/3] sched/fair: Take thermal pressure into account while estimating energy Lukasz Luba
2021-06-15 15:31   ` Dietmar Eggemann
2021-06-15 16:09     ` Lukasz Luba
2021-06-16 17:24       ` Dietmar Eggemann
2021-06-16 18:31         ` Lukasz Luba
2021-06-16 19:25         ` Vincent Guittot
2021-06-16 20:22           ` Lukasz Luba
2021-06-18  8:46   ` [tip: sched/core] " tip-bot2 for Lukasz Luba
2021-06-14 19:12 ` [PATCH v4 3/3] sched/cpufreq: Consider reduced CPU capacity in energy calculation Lukasz Luba
2021-06-18  8:46   ` [tip: sched/core] " tip-bot2 for Lukasz Luba
2021-06-16 13:33 ` [PATCH v4 0/3] Add allowed CPU capacity knowledge to EAS Lukasz Luba

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=20210614191030.22241-1-lukasz.luba@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=Beata.Michalska@arm.com \
    --cc=amit.kachhap@gmail.com \
    --cc=amitk@kernel.org \
    --cc=bristot@redhat.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=rui.zhang@intel.com \
    --cc=segall@google.com \
    --cc=thara.gopinath@linaro.org \
    --cc=vincent.donnefort@arm.com \
    --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.