From patchwork Wed Jun 13 11:32:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10462101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A5BE6020A for ; Wed, 13 Jun 2018 11:49:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 471EF28939 for ; Wed, 13 Jun 2018 11:49:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ACBE2893C; Wed, 13 Jun 2018 11:49:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B621128939 for ; Wed, 13 Jun 2018 11:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=q99ev0m+2Noa0rsHG+phroVeFxCSlDg5ruSzpY1Yg9k=; b=qTsJFrqFnZ3Wp24G1VIJIFPZb8 zoBUGTshku7uwwloyiv54xmCHiDvTn0ULPOwPZxd/ZqMtjIb5zIGcqfwKdSwRPEBVTWsSqIN2wz37 d854PGfJOM9feBXstaeiIg2Gv4mYkrgnRibqylGCnCg6lbIcMjlWx/11M8SELJoI/DbVS3GNIxT2O IwR6mU1pAWP3jdChLIExD5rGfC2ccVb4xRBDWu8SheG8ZbdjLo/qiAqs5l/hLs+YyLodjqf3JrGnZ uzgRHDFHoDhTW7whpTX/8t71WBeQCmgzINndQbMxtSIfqL3gZmFXfgZtuUe9jj5v/V/LlyY1Gp9Do xWB7809A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT4H8-0007Hr-Rl; Wed, 13 Jun 2018 11:49:18 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT4H7-00078O-OR for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Jun 2018 11:49:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=96RSIq0UKsniTsrwhV4W30c30m0HqKjh/VL2LbphPg0=; b=HvpZfg3YYEVW9/lqYUgLf52Mx HldcyIRFld4/9Nk1KOylBMrXmVL5w3k14S5rrETnxljl9WckpeokZ11e3vOFhtxexo/Oqw+rkSZ3U Hc5okfNfKfCHpnLpl5dgmPNIgsjAZ3tfXpKnK+lwD8o99yOIKPPFnW533smZDc+4tHMuaxhHahdDA jSnyxounOasxdFWAbaEuNCoNcNAL/4DUDcGTFjcozRaYXYTSEXqOQl9c733YfPP2AaV52dYnPjvGw FrqUKu9nJvkT7FxgLddbXAu7xCm6fvc2umHLjYml93nPkTADfKMjfY8mLfrbQfbuDjdFECsdRlGOI ddLfLbo8Q==; Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT42c-0000PL-8x for linux-arm-kernel@lists.infradead.org; Wed, 13 Jun 2018 11:34:21 +0000 Received: by mail-pg0-x243.google.com with SMTP id a14-v6so1140328pgw.10 for ; Wed, 13 Jun 2018 04:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=96RSIq0UKsniTsrwhV4W30c30m0HqKjh/VL2LbphPg0=; b=VxFoDyXwmJHA73Z0m3RSWXMUpyPaomU7g5p4cpz7wjL8jLFhq/BrQ2LQwkWKDv5Zl/ 6Y8dmiGd2X3kecr9oyEoDg7C2HSSjy/aEHncpDh5YkQKqz7nH7hr0yOIx46tTVb+ud60 VQaf6bqw/QEaQsOvbeGbEQDh9KnJ5WtHLeITk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=96RSIq0UKsniTsrwhV4W30c30m0HqKjh/VL2LbphPg0=; b=S/yJL4Nj3VVJ7PF1OSpeMwBwhrH6bxt01pQQSELmqXphQyGnLiHvw3oCtGxq1WypN+ 6w4WKWIr40ZloQkxTNgk5rOt7OYntsQmJPxk3g24UKIEUUJ1FIrsrvVQBdIlUrwdy25r b7QOCGCPU3gqIryXrb4Os2b6BKYppPi6cN+8HWp5Tnad3w0AHAOsL0P/EJ3Yl5PeS/TH E1zK/kgUpTAzdj3Q3dA/00xO2BBhXmNPeoOqYVDr7IzfDLiFKISTzMjGYG2NZ3rFdNkV aHsD8WngJYkxhx00tkT5tzQ+ITco1vIs9EkVNT+dZHofB7ShMevznt49qHEHg68G4J50 txOQ== X-Gm-Message-State: APt69E2gKFET2pXONFsvXepygUadAd+UV1H7Elll+qkOte6IHP4pybWF OLVPGH+NemxM4pJ1+3rxfUxl8Q== X-Google-Smtp-Source: ADUXVKLkDGxsVsrAw5GyA9Gn0lgN+gXe891hkrkjCpAzPD3u+vkiaOi7u897ib5pXSKv8Qm6EOCBtA== X-Received: by 2002:a62:86c3:: with SMTP id x186-v6mr4587177pfd.4.1528889646727; Wed, 13 Jun 2018 04:34:06 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id h8-v6sm2745370pgq.35.2018.06.13.04.33.58 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jun 2018 04:34:06 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de, john.stultz@linaro.org, daniel.lezcano@linaro.org, arnd@arndb.de, tony@atomide.com, aaro.koskinen@iki.fi, linux@armlinux.org.uk, mark.rutland@arm.com, marc.zyngier@arm.com Subject: [PATCH 8/8] time: timekeeping: Remove time compensating from nonstop clocksources Date: Wed, 13 Jun 2018 19:32:35 +0800 Message-Id: <7901216d145d942553641c74f5ee6241acf18976.1528878545.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180613_123418_328925_0623662D X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kstewart@linuxfoundation.org, alexandre.belloni@bootlin.com, heiko@sntech.de, peterz@infradead.org, viresh.kumar@linaro.org, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, thierry.reding@gmail.com, hpa@zytor.com, mingo@kernel.org, x86@kernel.org, jonathanh@nvidia.com, paulmck@linux.vnet.ibm.com, len.brown@intel.com, mlichvar@redhat.com, broonie@kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, douly.fnst@cn.fujitsu.com, baolin.wang@linaro.org, gregkh@linuxfoundation.org, rdunlap@infradead.org, rajvi.jingar@intel.com, pombredanne@nexb.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since we have converted all nonstop clocksources to use persistent clock, thus we can simplify the time compensating by removing the nonstop clocksources. Now we can compensate the suspend time for the OS time from the persistent clock or rtc device. Signed-off-by: Baolin Wang --- kernel/time/timekeeping.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 4786df9..3026d98 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1666,7 +1666,6 @@ void timekeeping_inject_sleeptime64(struct timespec64 *delta) void timekeeping_resume(void) { struct timekeeper *tk = &tk_core.timekeeper; - struct clocksource *clock = tk->tkr_mono.clock; unsigned long flags; struct timespec64 ts_new, ts_delta; u64 cycle_now; @@ -1682,27 +1681,17 @@ void timekeeping_resume(void) /* * After system resumes, we need to calculate the suspended time and - * compensate it for the OS time. There are 3 sources that could be - * used: Nonstop clocksource during suspend, persistent clock and rtc - * device. + * compensate it for the OS time. There are 2 sources that could be + * used: persistent clock and rtc device. * * One specific platform may have 1 or 2 or all of them, and the * preference will be: - * suspend-nonstop clocksource -> persistent clock -> rtc + * persistent clock -> rtc * The less preferred source will only be tried if there is no better * usable source. The rtc part is handled separately in rtc core code. */ cycle_now = tk_clock_read(&tk->tkr_mono); - if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) && - cycle_now > tk->tkr_mono.cycle_last) { - u64 nsec, cyc_delta; - - cyc_delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, - tk->tkr_mono.mask); - nsec = mul_u64_u32_shr(cyc_delta, clock->mult, clock->shift); - ts_delta = ns_to_timespec64(nsec); - sleeptime_injected = true; - } else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { + if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { ts_delta = timespec64_sub(ts_new, timekeeping_suspend_time); sleeptime_injected = true; }