diff options
author | Alex Shi <alex.shi@linaro.org> | 2018-02-01 12:02:38 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2018-02-01 12:02:38 +0800 |
commit | 59e35359ec360b74e9013ccab84c19ce53db38f9 (patch) | |
tree | f6c5cca3189d2140f23e7a71ee3f167c7e6f748e /kernel/time | |
parent | c210bc406de6a7993b8d7f30c28436be80de7694 (diff) | |
parent | a40f2a595adfe0be6ced06fdb4c4a24ae3291a91 (diff) |
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/hrtimer.c | 5 | ||||
-rw-r--r-- | kernel/time/timer.c | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 405536b22c0c..227ea8166a83 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(__ktime_divns); */ ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs) { - ktime_t res = ktime_add(lhs, rhs); + ktime_t res = ktime_add_unsafe(lhs, rhs); /* * We use KTIME_SEC_MAX here, the maximum timeout which we can @@ -669,7 +669,9 @@ static void hrtimer_reprogram(struct hrtimer *timer, static inline void hrtimer_init_hres(struct hrtimer_cpu_base *base) { base->expires_next.tv64 = KTIME_MAX; + base->hang_detected = 0; base->hres_active = 0; + base->next_timer = NULL; } /* @@ -1615,6 +1617,7 @@ static void init_hrtimers_cpu(int cpu) timerqueue_init_head(&cpu_base->clock_base[i].active); } + cpu_base->active_bases = 0; cpu_base->cpu = cpu; hrtimer_init_hres(cpu_base); } diff --git a/kernel/time/timer.c b/kernel/time/timer.c index f575785c7cd8..523fe1669d4c 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -764,8 +764,15 @@ static struct tvec_base *lock_timer_base(struct timer_list *timer, __acquires(timer->base->lock) { for (;;) { - u32 tf = timer->flags; struct tvec_base *base; + u32 tf; + + /* + * We need to use READ_ONCE() here, otherwise the compiler + * might re-read @tf between the check for TIMER_MIGRATING + * and spin_lock(). + */ + tf = READ_ONCE(timer->flags); if (!(tf & TIMER_MIGRATING)) { base = per_cpu_ptr(&tvec_bases, tf & TIMER_CPUMASK); |