diff options
author | Paul Mackerras <paulus@samba.org> | 2008-01-30 19:25:51 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-30 19:25:51 -0500 |
commit | bd45ac0c5daae35e7c71138172e63df5cf644cf6 (patch) | |
tree | 5eb5a599bf6a9d7a8a34e802db932aa9e9555de4 /kernel/time/clocksource.c | |
parent | 4eece4ccf997c0e6d8fdad3d842e37b16b8d705f (diff) | |
parent | 5bdeae46be6dfe9efa44a548bd622af325f4bdb4 (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'kernel/time/clocksource.c')
-rw-r--r-- | kernel/time/clocksource.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index c8a9d13874df..6e9259a5d501 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -142,8 +142,13 @@ static void clocksource_watchdog(unsigned long data) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | if (!list_empty(&watchdog_list)) { | 144 | if (!list_empty(&watchdog_list)) { |
145 | __mod_timer(&watchdog_timer, | 145 | /* Cycle through CPUs to check if the CPUs stay synchronized to |
146 | watchdog_timer.expires + WATCHDOG_INTERVAL); | 146 | * each other. */ |
147 | int next_cpu = next_cpu(raw_smp_processor_id(), cpu_online_map); | ||
148 | if (next_cpu >= NR_CPUS) | ||
149 | next_cpu = first_cpu(cpu_online_map); | ||
150 | watchdog_timer.expires += WATCHDOG_INTERVAL; | ||
151 | add_timer_on(&watchdog_timer, next_cpu); | ||
147 | } | 152 | } |
148 | spin_unlock(&watchdog_lock); | 153 | spin_unlock(&watchdog_lock); |
149 | } | 154 | } |
@@ -165,7 +170,7 @@ static void clocksource_check_watchdog(struct clocksource *cs) | |||
165 | if (!started && watchdog) { | 170 | if (!started && watchdog) { |
166 | watchdog_last = watchdog->read(); | 171 | watchdog_last = watchdog->read(); |
167 | watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; | 172 | watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; |
168 | add_timer(&watchdog_timer); | 173 | add_timer_on(&watchdog_timer, first_cpu(cpu_online_map)); |
169 | } | 174 | } |
170 | } else { | 175 | } else { |
171 | if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) | 176 | if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) |
@@ -175,7 +180,7 @@ static void clocksource_check_watchdog(struct clocksource *cs) | |||
175 | if (watchdog) | 180 | if (watchdog) |
176 | del_timer(&watchdog_timer); | 181 | del_timer(&watchdog_timer); |
177 | watchdog = cs; | 182 | watchdog = cs; |
178 | init_timer(&watchdog_timer); | 183 | init_timer_deferrable(&watchdog_timer); |
179 | watchdog_timer.function = clocksource_watchdog; | 184 | watchdog_timer.function = clocksource_watchdog; |
180 | 185 | ||
181 | /* Reset watchdog cycles */ | 186 | /* Reset watchdog cycles */ |
@@ -186,7 +191,8 @@ static void clocksource_check_watchdog(struct clocksource *cs) | |||
186 | watchdog_last = watchdog->read(); | 191 | watchdog_last = watchdog->read(); |
187 | watchdog_timer.expires = | 192 | watchdog_timer.expires = |
188 | jiffies + WATCHDOG_INTERVAL; | 193 | jiffies + WATCHDOG_INTERVAL; |
189 | add_timer(&watchdog_timer); | 194 | add_timer_on(&watchdog_timer, |
195 | first_cpu(cpu_online_map)); | ||
190 | } | 196 | } |
191 | } | 197 | } |
192 | } | 198 | } |
@@ -331,6 +337,21 @@ void clocksource_change_rating(struct clocksource *cs, int rating) | |||
331 | spin_unlock_irqrestore(&clocksource_lock, flags); | 337 | spin_unlock_irqrestore(&clocksource_lock, flags); |
332 | } | 338 | } |
333 | 339 | ||
340 | /** | ||
341 | * clocksource_unregister - remove a registered clocksource | ||
342 | */ | ||
343 | void clocksource_unregister(struct clocksource *cs) | ||
344 | { | ||
345 | unsigned long flags; | ||
346 | |||
347 | spin_lock_irqsave(&clocksource_lock, flags); | ||
348 | list_del(&cs->list); | ||
349 | if (clocksource_override == cs) | ||
350 | clocksource_override = NULL; | ||
351 | next_clocksource = select_clocksource(); | ||
352 | spin_unlock_irqrestore(&clocksource_lock, flags); | ||
353 | } | ||
354 | |||
334 | #ifdef CONFIG_SYSFS | 355 | #ifdef CONFIG_SYSFS |
335 | /** | 356 | /** |
336 | * sysfs_show_current_clocksources - sysfs interface for current clocksource | 357 | * sysfs_show_current_clocksources - sysfs interface for current clocksource |
@@ -441,7 +462,7 @@ static SYSDEV_ATTR(available_clocksource, 0600, | |||
441 | sysfs_show_available_clocksources, NULL); | 462 | sysfs_show_available_clocksources, NULL); |
442 | 463 | ||
443 | static struct sysdev_class clocksource_sysclass = { | 464 | static struct sysdev_class clocksource_sysclass = { |
444 | set_kset_name("clocksource"), | 465 | .name = "clocksource", |
445 | }; | 466 | }; |
446 | 467 | ||
447 | static struct sys_device device_clocksource = { | 468 | static struct sys_device device_clocksource = { |