Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3186569imm; Tue, 29 May 2018 02:41:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqoj2W24hVSjJRICLOcOo2DpJEVLgxxdPgshq3vK1H3s0sY+GkAg2eY1KYrg/a/zQB8pzJO X-Received: by 2002:a63:714e:: with SMTP id b14-v6mr12135677pgn.73.1527586866237; Tue, 29 May 2018 02:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527586866; cv=none; d=google.com; s=arc-20160816; b=uj9cLhMz6D5hvg7F5/Jgy9m7AnSXT2VNZevLwJ6A6Tt8bszdb/b4DYQ2ri+eOX+ah5 wN+MLA8kDAI7NWk9zETQr4TGzq47ArUvwjVXivRiBQBKyD2hZ8TQ+oS2LOVN0vqBLVWd PY1oouV1rdgDX3iavDQ54q6cGyrpumGEhbz/6hPtJR7onNP5/NFNdsaL5D5eAq98wSdh ZIiYroK2PgG0NaSqbVJ8sGT40jb3gZqdwKTtO0bRZqbZha5MvtATaRh3fe2wa63ee2pR MOHNavlIKr5CcjPY8K+9XE5xdaXaURRs5xlFMLJAygWQ3BicStopMvJksaAdpYQHwvio xXiQ== 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=J7TaVuIkINuyJWZYkjLV6JV6phC0GDogmWJb9Dlg+o8=; b=BAO9soaUzSEtE3/8eVHIeX6GjohezWrb6mMp+ulbS58j1S4Hz5uP/y+OX7MZI9aHkm e1HFQTuYvk1UK/oXwlYSExf5bNGdjKcWzFUI7FeY2lhoCfDQ0Cy+p73WaB3oMHuUwFcu 41b+DWPOmQPEWEISymP7NXYHS8ppyTvcOiujkO9T5KgUapI/y8uLqR1v+Mt6Gpr4tO3z W5+CEhnviNmCgfEdBuhHTwh0hlEVHEDzECz82aAOFO0cXRarNYqcTVRAH0449KdGDO2m uE78RnHTgKck5MAQYcXN6n9//tNLClWYib+F8nz8j9s07EJ6xit76+dqIaoX2ywoZaUP 3OFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lktKhGXA; dkim=pass header.i=@codeaurora.org header.s=default header.b=lktKhGXA; 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 q1-v6si2230021pgs.441.2018.05.29.02.40.51; Tue, 29 May 2018 02:41:06 -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=lktKhGXA; dkim=pass header.i=@codeaurora.org header.s=default header.b=lktKhGXA; 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 S932602AbeE2JjV (ORCPT + 99 others); Tue, 29 May 2018 05:39:21 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59584 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932354AbeE2JjQ (ORCPT ); Tue, 29 May 2018 05:39:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AAFF060263; Tue, 29 May 2018 09:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527586755; bh=Kq1SKnnktCS8GEQQlZpHnR5ImNMN7/VpWhrymFPB5uk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lktKhGXA4FPoa6YNTMousPWBH3+sejEXFuKAkYffXrPG3Um18anG+izXw3m09/4IY WrIHUtORNBD5ybeQLCcy73dW2LMEfTpVfvpjdkB6jvbo2XtnIWSjW5p7rB43eCbIcj yDlE9g456FkALRIScsdwtRphDjtMgtfczReKSpDk= 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 A6F006031A; Tue, 29 May 2018 09:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527586755; bh=Kq1SKnnktCS8GEQQlZpHnR5ImNMN7/VpWhrymFPB5uk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=lktKhGXA4FPoa6YNTMousPWBH3+sejEXFuKAkYffXrPG3Um18anG+izXw3m09/4IY WrIHUtORNBD5ybeQLCcy73dW2LMEfTpVfvpjdkB6jvbo2XtnIWSjW5p7rB43eCbIcj yDlE9g456FkALRIScsdwtRphDjtMgtfczReKSpDk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A6F006031A 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] time: Fix sleeptime injection for non-stop clocksource & persistent clock To: Vinod Koul Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1527581718-5624-1-git-send-email-mojha@codeaurora.org> <20180529084819.GI5666@vkoul-mobl> From: Mukesh Ojha Message-ID: <6a7557ac-9660-0cb6-c76b-008a3e28b2b6@codeaurora.org> Date: Tue, 29 May 2018 15:09:06 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180529084819.GI5666@vkoul-mobl> 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 5/29/2018 2:18 PM, Vinod Koul wrote: > On 29-05-18, 13:45, Mukesh Ojha wrote: >> Currently, for both non-stop clocksource and persistent clock >> there is a corner case, when a driver failed to go suspend mode >> rtc_resume injects the sleeptime as timekeeping_rtc_skipresume >> returned 'false' due to which we can see mismatch in time with >> system clock. >> >> Success case: >> {sleeptime_injected=true} >> rtc_suspend() => timekeeping_suspend() => timekeeping_resume() => rtc_resume() >> >> Failure case: >> {failure in sleep path} {sleeptime_injected=false} >> rtc_suspend() => rtc_resume() >> >> Change-Id: I98928761c98cec21a3033a55d3e10fb34138f38c > This does not belong in upstream please remove. I think checkpatch warns. > > Also I see that you have sent to lkml and arm-msm mailing list, but have not > CCed any maintainers. Please run ./scripts/get_maintainer.pl to find who to send > patches to. Chances are it will get ignored... Thanks Vinod. Will resend it after including maintainers. -Mukesh > >> Signed-off-by: Mukesh Ojha >> --- >> kernel/time/timekeeping.c | 14 +++++++++----- >> 1 file changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c >> index 427e33d..c022d82 100644 >> --- a/kernel/time/timekeeping.c >> +++ b/kernel/time/timekeeping.c >> @@ -1511,9 +1511,6 @@ void __weak read_boot_clock64(struct timespec64 *ts) >> ts->tv_nsec = 0; >> } >> >> -/* Flag for if timekeeping_resume() has injected sleeptime */ >> -static bool sleeptime_injected; >> - >> /* Flag for if there is a persistent clock on this platform */ >> static bool persistent_clock_exists; >> >> @@ -1611,7 +1608,14 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk, >> */ >> bool timekeeping_rtc_skipresume(void) >> { >> - return sleeptime_injected; >> + struct timekeeper *tk = &tk_core.timekeeper; >> + bool skip_rtc_resume = false; >> + >> + skip_rtc_resume = ((tk->tkr_mono.clock->flags & >> + CLOCK_SOURCE_SUSPEND_NONSTOP) || >> + (persistent_clock_exists)) ? true : false; >> + >> + return skip_rtc_resume; >> } >> >> /** >> @@ -1671,8 +1675,8 @@ void timekeeping_resume(void) >> unsigned long flags; >> struct timespec64 ts_new, ts_delta; >> cycle_t cycle_now, cycle_delta; >> + bool sleeptime_injected = false; >> >> - sleeptime_injected = false; >> read_persistent_clock64(&ts_new); >> >> clockevents_resume(); >> -- >> Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, >> Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html