From patchwork Mon May 14 08:55:36 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: 10397537 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 0CEA4600D0 for ; Mon, 14 May 2018 08:57:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F28BA28736 for ; Mon, 14 May 2018 08:57:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6F51290C5; Mon, 14 May 2018 08:57:48 +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=ham 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 8722028736 for ; Mon, 14 May 2018 08:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbeENI5q (ORCPT ); Mon, 14 May 2018 04:57:46 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:40721 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbeENI5o (ORCPT ); Mon, 14 May 2018 04:57:44 -0400 Received: by mail-pl0-f66.google.com with SMTP id t12-v6so6981349plo.7 for ; Mon, 14 May 2018 01:57:44 -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=sSEMab6IMNQz3/RjvLiWiFX+Zq0WYBiRrZjP2qAXMUY=; b=S3M7cEnxZRj3XZAA0deHFLTu6i/658UiAOzK3xugklP42QwqR0i4lXVFdJmegRujfx 91gtG1iFaMttC3Vh67DJVGgkEEcQfffiDv6CS9RpepOQJvHTAksZ9Zr0KiejdiLMmX5y SY0oyLGX/XuPzckONQ7lqzXGpdmi45nk/7aMg= 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=sSEMab6IMNQz3/RjvLiWiFX+Zq0WYBiRrZjP2qAXMUY=; b=QGAKqDLew/Wm2SHxCJZNQM4KWWWuWZfpIur82/zu8pzm4N7EWN1DAUAXP69VrWm7/+ C2j5E5CjPDXkDmsNiXKdBev+dOwTeaHPoV9NTlTZCTtE+DME45o250AKBAPHE8i8P3K6 5Y9/2/SsoEw/5+ZhlUbK075hUr7x6Q4QeTgzBJT5QaFgEOgSpJJl70h5ERYhLWdBr44B gOx0L8ITTVgN2A6cw/6Yd6P9U1RfyZ8MGou6jWQaxZPrGS4pz0fHcDEaFcyMLORtRWKi hxaz8V/m7lXqeBHVFwqQyA+tcG347DouAtSPpe9vLZw15YRFw7MIQOmS9jHYP3/ngSpr QVZg== X-Gm-Message-State: ALKqPwdC6XJglgIE692RcYhW2S39wQZH2zT6C/91pVWo4shBR6AS/f1A WRNgZuO7oZNg2FQpComd5uQ+4A== X-Google-Smtp-Source: AB8JxZpLbxYEtKrezxZrPSNr8XP9twI5Iv1raRlQ3AOegErbKoWKXRD+i/2VeFcuM21IPn0GRtudAA== X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr8923909plu.22.1526288263753; Mon, 14 May 2018 01:57:43 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id x71-v6sm23308158pfe.47.2018.05.14.01.57.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 01:57:43 -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: [RFC PATCH 10/10] time: timekeeping: Remove time compensating from nonstop clocksources Date: Mon, 14 May 2018 16:55:36 +0800 Message-Id: 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 49cbcee..48d2a80 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; }