diff options
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/clockevents.c | 14 | ||||
| -rw-r--r-- | kernel/time/clocksource.c | 20 | ||||
| -rw-r--r-- | kernel/time/tick-broadcast.c | 2 | ||||
| -rw-r--r-- | kernel/time/tick-oneshot.c | 17 | ||||
| -rw-r--r-- | kernel/time/tick-sched.c | 7 |
5 files changed, 55 insertions, 5 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index d13be216a790..1ad6dd461119 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/notifier.h> | 18 | #include <linux/notifier.h> |
| 19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
| 20 | #include <linux/sysdev.h> | 20 | #include <linux/sysdev.h> |
| 21 | #include <linux/tick.h> | ||
| 21 | 22 | ||
| 22 | /* The registered clock event devices */ | 23 | /* The registered clock event devices */ |
| 23 | static LIST_HEAD(clockevent_devices); | 24 | static LIST_HEAD(clockevent_devices); |
| @@ -54,6 +55,7 @@ unsigned long clockevent_delta2ns(unsigned long latch, | |||
| 54 | 55 | ||
| 55 | return (unsigned long) clc; | 56 | return (unsigned long) clc; |
| 56 | } | 57 | } |
| 58 | EXPORT_SYMBOL_GPL(clockevent_delta2ns); | ||
| 57 | 59 | ||
| 58 | /** | 60 | /** |
| 59 | * clockevents_set_mode - set the operating mode of a clock event device | 61 | * clockevents_set_mode - set the operating mode of a clock event device |
| @@ -187,6 +189,7 @@ void clockevents_register_device(struct clock_event_device *dev) | |||
| 187 | 189 | ||
| 188 | spin_unlock(&clockevents_lock); | 190 | spin_unlock(&clockevents_lock); |
| 189 | } | 191 | } |
| 192 | EXPORT_SYMBOL_GPL(clockevents_register_device); | ||
| 190 | 193 | ||
| 191 | /* | 194 | /* |
| 192 | * Noop handler when we shut down an event device | 195 | * Noop handler when we shut down an event device |
| @@ -251,4 +254,15 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
| 251 | spin_unlock(&clockevents_lock); | 254 | spin_unlock(&clockevents_lock); |
| 252 | } | 255 | } |
| 253 | EXPORT_SYMBOL_GPL(clockevents_notify); | 256 | EXPORT_SYMBOL_GPL(clockevents_notify); |
| 257 | |||
| 258 | ktime_t clockevents_get_next_event(int cpu) | ||
| 259 | { | ||
| 260 | struct tick_device *td; | ||
| 261 | struct clock_event_device *dev; | ||
| 262 | |||
| 263 | td = &per_cpu(tick_cpu_device, cpu); | ||
| 264 | dev = td->evtdev; | ||
| 265 | |||
| 266 | return dev->next_event; | ||
| 267 | } | ||
| 254 | #endif | 268 | #endif |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 80189f6f1c5a..592bf584d1d2 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -509,6 +509,18 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, | |||
| 509 | } | 509 | } |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | /* | ||
| 513 | * Check to make sure we don't switch to a non-highres capable | ||
| 514 | * clocksource if the tick code is in oneshot mode (highres or nohz) | ||
| 515 | */ | ||
| 516 | if (tick_oneshot_mode_active() && | ||
| 517 | !(ovr->flags & CLOCK_SOURCE_VALID_FOR_HRES)) { | ||
| 518 | printk(KERN_WARNING "%s clocksource is not HRT compatible. " | ||
| 519 | "Cannot switch while in HRT/NOHZ mode\n", ovr->name); | ||
| 520 | ovr = NULL; | ||
| 521 | override_name[0] = 0; | ||
| 522 | } | ||
| 523 | |||
| 512 | /* Reselect, when the override name has changed */ | 524 | /* Reselect, when the override name has changed */ |
| 513 | if (ovr != clocksource_override) { | 525 | if (ovr != clocksource_override) { |
| 514 | clocksource_override = ovr; | 526 | clocksource_override = ovr; |
| @@ -537,7 +549,13 @@ sysfs_show_available_clocksources(struct sys_device *dev, | |||
| 537 | 549 | ||
| 538 | spin_lock_irq(&clocksource_lock); | 550 | spin_lock_irq(&clocksource_lock); |
| 539 | list_for_each_entry(src, &clocksource_list, list) { | 551 | list_for_each_entry(src, &clocksource_list, list) { |
| 540 | count += snprintf(buf + count, | 552 | /* |
| 553 | * Don't show non-HRES clocksource if the tick code is | ||
| 554 | * in one shot mode (highres=on or nohz=on) | ||
| 555 | */ | ||
| 556 | if (!tick_oneshot_mode_active() || | ||
| 557 | (src->flags & CLOCK_SOURCE_VALID_FOR_HRES)) | ||
| 558 | count += snprintf(buf + count, | ||
| 541 | max((ssize_t)PAGE_SIZE - count, (ssize_t)0), | 559 | max((ssize_t)PAGE_SIZE - count, (ssize_t)0), |
| 542 | "%s ", src->name); | 560 | "%s ", src->name); |
| 543 | } | 561 | } |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 118a3b3b3f9a..877dbedc3118 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | * timer stops in C3 state. | 27 | * timer stops in C3 state. |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | struct tick_device tick_broadcast_device; | 30 | static struct tick_device tick_broadcast_device; |
| 31 | /* FIXME: Use cpumask_var_t. */ | 31 | /* FIXME: Use cpumask_var_t. */ |
| 32 | static DECLARE_BITMAP(tick_broadcast_mask, NR_CPUS); | 32 | static DECLARE_BITMAP(tick_broadcast_mask, NR_CPUS); |
| 33 | static DECLARE_BITMAP(tmpmask, NR_CPUS); | 33 | static DECLARE_BITMAP(tmpmask, NR_CPUS); |
diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 2e8de678e767..a96c0e2b89cf 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c | |||
| @@ -128,6 +128,23 @@ int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)) | |||
| 128 | return 0; | 128 | return 0; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | /** | ||
| 132 | * tick_check_oneshot_mode - check whether the system is in oneshot mode | ||
| 133 | * | ||
| 134 | * returns 1 when either nohz or highres are enabled. otherwise 0. | ||
| 135 | */ | ||
| 136 | int tick_oneshot_mode_active(void) | ||
| 137 | { | ||
| 138 | unsigned long flags; | ||
| 139 | int ret; | ||
| 140 | |||
| 141 | local_irq_save(flags); | ||
| 142 | ret = __get_cpu_var(tick_cpu_device).mode == TICKDEV_MODE_ONESHOT; | ||
| 143 | local_irq_restore(flags); | ||
| 144 | |||
| 145 | return ret; | ||
| 146 | } | ||
| 147 | |||
| 131 | #ifdef CONFIG_HIGH_RES_TIMERS | 148 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 132 | /** | 149 | /** |
| 133 | * tick_init_highres - switch to high resolution mode | 150 | * tick_init_highres - switch to high resolution mode |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index d3f1ef4d5cbe..2aff39c6f10c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
| @@ -349,7 +349,7 @@ void tick_nohz_stop_sched_tick(int inidle) | |||
| 349 | 349 | ||
| 350 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { | 350 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
| 351 | hrtimer_start(&ts->sched_timer, expires, | 351 | hrtimer_start(&ts->sched_timer, expires, |
| 352 | HRTIMER_MODE_ABS); | 352 | HRTIMER_MODE_ABS_PINNED); |
| 353 | /* Check, if the timer was already in the past */ | 353 | /* Check, if the timer was already in the past */ |
| 354 | if (hrtimer_active(&ts->sched_timer)) | 354 | if (hrtimer_active(&ts->sched_timer)) |
| 355 | goto out; | 355 | goto out; |
| @@ -395,7 +395,7 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now) | |||
| 395 | 395 | ||
| 396 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { | 396 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
| 397 | hrtimer_start_expires(&ts->sched_timer, | 397 | hrtimer_start_expires(&ts->sched_timer, |
| 398 | HRTIMER_MODE_ABS); | 398 | HRTIMER_MODE_ABS_PINNED); |
| 399 | /* Check, if the timer was already in the past */ | 399 | /* Check, if the timer was already in the past */ |
| 400 | if (hrtimer_active(&ts->sched_timer)) | 400 | if (hrtimer_active(&ts->sched_timer)) |
| 401 | break; | 401 | break; |
| @@ -698,7 +698,8 @@ void tick_setup_sched_timer(void) | |||
| 698 | 698 | ||
| 699 | for (;;) { | 699 | for (;;) { |
| 700 | hrtimer_forward(&ts->sched_timer, now, tick_period); | 700 | hrtimer_forward(&ts->sched_timer, now, tick_period); |
| 701 | hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS); | 701 | hrtimer_start_expires(&ts->sched_timer, |
| 702 | HRTIMER_MODE_ABS_PINNED); | ||
| 702 | /* Check, if the timer was already in the past */ | 703 | /* Check, if the timer was already in the past */ |
| 703 | if (hrtimer_active(&ts->sched_timer)) | 704 | if (hrtimer_active(&ts->sched_timer)) |
| 704 | break; | 705 | break; |
