linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Valentin Schneider" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Valentin Schneider <valentin.schneider@arm.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched/debug: Don't update sched_domain debug directories before sched_debug_init()
Date: Mon, 28 Jun 2021 13:58:04 -0000	[thread overview]
Message-ID: <162488868483.395.10332851489251840487.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210514095339.12979-1-ionela.voinescu@arm.com>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     459b09b5a3254008b63382bf41a9b36d0b590f57
Gitweb:        https://git.kernel.org/tip/459b09b5a3254008b63382bf41a9b36d0b590f57
Author:        Valentin Schneider <valentin.schneider@arm.com>
AuthorDate:    Tue, 18 May 2021 14:07:25 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 28 Jun 2021 15:42:24 +02:00

sched/debug: Don't update sched_domain debug directories before sched_debug_init()

Since CPU capacity asymmetry can stem purely from maximum frequency
differences (e.g. Pixel 1), a rebuild of the scheduler topology can be
issued upon loading cpufreq, see:

  arch_topology.c::init_cpu_capacity_callback()

Turns out that if this rebuild happens *before* sched_debug_init() is
run (which is a late initcall), we end up messing up the sched_domain debug
directory: passing a NULL parent to debugfs_create_dir() ends up creating
the directory at the debugfs root, which in this case creates
/sys/kernel/debug/domains (instead of /sys/kernel/debug/sched/domains).

This currently doesn't happen on asymmetric systems which use cpufreq-scpi
or cpufreq-dt drivers, as those are loaded via
deferred_probe_initcall() (it is also a late initcall, but appears to be
ordered *after* sched_debug_init()).

Ionela has been working on detecting maximum frequency asymmetry via ACPI,
and that actually happens via a *device* initcall, thus before
sched_debug_init(), and causes the aforementionned debugfs mayhem.

One option would be to punt sched_debug_init() down to
fs_initcall_sync(). Preventing update_sched_domain_debugfs() from running
before sched_debug_init() appears to be the safer option.

Fixes: 3b87f136f8fc ("sched,debug: Convert sysctl sched_domains to debugfs")
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: http://lore.kernel.org/r/20210514095339.12979-1-ionela.voinescu@arm.com
---
 kernel/sched/debug.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 0c5ec27..7e08e3d 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -388,6 +388,13 @@ void update_sched_domain_debugfs(void)
 {
 	int cpu, i;
 
+	/*
+	 * This can unfortunately be invoked before sched_debug_init() creates
+	 * the debug directory. Don't touch sd_sysctl_cpus until then.
+	 */
+	if (!debugfs_sched)
+		return;
+
 	if (!cpumask_available(sd_sysctl_cpus)) {
 		if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL))
 			return;

      parent reply	other threads:[~2021-06-28 13:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  9:53 [PATCH 0/3] arch_topology, ACPI: populate cpu capacity from CPPC Ionela Voinescu
2021-05-14  9:53 ` [PATCH 1/3] x86, ACPI: rename init_freq_invariance_cppc to arch_init_invariance_cppc Ionela Voinescu
2021-05-14  9:53 ` [PATCH 2/3] arch_topology: obtain cpu capacity using information from CPPC Ionela Voinescu
2021-05-14 16:16   ` Dietmar Eggemann
2021-05-19  9:46     ` Ionela Voinescu
2021-05-18 13:12   ` Valentin Schneider
2021-05-14  9:53 ` [PATCH 3/3] arm64, topology: enable use of init_cpu_capacity_cppc() Ionela Voinescu
2021-05-14 10:35   ` Catalin Marinas
2021-05-14 16:17   ` Dietmar Eggemann
2021-05-19  9:48     ` Ionela Voinescu
2021-05-18 13:12 ` [PATCH 0/3] arch_topology, ACPI: populate cpu capacity from CPPC Valentin Schneider
2021-05-19  9:51   ` Ionela Voinescu
2021-06-28 13:58 ` tip-bot2 for Valentin Schneider [this message]

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=162488868483.395.10332851489251840487.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).