From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968589AbdEWQjM (ORCPT ); Tue, 23 May 2017 12:39:12 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55271 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbdEWQjG (ORCPT ); Tue, 23 May 2017 12:39:06 -0400 Date: Tue, 23 May 2017 18:39:04 +0200 (CEST) From: Thomas Gleixner To: "Mirea, Bogdan-Stefan" cc: "linux-kernel@vger.kernel.org" , "john.stultz@linaro.org" , "ore@pengutronix.de" , "kernel@pengutronix.de" Subject: RE: [PATCH v3] Added "Preserve Boot Time Support" In-Reply-To: <7927187342d24ae7bc77ba1997e0aa4b@svr-ies-mbx-01.mgc.mentorg.com> Message-ID: References: <1495188983-47002-1-git-send-email-Bogdan-Stefan_mirea@mentor.com> <7927187342d24ae7bc77ba1997e0aa4b@svr-ies-mbx-01.mgc.mentorg.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 May 2017, Mirea, Bogdan-Stefan wrote: > On Monday, May 22, 2017 12:36 AM, Thomas Gleixner wrote: > > On Fri, 19 May 2017, Bogdan Mirea wrote: > > This adds a arch_timer specific command line option. Why is this > > arch_timer > > specific? So if any other platform wants to gain this feature then we > > end > > up copying that mess to every single timer implementation? Certainly > > NOT! > > Exactly nothing. settimeofday() modifies CLOCK_REALTIME and if the > > platform > > has an early accessible RTC, you hereby wreckaged wall_time. If the > > RTC > > readout comes later then CLOCK_REALTIME is overwritten. So what is > > this > > supposed to do? > > > > It has absolutely nothing to do with CLOCK_BOOTTIME. /proc/uptime is > > based > > on CLOCK_BOOTTIME, which is the CLOCK_MONOTONIC time since system > > boot. The > > difference between CLOCK_MONOTONIC and CLOCK_BOOTTIME is that > > CLOCK_MONOTONIC does not advance during suspend, but CLOCK_BOOTTIME > > takes > > the suspended time into account. > Thanks for feedback. > The idea of this patch was of a POC and this is why the code was > isolated in timer driver, which I agree is not a good idea for other > platforms to copy this since we can simply do all the things in > sched_clock_register() function guarded with CONFIG_BOOT_TIME_PRESERVE. > The patch was created for an internal project where no RTC was available > and no user-space apps were making any settimeofday(), and the use of > do_settimeofday() seemed safe. But yes, considering that the > CLOCK_REALTIME can be easily changed it should not be used here. It does not matter at all whether you have a RTC or settimeofday() is used or not. Again: > > It has absolutely nothing to do with CLOCK_BOOTTIME. /proc/uptime is > > based on CLOCK_BOOTTIME, which is the CLOCK_MONOTONIC time since system > > boot. The difference between CLOCK_MONOTONIC and CLOCK_BOOTTIME is that > > CLOCK_MONOTONIC does not advance during suspend, but CLOCK_BOOTTIME > > takes the suspended time into account. So using settimeofday() for any of what you want to do is bogus and useless. Thanks, tglx