Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163073
b: refs/heads/master
c: 01548f4
h: refs/heads/master
i:
  163071: 16f497a
v: v3
  • Loading branch information
Martin Schwidefsky authored and Thomas Gleixner committed Aug 19, 2009
1 parent f02ce5f commit c01fecd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0981a1b21a03866c8da7f44e35e389c2e0d6061
refs/heads/master: 01548f4d3e8e94caf323a4f664eb347fd34a34ab
19 changes: 16 additions & 3 deletions trunk/kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/module.h>
#include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */
#include <linux/tick.h>
#include <linux/kthread.h>

void timecounter_init(struct timecounter *tc,
const struct cyclecounter *cc,
Expand Down Expand Up @@ -130,7 +131,7 @@ static DEFINE_SPINLOCK(watchdog_lock);
static cycle_t watchdog_last;
static int watchdog_running;

static void clocksource_watchdog_work(struct work_struct *work);
static int clocksource_watchdog_kthread(void *data);
static void __clocksource_change_rating(struct clocksource *cs, int rating);

/*
Expand All @@ -139,6 +140,15 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating);
#define WATCHDOG_INTERVAL (HZ >> 1)
#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)

static void clocksource_watchdog_work(struct work_struct *work)
{
/*
* If kthread_run fails the next watchdog scan over the
* watchdog_list will find the unstable clock again.
*/
kthread_run(clocksource_watchdog_kthread, NULL, "kwatchdog");
}

static void clocksource_unstable(struct clocksource *cs, int64_t delta)
{
printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n",
Expand Down Expand Up @@ -167,8 +177,10 @@ static void clocksource_watchdog(unsigned long data)
list_for_each_entry(cs, &watchdog_list, wd_list) {

/* Clocksource already marked unstable? */
if (cs->flags & CLOCK_SOURCE_UNSTABLE)
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
schedule_work(&watchdog_work);
continue;
}

csnow = cs->read(cs);

Expand Down Expand Up @@ -304,7 +316,7 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
spin_unlock_irqrestore(&watchdog_lock, flags);
}

static void clocksource_watchdog_work(struct work_struct *work)
static int clocksource_watchdog_kthread(void *data)
{
struct clocksource *cs, *tmp;
unsigned long flags;
Expand All @@ -327,6 +339,7 @@ static void clocksource_watchdog_work(struct work_struct *work)
__clocksource_change_rating(cs, 0);
}
mutex_unlock(&clocksource_mutex);
return 0;
}

#else /* CONFIG_CLOCKSOURCE_WATCHDOG */
Expand Down

0 comments on commit c01fecd

Please sign in to comment.