From patchwork Thu Jun 11 22:54:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 49773 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6EE2B24616 for ; Thu, 11 Jun 2015 22:55:10 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf5276637lbb.0 for ; Thu, 11 Jun 2015 15:55:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=S+/K9KXsZw+G8RdosDidy7t3ox7b4rMA+3xnH27NGzg=; b=OZ6YtrXmhFj1QgmB/A0RkiDcpaUCySBkLOIR6i0mzqtima4u1ol0fetOb7zgVZ0/VP oUl/YIOzIvySQT9UTrLaY5XsAXBKHzJKq4jFM4t6lh3bhWCKlgvMJ4065Qp6dNcbqoz5 O6rExnAcOSNLkumR6un8yWLu76AsY8jFOoc9WYCo8dDk0zhf9cGwOjlmkBhYKD9odH9k UJ0xUQW6D6vKPhRw8R5ulB5lvmmGDOMy3c35ObODL0nvbgDoJck4+tNDmBFUHHphIa4U DcP3+MIItPe93ki5Lq8xU0KyDJzvNyeovHkAt23eUKbbxYJ84lrrlpmRimAU+lyJKw9b syqw== X-Gm-Message-State: ALoCoQlaN+fXCd1FRw4nl+/kuyojq2LJewv8Q/Jo6zV3laBig+IS8F58gPOFNl2VlGTGKf6MjeoI X-Received: by 10.112.28.111 with SMTP id a15mr10824280lbh.21.1434063309188; Thu, 11 Jun 2015 15:55:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.103 with SMTP id m7ls550434lae.79.gmail; Thu, 11 Jun 2015 15:55:09 -0700 (PDT) X-Received: by 10.152.7.65 with SMTP id h1mr12326543laa.33.1434063309040; Thu, 11 Jun 2015 15:55:09 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id lp10si1847792lbb.1.2015.06.11.15.55.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 15:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbqq2 with SMTP id qq2so10308785lbb.3 for ; Thu, 11 Jun 2015 15:55:08 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr12314842lbc.19.1434063308902; Thu, 11 Jun 2015 15:55:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp135133lbb; Thu, 11 Jun 2015 15:55:07 -0700 (PDT) X-Received: by 10.66.249.1 with SMTP id yq1mr17755347pac.3.1434063306953; Thu, 11 Jun 2015 15:55:06 -0700 (PDT) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com. [209.85.192.182]) by mx.google.com with ESMTPS id yt2si2684314pbc.122.2015.06.11.15.55.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 15:55:06 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.182 as permitted sender) client-ip=209.85.192.182; Received: by pdbki1 with SMTP id ki1so11473968pdb.1 for ; Thu, 11 Jun 2015 15:55:06 -0700 (PDT) X-Received: by 10.68.191.229 with SMTP id hb5mr18078981pbc.126.1434063306048; Thu, 11 Jun 2015 15:55:06 -0700 (PDT) Received: from localhost.localdomain (c-71-63-136-39.hsd1.or.comcast.net. [71.63.136.39]) by mx.google.com with ESMTPSA id ax2sm1676093pac.21.2015.06.11.15.55.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jun 2015 15:55:05 -0700 (PDT) From: John Stultz To: linux-kernel@vger.kernel.org Cc: John Stultz , Thomas Gleixner , Preeti U Murthy , Peter Zijlstra , Viresh Kumar , Marcelo Tosatti , Frederic Weisbecker , Ingo Molnar Subject: [PATCH 1/5] time: Move clock_was_set_seq update to before we update the shadow-timekeeper Date: Thu, 11 Jun 2015 15:54:53 -0700 Message-Id: <1434063297-28657-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434063297-28657-1-git-send-email-john.stultz@linaro.org> References: <1434063297-28657-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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). Cc: Thomas Gleixner Cc: Preeti U Murthy Cc: Peter Zijlstra Cc: Viresh Kumar Cc: Marcelo Tosatti Cc: Frederic Weisbecker Cc: Ingo Molnar Reported-by: Jeremiah Mahler Signed-off-by: John Stultz --- 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)); } /**