Skip to content

Commit

Permalink
clocksource: fix lock order in the resume path
Browse files Browse the repository at this point in the history
lockdep complains about the lock nesting of clocksource and watchdog lock
in the resume path.

Change the resume marker to a bit operation and remove the lock from this
path.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Thomas Gleixner authored and Linus Torvalds committed May 15, 2007
1 parent 3c46bdc commit 8f89441
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static struct clocksource *watchdog;
static struct timer_list watchdog_timer;
static DEFINE_SPINLOCK(watchdog_lock);
static cycle_t watchdog_last;
static int watchdog_resumed;
static unsigned long watchdog_resumed;

/*
* Interval: 0.5sec Threshold: 0.0625s
Expand Down Expand Up @@ -104,9 +104,7 @@ static void clocksource_watchdog(unsigned long data)

spin_lock(&watchdog_lock);

resumed = watchdog_resumed;
if (unlikely(resumed))
watchdog_resumed = 0;
resumed = test_and_clear_bit(0, &watchdog_resumed);

wdnow = watchdog->read();
wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask);
Expand Down Expand Up @@ -151,9 +149,7 @@ static void clocksource_watchdog(unsigned long data)
}
static void clocksource_resume_watchdog(void)
{
spin_lock(&watchdog_lock);
watchdog_resumed = 1;
spin_unlock(&watchdog_lock);
set_bit(0, &watchdog_resumed);
}

static void clocksource_check_watchdog(struct clocksource *cs)
Expand Down

0 comments on commit 8f89441

Please sign in to comment.