From 3e84c18a26d97eb8650f1ea7bfa95632ec62715a Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Tue, 7 Aug 2012 11:31:32 -0700 Subject: [PATCH] CHROMIUM: timer: add debug_msleep warnings for long sleeps I've carried a local patch to WARN_ON() long sleeps in the past, but I think it makes sense to just check in a slightly cleaned up version (i.e. this) that allows boot-time selection of the level to warn for. BUG=none TEST=edit config.txt, add timer.debug_msleep=100, boot, watch it pop a few times in dmesg. Change-Id: Ibb79dfc1dd7a08b12a14af314c593a985603f5a6 Signed-off-by: Olof Johansson Reviewed-on: https://gerrit.chromium.org/gerrit/29424 Reviewed-by: Sameer Nanda --- kernel/timer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/timer.c b/kernel/timer.c index a297ffcf888e..761fb83d8988 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -1790,6 +1791,9 @@ void __init init_timers(void) open_softirq(TIMER_SOFTIRQ, run_timer_softirq); } +static int debug_msleep; +module_param(debug_msleep, int, 0); + /** * msleep - sleep safely even with waitqueue interruptions * @msecs: Time in milliseconds to sleep for @@ -1798,6 +1802,9 @@ void msleep(unsigned int msecs) { unsigned long timeout = msecs_to_jiffies(msecs) + 1; + if (debug_msleep && msecs >= debug_msleep) + WARN(1, "Long sleep detected (%d msec)\n", msecs); + while (timeout) timeout = schedule_timeout_uninterruptible(timeout); } -- 2.20.1