This is a note to let you know that I've just added the patch titled hrtimer: Set expiry time before switch_hrtimer_base() to the 3.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: hrtimer-set-expiry-time-before-switch_hrtimer_base.patch and it can be found in the queue-3.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 84ea7fe37908254c3bd90910921f6e1045c1747a Mon Sep 17 00:00:00 2001 From: Viresh Kumar <viresh.kumar@xxxxxxxxxx> Date: Mon, 12 May 2014 13:42:29 +0530 Subject: hrtimer: Set expiry time before switch_hrtimer_base() From: Viresh Kumar <viresh.kumar@xxxxxxxxxx> commit 84ea7fe37908254c3bd90910921f6e1045c1747a upstream. switch_hrtimer_base() calls hrtimer_check_target() which ensures that we do not migrate a timer to a remote cpu if the timer expires before the current programmed expiry time on that remote cpu. But __hrtimer_start_range_ns() calls switch_hrtimer_base() before the new expiry time is set. So the sanity check in hrtimer_check_target() is operating on stale or even uninitialized data. Update expiry time before calling switch_hrtimer_base(). [ tglx: Rewrote changelog once again ] Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx> Cc: linaro-kernel@xxxxxxxxxxxxxxxx Cc: linaro-networking@xxxxxxxxxx Cc: fweisbec@xxxxxxxxx Cc: arvind.chauhan@xxxxxxx Link: http://lkml.kernel.org/r/81999e148745fc51bbcd0615823fbab9b2e87e23.1399882253.git.viresh.kumar@xxxxxxxxxx Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/hrtimer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1003,11 +1003,8 @@ int __hrtimer_start_range_ns(struct hrti /* Remove an active timer from the queue: */ ret = remove_hrtimer(timer, base); - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); - if (mode & HRTIMER_MODE_REL) { - tim = ktime_add_safe(tim, new_base->get_time()); + tim = ktime_add_safe(tim, base->get_time()); /* * CONFIG_TIME_LOW_RES is a temporary way for architectures * to signal that they simply return xtime in @@ -1022,6 +1019,9 @@ int __hrtimer_start_range_ns(struct hrti hrtimer_set_expires_range_ns(timer, tim, delta_ns); + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); + timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base); Patches currently in stable-queue which might be from viresh.kumar@xxxxxxxxxx are queue-3.14/mips-loongson2_cpufreq-fix-cpu-clock-rate-setting.patch queue-3.14/hrtimer-set-expiry-time-before-switch_hrtimer_base.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html