Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3167956imm; Mon, 16 Jul 2018 23:32:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchwFSAJvDMLZLex/Jf6XTeZOyfxlyTQxRYB05i07W5/6KEBOwNICKJSDxjlWn2KfW8tph8 X-Received: by 2002:a65:468e:: with SMTP id h14-v6mr326074pgr.89.1531809164965; Mon, 16 Jul 2018 23:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531809164; cv=none; d=google.com; s=arc-20160816; b=C5WNYUzuDJjskcfgS3D+DCPG+70WVEMijE4NKRB6XLRqvvihn+OEyrcHb1JkYr/He1 DnMy6retZNCfmXin9wof25BsNU7zPdGnL9LueBt2gmrgok0N2t/ojLd0nbwPA2n1ZkeB YyXLoR1EJx7QhyNDPOaVentMMxkHRKp1Hoa7hIeELhlgzk8N6Y42Y0CbwyEsdXu/SbRm 3pNETqmuJkXDyZMr4KFPVjw22mpVqTFd5dxFhNIsQRf7pHrtTB8t/MN5hPmiptkBLH+2 B9ZiIKyGEc8zza5Ob++x1VarsiHqfUqs02WnjgA9Vu1bPvjB2/FwSrnSk+idmUj2KV1V U66Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=3rRv8owcaN++Bu1lq6xvMfM0T5VS0VFZCCqnmtcPMCo=; b=KRW5f+5eEEyuzN2uB82H+oHKb1tfMuthBlHNw7gh8TRl4bdAkCsbUSh3COJPRh85AC JzhBD542fXqhKRLOGAyoJSUI4x/9s72+09noLIBNhGtuLWJ2FQfw1ZD0JvEbBKqQtvXh THt+qYO4+5POWfXUXkzdpVEG86n05MpvIeMzUHPQ1O/cVqyFDTCk3IDObs/72tKx0der HLQAVQONYTokKd+XCS09E+rD9XB9qJD78i0BLC5sISyRws105zZ0tnl0WhaNm3YKb6+G B+veFcT9HM2wfbjc7h9gePwWJyowDXpDsf5RkqRvkLIlpsTCJ8ZnJ4Q5P5iTdCwh0N7m hmRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Zn2Zrkb0; dkim=pass header.i=@codeaurora.org header.s=default header.b=NJaOpSwq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j85-v6si192762pfa.232.2018.07.16.23.32.06; Mon, 16 Jul 2018 23:32:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Zn2Zrkb0; dkim=pass header.i=@codeaurora.org header.s=default header.b=NJaOpSwq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbeGQHAP (ORCPT + 99 others); Tue, 17 Jul 2018 03:00:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41456 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727293AbeGQHAP (ORCPT ); Tue, 17 Jul 2018 03:00:15 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 50C426063A; Tue, 17 Jul 2018 06:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531808955; bh=AZ3kL6Y+z0xeG7jB2/34I/IukEXLJE52goODusuc8C4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Zn2Zrkb0LiE5t5Q1KHVderF5Civun/j9nSLFEIuFCPxFc8xrYGTXlcDUeRqIwINLB mpkgd7pKdMZedWImn4CBnqZFyilWptN9zf+TD1Hmg/xp+/NJdAMpI/5m/gH3WUPMpA ZBElOofJrTcZPHJ5REQNZ5q44wF8V/RN3snLROiE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.204.79.100] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mojha@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 252EC6063A; Tue, 17 Jul 2018 06:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531808954; bh=AZ3kL6Y+z0xeG7jB2/34I/IukEXLJE52goODusuc8C4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=NJaOpSwqXu6fSyxiWgsntPy5tnC4tjcVc+DnbDb4+ODOTbpzbfjSNqfXvd/AqoqyN MwubTnXtA6lzkaLpl1vgBxIwj63VXyGxrDWgCyxGMKQhyOtpA6WCYPgK+Q4UAgMr0I sLInJ//cWkDHY0wddK42AwXNfJeYVWDpMjn0g8FE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 252EC6063A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mojha@codeaurora.org Subject: Re: [PATCH v4] time: Fix extra sleeptime injection when suspend fails To: John Stultz Cc: Thomas Gleixner , lkml , gkohli@codeaurora.org, cpandya@codeaurora.org, neeraju@codeaurora.org References: <1531773650-30424-1-git-send-email-mojha@codeaurora.org> From: Mukesh Ojha Message-ID: <793798fc-4c5a-da9a-2ca4-35fc1c39eb00@codeaurora.org> Date: Tue, 17 Jul 2018 11:59:11 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/17/2018 2:31 AM, John Stultz wrote: > On Mon, Jul 16, 2018 at 1:40 PM, Mukesh Ojha wrote: >> Currently, there exists a corner case assuming when there is >> only one clocksource e.g RTC, and system failed to go to >> suspend mode. While resume rtc_resume() injects the sleeptime >> as timekeeping_rtc_skipresume() returned 'false' (default value >> of sleeptime_injected) due to which we can see mismatch in >> timestamps. >> >> This issue can also come in a system where more than one >> clocksource are present and very first suspend fails. >> >> Fix this by handling the sleeptime_injected flag properly. >> >> Success case: >> ------------ >> {sleeptime_injected=false} >> rtc_suspend() => timekeeping_suspend() => timekeeping_resume() => >> >> (sleeptime injected) >> rtc_resume() >> >> Failure case: >> ------------ >> {failure in sleep path} {sleeptime_injected=false} >> rtc_suspend() => rtc_resume() >> >> sleeptime injected again which was not required as the suspend failed) >> >> Originally-by: Thomas Gleixner >> Signed-off-by: Mukesh Ojha >> --- >> Changes in V4: >> * Changes as suggested by John >> - Changed the variable name from sleeptime_injected to suspend_timing_needed >> - Changed the boolean logic. > Thanks so much for reworking and resending this again! > > >> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c >> index d37588f..ee455cc 100644 >> --- a/drivers/rtc/class.c >> +++ b/drivers/rtc/class.c >> @@ -102,7 +102,7 @@ static int rtc_resume(struct device *dev) >> struct timespec64 sleep_time; >> int err; >> >> - if (timekeeping_rtc_skipresume()) >> + if (!timekeeping_rtc_skipresume()) > > Hrm... So I'd have instead inverted the logic *in* > timekeeping_rtc_skipresume(), rather then here, but this looks to be > close enough and I can fix that bit up. Will take care of yours and Thomas comment in v5. > > Can you confirm you've validated this version of the patch resolves > the issue you reported? Yeah, I validated. Thanks Mukesh > > thanks > -john