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
Subject: [RFC PATCH 3/3] sched/topology: Verify SD_* flags setup when sched_debug is on
Date: Wed, 11 Mar 2020 18:33:20 +0000 [thread overview]
Message-ID: <20200311183320.19186-4-valentin.schneider@arm.com> (raw)
In-Reply-To: <20200311183320.19186-1-valentin.schneider@arm.com>
Now that we have some description of what we expect the flags layout to
be, we can use that to assert at runtime that the actual layout is sane.
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
kernel/sched/topology.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index af30e2198b22..2e9aee29b3a6 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -29,6 +29,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
struct cpumask *groupmask)
{
struct sched_group *group = sd->groups;
+ int flags = sd->flags;
cpumask_clear(groupmask);
@@ -43,6 +44,21 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
printk(KERN_ERR "ERROR: domain->groups does not contain CPU%d\n", cpu);
}
+ for (; flags; flags &= flags - 1) {
+ unsigned int idx = __ffs(flags);
+ unsigned int flag = BIT(idx);
+ unsigned int meta_flags = sd_flag_debug[idx].meta_flags;
+
+ if ((meta_flags & SDF_SHARED_CHILD) && sd->child &&
+ !(sd->child->flags & flag))
+ printk(KERN_ERR "ERROR: flag %s set here but not in child\n",
+ sd_flag_debug[idx].name);
+ else if ((meta_flags & SDF_SHARED_PARENT) && sd->parent &&
+ !(sd->parent->flags & flag))
+ printk(KERN_ERR "ERROR: flag %s set here but not in parent\n",
+ sd_flag_debug[idx].name);
+ }
+
printk(KERN_DEBUG "%*s groups:", level + 1, "");
do {
if (!group) {
--
2.24.0
prev parent reply other threads:[~2020-03-11 18:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 18:33 [RFC PATCH 0/3] sched: Instrument sched domain flags Valentin Schneider
2020-03-11 18:33 ` [RFC PATCH 1/3] sched/topology: Split out SD_* flags declaration to its own file Valentin Schneider
2020-03-23 13:42 ` Morten Rasmussen
2020-03-23 17:10 ` Valentin Schneider
2020-03-24 8:35 ` Morten Rasmussen
2020-03-11 18:33 ` [RFC PATCH 2/3] sched/topology: Define and assign sched_domain flag metadata Valentin Schneider
2020-03-11 18:33 ` 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=20200311183320.19186-4-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=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