mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org,
	vincent.guittot@linaro.org, Dietmar.Eggemann@arm.com,
	morten.rasmussen@arm.com, qperret@qperret.net,
	stable@vger.kernel.org
Subject: [PATCH] sched/topology: Disable sched_asym_cpucapacity on domain destruction
Date: Mon, 14 Oct 2019 12:47:10 +0100	[thread overview]
Message-ID: <20191014114710.22142-1-valentin.schneider@arm.com> (raw)

While the static key is correctly initialized as being disabled, it will
remain forever enabled once turned on. This means that if we start with an
asymmetric system and hotplug out enough CPUs to end up with an SMP system,
the static key will remain set - which is obviously wrong. We should detect
this and turn off things like misfit migration and EAS wakeups.

Having that key enabled should also mandate

  per_cpu(sd_asym_cpucapacity, cpu) != NULL

for all CPUs, but this is obviously not true with the above.

On top of that, sched domain rebuilds first lead to attaching the NULL
domain to the affected CPUs, which means there will be a window where the
static key is set but the sd_asym_cpucapacity shortcut points to NULL even
if asymmetry hasn't been hotplugged out.

Disable the static key when destroying domains, and let
build_sched_domains() (re) enable it as needed.

Cc: <stable@vger.kernel.org>
Fixes: df054e8445a4 ("sched/topology: Add static_key for asymmetric CPU capacity optimizations")
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 kernel/sched/topology.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index b5667a273bf6..c49ae57a0611 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2123,7 +2123,8 @@ static void detach_destroy_domains(const struct cpumask *cpu_map)
 {
 	int i;
 
+	static_branch_disable_cpuslocked(&sched_asym_cpucapacity);
+
 	rcu_read_lock();
 	for_each_cpu(i, cpu_map)
 		cpu_attach_domain(NULL, &def_root_domain, i);
--
2.22.0


             reply	other threads:[~2019-10-14 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 11:47 Valentin Schneider [this message]
2019-10-14 11:52 ` Vincent Guittot
2019-10-14 12:16 ` Quentin Perret
2019-10-14 13:29   ` Vincent Guittot
2019-10-14 13:46     ` Valentin Schneider
2019-10-14 13:52       ` Quentin Perret
2019-10-14 16:03         ` Valentin Schneider
2019-10-15  9:22           ` Dietmar Eggemann
2019-10-15  9:47             ` Valentin Schneider
2019-10-15 11:07             ` Quentin Perret
2019-10-15 12:56               ` Dietmar Eggemann

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=20191014114710.22142-1-valentin.schneider@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=Dietmar.Eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qperret@qperret.net \
    --cc=stable@vger.kernel.org \
    --cc=vincent.guittot@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome