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: 135698 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1484698lji; Mon, 14 May 2018 01:57:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZome4csnlSnSffsSIH2bt7gmBYFtl8cLPL6VceazEe8d+QpdDqLSn16cG/dz7B+fVMCjMkk X-Received: by 2002:a17:902:7487:: with SMTP id h7-v6mr8807491pll.154.1526288268725; Mon, 14 May 2018 01:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526288268; cv=none; d=google.com; s=arc-20160816; b=P1hrpoNoUJXVN0fp07At5VdvAhqIdZR8cauFjnd54Giy1FqfPthjGXe+WT0gBJ8UnU CxGoy5ZFAVunMpHqK8vKImQydI/96F9x1E7qvA8fbU48nMwtCL/h0xKzPWcjEi1UR4O2 FbmqYWaSBbfnHvvBlRO9gJy9vBJGv5Mor0/vnu4dovF8j/DO+eB4A4NRPwmKjZqIbt6E wuGEdNhGLqJL6wTHuy1epaEvIkpPNVF1PXKlmEZlqmHF+hmX4wolV+8COZYRtWghhdVd UWvup2dsK1tM4fm0WAOM4le+e/ddUPVf4Mrnq7p6raIm46KpOC4UHFV8O+FnFtq+8d4u Bhcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LAzSfz/p/aEVNQoPcW/L+Zrjx/SAnB3wjvrxhc9PO+E=; b=Pgea0xZojqR1ijVzKkUQRTHzJMWsh98tfvPjaZy1CU9MuHME8qo2brVVBntDDsK1gm SkHw/DuWvBFlDwCRww+a6GvG3XTYm70ryCuEznosWQ28giiT3YMIFAfNo3D1bJ4vuu8H Q2RwPm3llJvn2SLtkkAMg1mkvQwVLUsolvC9CBDLrm8PU3Bz8wSGPH2t/Pa0j53JVAIi ZtuPaPQ/rfT/cOOg2aqf9wTrO5OEqKRstL4+cdVU4/S4/Zd0DHP0Bg4HMCmDG9wgzrjP umU4OrUj/w0Ya8lMaz68cjtt0QS4FXq2mjJYqrvEDkomA2Ng+dMRIYkxuMpOh5c8AKM4 kkqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S3M7cEnx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si7251152pgt.285.2018.05.14.01.57.48; Mon, 14 May 2018 01:57:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S3M7cEnx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbeENI5q (ORCPT + 5 others); 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-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 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(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }