From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754769AbbFLJcf (ORCPT ); Fri, 12 Jun 2015 05:32:35 -0400 Received: from terminus.zytor.com ([198.137.202.10]:34479 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbbFLJcN (ORCPT ); Fri, 12 Jun 2015 05:32:13 -0400 Date: Fri, 12 Jun 2015 02:31:36 -0700 From: tip-bot for John Stultz Message-ID: Cc: jmmahler@gmail.com, viresh.kumar@linaro.org, john.stultz@linaro.org, mtosatti@redhat.com, tglx@linutronix.de, fweisbec@gmail.com, preeti@linux.vnet.ibm.com, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org Reply-To: tglx@linutronix.de, fweisbec@gmail.com, viresh.kumar@linaro.org, jmmahler@gmail.com, mtosatti@redhat.com, john.stultz@linaro.org, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com In-Reply-To: <1434063297-28657-2-git-send-email-john.stultz@linaro.org> References: <1434063297-28657-2-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] time: Move clock_was_set_seq update before updating shadow-timekeeper Git-Commit-ID: d151832650ed98961a5650e73e85c349ad7839cb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d151832650ed98961a5650e73e85c349ad7839cb Gitweb: http://git.kernel.org/tip/d151832650ed98961a5650e73e85c349ad7839cb Author: John Stultz AuthorDate: Thu, 11 Jun 2015 15:54:53 -0700 Committer: Thomas Gleixner CommitDate: Fri, 12 Jun 2015 10:56:20 +0200 time: Move clock_was_set_seq update before updating shadow-timekeeper It was reported that 868a3e915f7f5eba (hrtimer: Make offset update smarter) was causing timer problems after suspend/resume. The problem with that change is the modification to clock_was_set_seq in timekeeping_update is done prior to mirroring the time state to the shadow-timekeeper. Thus the next time we do update_wall_time() the updated sequence is overwritten by whats in the shadow copy. This patch moves the shadow-timekeeper mirroring to the end of the function, after all updates have been made, so all data is kept in sync. (This patch also affects the update_fast_timekeeper calls which were also problematically done prior to the mirroring). Reported-and-tested-by: Jeremiah Mahler Signed-off-by: John Stultz Cc: Preeti U Murthy Cc: Peter Zijlstra Cc: Viresh Kumar Cc: Marcelo Tosatti Cc: Frederic Weisbecker Link: http://lkml.kernel.org/r/1434063297-28657-2-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner --- kernel/time/timekeeping.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 90ed5db..849b932 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -585,15 +585,19 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) update_vsyscall(tk); update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); - if (action & TK_MIRROR) - memcpy(&shadow_timekeeper, &tk_core.timekeeper, - sizeof(tk_core.timekeeper)); - update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); update_fast_timekeeper(&tk->tkr_raw, &tk_fast_raw); if (action & TK_CLOCK_WAS_SET) tk->clock_was_set_seq++; + /* + * The mirroring of the data to the shadow-timekeeper needs + * to happen last here to ensure we don't over-write the + * timekeeper structure on the next update with stale data + */ + if (action & TK_MIRROR) + memcpy(&shadow_timekeeper, &tk_core.timekeeper, + sizeof(tk_core.timekeeper)); } /**