Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4318965imm; Wed, 30 May 2018 03:28:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL3rCXHbrOzVtUJOghsKc9VPI0dIRlVoV2qNKEtJhBfTCzdudOXne9Tsaddw3Xkc/z6BqmS X-Received: by 2002:a17:902:bc4a:: with SMTP id t10-v6mr2290801plz.133.1527676111567; Wed, 30 May 2018 03:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527676111; cv=none; d=google.com; s=arc-20160816; b=yZh5cvw4ctC6dp5thfTUKCcy16mbsP3BB7BERItD+a3Wow6DPAuSFre5tjMAYZLSCx echq8StaUPQIwvdKr8PSPEg39JOua4SQvM3MyPDQdhD9dne+fqQ97mcrDS1rgAaRsdyY N3H5R0IrRnUJRBTx3YewFibbW1yS5CLFYFi5xU+oFYkfj6iuXHQKpujFoQMMhThV/UK7 DtYlXYI/1IIZFkU43Aw4VPzMglgiDc5mE1QC/j5viiB4E+HJ1IjXnRMt/EOp++fcpW3/ +6KrSxExoz5bNRJKZ/p0L32aHgb+r/TvUpT/Bb+BJhOza0B6jLyJ5YRUM5hucoVnsntK i+qg== 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=/XA1sO21okFmX6TCrgiWfFgvotKa+hfPwnm2lZmnhrg=; b=S/0k+2XC+mVMXT96yxNgt2eC11gqz9OEUtyyGH3Z+aphUbFsZuDvxYZgXxQLJVOOpD j+KG5604u1T1JnP1Ca59ivNgaRJ7iY6UV4XkSNDR7eD8X7yDeHUax3z0dU4O89f6LK78 ETHR0DXaHmgUWWU+PrA62a/iHTdx2yBJvCwMQVNZe8GB3oVp3/7ahTc7Kg3CoN0eWNgQ +DwKmzQOQsruXYKnXwpXXugthhMx6nZrNfmOEu0jtQMZbCDi5fvRbEmPyTNcBqeEdteI sOfd0A+biUT+l0/SS3Y/HfakQtKCjPNviaWNkTMDKPljJLUpDHM+cmcysHDXpWgsea1i c2Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZGi/ZF1B; dkim=pass header.i=@codeaurora.org header.s=default header.b=gs0iKWDL; 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 c1-v6si20330989pgn.281.2018.05.30.03.28.17; Wed, 30 May 2018 03:28:31 -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=ZGi/ZF1B; dkim=pass header.i=@codeaurora.org header.s=default header.b=gs0iKWDL; 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 S1751547AbeE3K1J (ORCPT + 99 others); Wed, 30 May 2018 06:27:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60092 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbeE3K1H (ORCPT ); Wed, 30 May 2018 06:27:07 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 556AC6060A; Wed, 30 May 2018 10:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527676027; bh=0A9yldgKbp9N2C9/WAedNA7GlqIJDRssC78M+aMULyU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ZGi/ZF1BaQXGlu/5AECuzVmdlDjFdTS8dDvG/wvWWcBed9T8+6zZifOUmDB5R5Lse KeskdQanlErwfHr7zdwikrnXEJ0ocaYv+tnyEyL2IpvfRlzlab+0+bSHt8rnlcnadO fnhBqfk0SyvpTtN6Dfi+ISglkVJPyxhVjNc5bJX8= 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 141C860261; Wed, 30 May 2018 10:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527676026; bh=0A9yldgKbp9N2C9/WAedNA7GlqIJDRssC78M+aMULyU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gs0iKWDLtc7d76KC5XhkThLzXWJ/yEvtbbZtiC7Fsiecym82LheVL/akTb5RWjqJy iZKkKNIMnyUYcGEHtgaKcI+bff6JtaZMCJoIvMlzFAYOq7/m1PJYuxi/Zt4OhvAfN5 KMfB0mwQwdhCnrTjGHmf79hB7N0KJdTIkB8FrylI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 141C860261 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 RESEND] time: Fix sleeptime injection for non-stop clocksource & persistent clock To: John Stultz Cc: Thomas Gleixner , lkml , neeraju@codeaurora.org, gkohli@codeaurora.org, cpandya@codeaurora.org References: <1527587351-26634-1-git-send-email-mojha@codeaurora.org> From: Mukesh Ojha Message-ID: <76bd29b8-c8af-b5ac-3538-b6a97afb6ab1@codeaurora.org> Date: Wed, 30 May 2018 15:57:02 +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: 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 Hi John, On 5/30/2018 7:50 AM, John Stultz wrote: > On Tue, May 29, 2018 at 2:49 AM, 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 between >> system clock and other timers. >> >> 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() >> >> Signed-off-by: Mukesh Ojha > I'm not sure this patch makes sense yet (since I don't really see how > its used In a system where both non-stop clocksource and rtc exist Timestamp mismatch seen between a (Gyro)timer based on non-stop clocksource and system clock after attempting a sleep. Here, System clock timestamps increase by some millisecond as compare to other timer. And we see this is possible only when timekeeping_resume() has not been called which is keeping sleeptime_injected to its default value(false). So, the call to timekeeping_rtc_skipresume() in rtc_resume() is false and thats ends up in sleeptime injection via rtc_resume(). When timekeeping_resume() has not been called means one of the driver failed during suspend in syscore_suspend() in kernel/power/suspend.c . So if we let rtc inject the sleeptime here, we would see the timestamp increase in case of system clock. > - mind cc'ing me on the patch that makes use of this?) > > And more problematic, the patch doesn't seem to apply to mainline. > Could you respin and resend? Will spin the patch again with some minor code change. Thanks, Mukesh > > thanks > -john