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: 10462069 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 010F7603B4 for ; Wed, 13 Jun 2018 11:34:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E619D28952 for ; Wed, 13 Jun 2018 11:34:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA80928957; Wed, 13 Jun 2018 11:34:38 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72AA128952 for ; Wed, 13 Jun 2018 11:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935517AbeFMLeN (ORCPT ); Wed, 13 Jun 2018 07:34:13 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:38488 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935515AbeFMLeH (ORCPT ); Wed, 13 Jun 2018 07:34:07 -0400 Received: by mail-pg0-f66.google.com with SMTP id c9-v6so1146004pgf.5 for ; Wed, 13 Jun 2018 04:34:07 -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=PhzfIg/aTAH0bunekHwPUBZcdTyPmFcw61LXa6O/LnAkc/lW8kPtBk9GswCUNBkR2L sbAmGoAet2sCxM9hQwu/NDhqhl8Wf6yhTmhc74X2ejO0x7ipeqnjW6bFqbrwRFTlgbaG Zz+u+hegz/vkM0I20y8SzHTDC3uaOcAMlgnKTTW6+bpqM0B9AhSXD+7LeUTe2pFBFRR+ krYnGdXEPUOyq5Jf/+hJBnAGFZGgkgloKP0N41UlWLxMIzciwbZ9rLxHLJucV7jo5VoN i1eVsbSz6+U+kn5FEjDgN6g/gxIoMXe5Et/Cs6hFN+rhmMPuH+Xk+FxGLGm+kXZQ8w15 1JeQ== X-Gm-Message-State: APt69E3kJm7DEMtSPxjwRWvAJj4VK7rV1nsQhGo2FWqMiRjtOTD4COrH V92RbXxwsH175+xCIFtsGJo41A== 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 Cc: baolin.wang@linaro.org, broonie@kernel.org, paulmck@linux.vnet.ibm.com, mlichvar@redhat.com, rdunlap@infradead.org, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, pombredanne@nexb.com, thierry.reding@gmail.com, jonathanh@nvidia.com, heiko@sntech.de, linus.walleij@linaro.org, viresh.kumar@linaro.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, douly.fnst@cn.fujitsu.com, len.brown@intel.com, rajvi.jingar@intel.com, alexandre.belloni@bootlin.com, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org 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: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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; }