diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-03 21:09:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-03 21:09:13 -0400 |
commit | 5e1b834b27fb2c27cde33a0752425f11d10c0b2d (patch) | |
tree | 055c2c7165dcf0ccd73a273b16ad493ff48823a6 /kernel/time | |
parent | 49deffe0b0e4c2030696c7a6fd680bacf4761069 (diff) | |
parent | b536fd587044af02183b3c02690431b93154f0fa (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner:
"A rather smalish set of updates for timers and timekeeping:
- Two core fixes to prevent potential undefinded behaviour about
which gcc is complaining rightfully.
- A fix to prevent stopping the tick on an (soon) offline CPU so it
can complete the shutdown procedure.
- Wait for clocks to stabilize before making decisions, so a not yet
validated clock is not rejected.
- The usual pile of fixes to the various clocksource drivers.
- Core code typo and include fixlets"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
timekeeping: Include the correct header for errno definitions
clocksource/drivers/ti-32k: Prevent ftrace recursion
clocksource/mips-gic-timer: Stop checking cpu_has_counter
clocksource/mips-gic-timer: Print an error if IRQ setup fails
tick/nohz: Prevent stopping the tick on an offline CPU
clocksource/drivers/oxnas: Add OX820 compatible
clocksource/drivers/timer-atmel-pit: Simplify IRQ handler
clocksource/drivers/timer-atmel-pit: Remove uselesss WARN_ON_ONCE
clocksource/drivers/timer-atmel-pit: Drop at91sam926x_pit_common_init
clocksource/drivers/moxart: Replace panic by pr_err
clocksource/drivers/moxart: Replace setup_irq by request_irq
clocksource/drivers/moxart: Add Aspeed support
clocksource/drivers/moxart: Use struct to hold state
clocksource/drivers/moxart: Refactor enable/disable
time: Avoid undefined behaviour in ktime_add_safe()
time: Avoid undefined behaviour in timespec64_add_safe()
timekeeping: Prints the amounts of time spent during suspend
clocksource: Defer override invalidation unless clock is unstable
hrtimer: Spelling fixes
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/clocksource.c | 15 | ||||
-rw-r--r-- | kernel/time/hrtimer.c | 6 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 7 | ||||
-rw-r--r-- | kernel/time/time.c | 2 | ||||
-rw-r--r-- | kernel/time/timekeeping_debug.c | 2 |
5 files changed, 23 insertions, 9 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 6a5a310a1a53..7e4fad75acaa 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -600,9 +600,18 @@ static void __clocksource_select(bool skipcur) | |||
600 | */ | 600 | */ |
601 | if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) { | 601 | if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) { |
602 | /* Override clocksource cannot be used. */ | 602 | /* Override clocksource cannot be used. */ |
603 | pr_warn("Override clocksource %s is not HRT compatible - cannot switch while in HRT/NOHZ mode\n", | 603 | if (cs->flags & CLOCK_SOURCE_UNSTABLE) { |
604 | cs->name); | 604 | pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/NOHZ mode\n", |
605 | override_name[0] = 0; | 605 | cs->name); |
606 | override_name[0] = 0; | ||
607 | } else { | ||
608 | /* | ||
609 | * The override cannot be currently verified. | ||
610 | * Deferring to let the watchdog check. | ||
611 | */ | ||
612 | pr_info("Override clocksource %s is not currently HRT compatible - deferring\n", | ||
613 | cs->name); | ||
614 | } | ||
606 | } else | 615 | } else |
607 | /* Override clocksource can be used. */ | 616 | /* Override clocksource can be used. */ |
608 | best = cs; | 617 | best = cs; |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 9ba7c820fc23..bb5ec425dfe0 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -307,7 +307,7 @@ EXPORT_SYMBOL_GPL(__ktime_divns); | |||
307 | */ | 307 | */ |
308 | ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs) | 308 | ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs) |
309 | { | 309 | { |
310 | ktime_t res = ktime_add(lhs, rhs); | 310 | ktime_t res = ktime_add_unsafe(lhs, rhs); |
311 | 311 | ||
312 | /* | 312 | /* |
313 | * We use KTIME_SEC_MAX here, the maximum timeout which we can | 313 | * We use KTIME_SEC_MAX here, the maximum timeout which we can |
@@ -703,7 +703,7 @@ static void clock_was_set_work(struct work_struct *work) | |||
703 | static DECLARE_WORK(hrtimer_work, clock_was_set_work); | 703 | static DECLARE_WORK(hrtimer_work, clock_was_set_work); |
704 | 704 | ||
705 | /* | 705 | /* |
706 | * Called from timekeeping and resume code to reprogramm the hrtimer | 706 | * Called from timekeeping and resume code to reprogram the hrtimer |
707 | * interrupt device on all cpus. | 707 | * interrupt device on all cpus. |
708 | */ | 708 | */ |
709 | void clock_was_set_delayed(void) | 709 | void clock_was_set_delayed(void) |
@@ -1241,7 +1241,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base, | |||
1241 | 1241 | ||
1242 | /* | 1242 | /* |
1243 | * Note: We clear the running state after enqueue_hrtimer and | 1243 | * Note: We clear the running state after enqueue_hrtimer and |
1244 | * we do not reprogramm the event hardware. Happens either in | 1244 | * we do not reprogram the event hardware. Happens either in |
1245 | * hrtimer_start_range_ns() or in hrtimer_interrupt() | 1245 | * hrtimer_start_range_ns() or in hrtimer_interrupt() |
1246 | * | 1246 | * |
1247 | * Note: Because we dropped the cpu_base->lock above, | 1247 | * Note: Because we dropped the cpu_base->lock above, |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 2ec7c00228f3..3bcb61b52f6c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -186,10 +186,13 @@ static bool check_tick_dependency(atomic_t *dep) | |||
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | 188 | ||
189 | static bool can_stop_full_tick(struct tick_sched *ts) | 189 | static bool can_stop_full_tick(int cpu, struct tick_sched *ts) |
190 | { | 190 | { |
191 | WARN_ON_ONCE(!irqs_disabled()); | 191 | WARN_ON_ONCE(!irqs_disabled()); |
192 | 192 | ||
193 | if (unlikely(!cpu_online(cpu))) | ||
194 | return false; | ||
195 | |||
193 | if (check_tick_dependency(&tick_dep_mask)) | 196 | if (check_tick_dependency(&tick_dep_mask)) |
194 | return false; | 197 | return false; |
195 | 198 | ||
@@ -843,7 +846,7 @@ static void tick_nohz_full_update_tick(struct tick_sched *ts) | |||
843 | if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) | 846 | if (!ts->tick_stopped && ts->nohz_mode == NOHZ_MODE_INACTIVE) |
844 | return; | 847 | return; |
845 | 848 | ||
846 | if (can_stop_full_tick(ts)) | 849 | if (can_stop_full_tick(cpu, ts)) |
847 | tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); | 850 | tick_nohz_stop_sched_tick(ts, ktime_get(), cpu); |
848 | else if (ts->tick_stopped) | 851 | else if (ts->tick_stopped) |
849 | tick_nohz_restart_sched_tick(ts, ktime_get()); | 852 | tick_nohz_restart_sched_tick(ts, ktime_get()); |
diff --git a/kernel/time/time.c b/kernel/time/time.c index 667b9335f5d6..bd62fb8e8e77 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -780,7 +780,7 @@ struct timespec64 timespec64_add_safe(const struct timespec64 lhs, | |||
780 | { | 780 | { |
781 | struct timespec64 res; | 781 | struct timespec64 res; |
782 | 782 | ||
783 | set_normalized_timespec64(&res, lhs.tv_sec + rhs.tv_sec, | 783 | set_normalized_timespec64(&res, (timeu64_t) lhs.tv_sec + rhs.tv_sec, |
784 | lhs.tv_nsec + rhs.tv_nsec); | 784 | lhs.tv_nsec + rhs.tv_nsec); |
785 | 785 | ||
786 | if (unlikely(res.tv_sec < lhs.tv_sec || res.tv_sec < rhs.tv_sec)) { | 786 | if (unlikely(res.tv_sec < lhs.tv_sec || res.tv_sec < rhs.tv_sec)) { |
diff --git a/kernel/time/timekeeping_debug.c b/kernel/time/timekeeping_debug.c index 107310a6f36f..ca9fb800336b 100644 --- a/kernel/time/timekeeping_debug.c +++ b/kernel/time/timekeeping_debug.c | |||
@@ -75,5 +75,7 @@ void tk_debug_account_sleep_time(struct timespec64 *t) | |||
75 | int bin = min(fls(t->tv_sec), NUM_BINS-1); | 75 | int bin = min(fls(t->tv_sec), NUM_BINS-1); |
76 | 76 | ||
77 | sleep_time_bin[bin]++; | 77 | sleep_time_bin[bin]++; |
78 | pr_info("Suspended for %lld.%03lu seconds\n", (s64)t->tv_sec, | ||
79 | t->tv_nsec / NSEC_PER_MSEC); | ||
78 | } | 80 | } |
79 | 81 | ||