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: 10397627 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 76F2E600D0 for ; Mon, 14 May 2018 09:08:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44F8628D37 for ; Mon, 14 May 2018 09:08:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3955B28D53; Mon, 14 May 2018 09:08:46 +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 9A09D28D37 for ; Mon, 14 May 2018 09:08:45 +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=xqYxsTI68BHuxCy7xIlr2VyZcDxfL2GlsLRSfY2qFFk=; b=STycuAvefZAgokQqc+fFDOio5I /3oEkzPlmpatFn/Prl9zbsMNabsxKwn4Ov1vwVMRxtEGUAau2w6E9VniBtrLk16/rtKx2TuM8rzy6 XYRVtxoy25jX4RfzUx5jgQV6fdKM9ba1vItbkGs1YaVORJerDkGzI0AwEfpMeq5SN3DtZX7ACtr6i hYhZyHeM3mSNO+3da7wpXkmQ2yhOhFncvEg8+BkNvh0jIWMt3eSkWze6eDZl4bgrIANhdW4hSGV2C bUKZFMkVmNxp5fuoMspVo5DzOkSVefLQtFvOT+DXYUipJpc+8IgR/7kk+Emm4ZIBhiRzoTJnDX9Sm bwxR1xvw==; 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 1fI9T8-0005Tq-SS; Mon, 14 May 2018 09:08:34 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fI9Io-00040V-PA for linux-arm-kernel@lists.infradead.org; Mon, 14 May 2018 08:57:56 +0000 Received: by mail-pl0-x241.google.com with SMTP id c19-v6so6975860pls.6 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=EkmqjHZekc3uRiGFwyaSGV0m3Sp+StvsHZ+tXetbiRp/tDrhLyKC4nquvU1DE3gF+C 7FY+ePcpvCkrt8zzwWDYH9gExKvJLBwH6HOl0k6NSg9C5gmL6AJio+Y3rcALlZ2LfBhx oZvwDKFomdyzns9ys9uBeEbZWgCmOQfqPahh/diGIffyDK33SAHGl/hA+c9Qwn+PAKBu 86HKzpmHwt+Fl4algZQI7FXTTAySaEyO48Q30vgqKmg7kaa3m5QRXmE48ZxBwLfo6+fP gjyMPpM9mnkCwYercF4E/dqgBDg464rVq+pUSdMhI0U38upm941bHZYPg8kXrGo/mqH2 NQOw== X-Gm-Message-State: ALKqPwd/vqrI/OzY43eiGY1hEcjm7P8ipDoy+vgBRyajD3hFLkgwsdf7 g+t1YV69V1cGuiZp2DLA9HhDiA== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180514_015754_886430_B6702AE2 X-CRM114-Status: GOOD ( 12.47 ) 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 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; }