public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Igor Mammedov <imammedo@redhat.com>
Cc: Jiang Liu <liuj97@gmail.com>,
	linux-kernel@vger.kernel.org, mingo@kernel.org, pjt@google.com,
	tglx@linutronix.de, seto.hidetoshi@jp.fujitsu.com
Subject: Re: [PATCH] sched_groups are expected to be circular linked list, make it so right after allocation
Date: Wed, 09 May 2012 14:30:44 +0200	[thread overview]
Message-ID: <1336566644.2527.33.camel@twins> (raw)
In-Reply-To: <1336566096.2527.30.camel@twins>

On Wed, 2012-05-09 at 14:21 +0200, Peter Zijlstra wrote:
> Does something like the below give any clues as to how we got there?

New version that checks we include the right cpu in build_sched_domain()
too.. on a related note, we should add a printk-%p modifier for cpulist,
this cpulist_scnprintf() stuff gets annoying.

---
 include/linux/sched.h |    9 +++++++++
 kernel/sched/core.c   |   26 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 714fa99..416aad9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1041,6 +1041,15 @@ struct sched_domain {
 	unsigned long span[0];
 };
 
+static inline char *sched_domain_name(struct sched_domain *sd)
+{
+#ifdef CONFIG_SCHED_DEBUG
+	return sd->name;
+#else
+	return "";
+#endif
+}
+
 static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
 {
 	return to_cpumask(sd->span);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7b77e3b..2884134 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6072,6 +6072,22 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)
 		last = sg;
 		last->next = first;
 	}
+	if (!groups) {
+		char str[256];
+
+		printk(KERN_ERR "sched: Topology is hosed for CPU-%d!!\n", cpu);
+		cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
+		printk(KERN_ERR "sched: domain: %s %s\n", sched_domain_name(sd), str);
+		
+		sg = first;
+		if (sg) do {
+			cpulist_scnprintf(str, sizeof(str), sched_group_cpus(sg));
+			printk(KERN_ERR "sched:  group: %s\n", str);
+			sg = sg->next;
+		} while (sg != first);
+
+		BUG();
+	}
 	sd->groups = groups;
 
 	return 0;
@@ -6440,6 +6456,16 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
 
 	set_domain_attribute(sd, attr);
 	cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
+	if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
+		char str[256];
+		cpulist_scnprintf(str, sizeof(str), cpu_map);
+		printk(KERN_ERR "sched: Bonkers domain doesn't include its own cpu: %d %s\n",
+				cpu, str);
+		cpulist_scnprintf(str, sizeof(str), tl->mask(cpu));
+		printk(KERN_ERR "sched: Bonkers domain doesn't include its own cpu: %d %s\n",
+				cpu, str);
+		WARN(1);
+	}
 	if (child) {
 		sd->level = child->level + 1;
 		sched_domain_level_max = max(sched_domain_level_max, sd->level);


  parent reply	other threads:[~2012-05-09 12:30 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 10:38 [PATCH] sched_groups are expected to be circular linked list, make it so right after allocation Igor Mammedov
2012-05-09 10:21 ` Jiang Liu
2012-05-09 11:44   ` Igor Mammedov
2012-05-09 11:52     ` Peter Zijlstra
2012-05-09 11:58       ` Igor Mammedov
2012-05-09 12:21         ` Peter Zijlstra
2012-05-09 12:22           ` Peter Zijlstra
2012-05-09 12:35             ` Igor Mammedov
2012-05-09 12:30           ` Peter Zijlstra [this message]
2012-05-09 13:27             ` [RFC][PATCH] printk: Add %pb to print bitmaps Peter Zijlstra
2012-05-09 13:29               ` Peter Zijlstra
2012-05-09 13:36               ` Ingo Molnar
2012-05-09 13:44                 ` Peter Zijlstra
2012-05-09 13:59                   ` Peter Zijlstra
2012-05-09 14:15                     ` Ingo Molnar
2012-05-09 14:24                       ` Peter Zijlstra
2012-05-09 15:32                       ` Peter Zijlstra
2012-05-09 15:41                         ` Ingo Molnar
2012-05-09 16:06                           ` Peter Zijlstra
2012-05-09 16:39                             ` Joe Perches
2012-05-09 17:22                               ` Ingo Molnar
2012-05-09 17:24                             ` Ingo Molnar
2012-05-09 17:25                               ` Peter Zijlstra
2012-05-09 17:31                                 ` Ingo Molnar
2012-05-09 14:19                     ` Joe Perches
2012-05-09 15:34                       ` Ingo Molnar
2012-05-09 17:15               ` Linus Torvalds
2012-05-09 17:22                 ` Peter Zijlstra
2012-05-09 17:26                   ` Ingo Molnar
2012-05-09 17:30                     ` Peter Zijlstra
2012-05-09 19:07               ` Andrew Morton
2012-05-09 20:58                 ` Peter Zijlstra
2012-05-10  7:45                   ` Ingo Molnar
2012-05-10 13:26             ` [PATCH] sched_groups are expected to be circular linked list, make it so right after allocation Igor Mammedov
2012-05-10 13:45               ` Peter Zijlstra
2012-05-10 17:01                 ` Igor Mammedov
2012-05-10 17:33                   ` Peter Zijlstra
2012-05-09 10:35 ` [tip:sched/urgent] sched: Fix KVM and ia64 boot crash due to sched_groups circular linked list assumption tip-bot for Igor Mammedov
2012-05-09 11:41 ` [PATCH] sched_groups are expected to be circular linked list, make it so right after allocation Peter Zijlstra

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=1336566644.2527.33.camel@twins \
    --to=peterz@infradead.org \
    --cc=imammedo@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=mingo@kernel.org \
    --cc=pjt@google.com \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=tglx@linutronix.de \
    /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