From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: "Arve Hjønnevåg" <arve@android.com>,
"Ingo Molnar" <mingo@elte.hu>,
"Peter Zijlstra" <peterz@infradead.org>,
"John Stultz" <john.stultz@linaro.org>
Subject: [PATCH 1/5] sched: Enable might_sleep before initializing drivers.
Date: Fri, 19 Nov 2010 18:08:50 -0800 [thread overview]
Message-ID: <1290218934-8544-2-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1290218934-8544-1-git-send-email-john.stultz@linaro.org>
From: Arve Hjønnevåg <arve@android.com>
This allows detection of init bugs in built-in drivers.
CC: Ingo Molnar <mingo@elte.hu>
CC: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
kernel/sched.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index aa14a56..0b58415 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8104,13 +8104,24 @@ static inline int preempt_count_equals(int preempt_offset)
return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
}
+static int __might_sleep_init_called;
+int __init __might_sleep_init(void)
+{
+ __might_sleep_init_called = 1;
+ return 0;
+}
+early_initcall(__might_sleep_init);
+
void __might_sleep(const char *file, int line, int preempt_offset)
{
#ifdef in_atomic
static unsigned long prev_jiffy; /* ratelimiting */
if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
- system_state != SYSTEM_RUNNING || oops_in_progress)
+ oops_in_progress)
+ return;
+ if (system_state != SYSTEM_RUNNING &&
+ (!__might_sleep_init_called || system_state != SYSTEM_BOOTING))
return;
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
return;
--
1.7.3.2.146.gca209
next prev parent reply other threads:[~2010-11-20 2:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-20 2:08 [PATCH 0/5] [RFC] Trivial scheduler related Android patches John Stultz
2010-11-20 2:08 ` John Stultz [this message]
2010-11-20 10:42 ` [PATCH 1/5] sched: Enable might_sleep before initializing drivers Peter Zijlstra
2010-11-20 2:08 ` [PATCH 2/5] sched: make task dump print all 15 chars of proc comm John Stultz
2010-11-23 10:21 ` [tip:sched/core] sched: Make " tip-bot for Erik Gilling
2010-11-20 2:08 ` [PATCH 3/5] scheduler: cpuacct: Enable platform hooks to track cpuusage for CPU frequencies John Stultz
2010-11-20 10:48 ` Peter Zijlstra
2010-11-22 5:51 ` Florian Mickler
2010-11-22 10:43 ` Peter Zijlstra
2010-11-22 12:23 ` Florian Mickler
2010-11-23 2:05 ` Mike Chan
2010-11-23 11:35 ` Peter Zijlstra
2010-11-20 2:08 ` [PATCH 4/5] scheduler: cpuacct: Enable platform callbacks for cpuacct power tracking John Stultz
2010-11-20 2:08 ` [PATCH 5/5] sched: use the old min_vruntime when normalizing on dequeue John Stultz
2010-11-20 10:55 ` Peter Zijlstra
2010-11-20 12:33 ` 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=1290218934-8544-2-git-send-email-john.stultz@linaro.org \
--to=john.stultz@linaro.org \
--cc=arve@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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.