From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751741AbbDCGQQ (ORCPT ); Fri, 3 Apr 2015 02:16:16 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:37943 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbbDCGQN (ORCPT ); Fri, 3 Apr 2015 02:16:13 -0400 Date: Fri, 3 Apr 2015 08:16:08 +0200 From: Ingo Molnar To: John Stultz Cc: lkml , Xunlei Pang , Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH 17/21] time: Fix a bug in timekeeping_suspend() with no persistent clock Message-ID: <20150403061608.GA12625@gmail.com> References: <1427945681-29972-1-git-send-email-john.stultz@linaro.org> <1427945681-29972-18-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1427945681-29972-18-git-send-email-john.stultz@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * John Stultz wrote: > From: Xunlei Pang > > When there's no persistent clock, normally timekeeping_suspend_time > should always be zero, but this can break in timekeeping_suspend(). > > At T1, there was a system suspend, so old_delta was assigned T1. > After some time, one time adjustment happened, and xtime got the > value of T1-dt(0s soon after this adjustment, obviously we will get a small negative > delta_delta, resulting in a negative timekeeping_suspend_time. > > This is problematic, when doing timekeeping_resume() if there is > no nonstop clocksource for example, it will hit the else leg and > inject the improper sleeptime which is the wrong logic. > > So, we can solve this problem by only doing delta related code when > the persistent clock is existent. Actually the code only makes sense > for persistent clock cases. What's the effect in practice of such negative delta_delta values? What kind of effects would users see from this? Thanks, Ingo