Received: by 10.223.185.116 with SMTP id b49csp7655820wrg; Thu, 1 Mar 2018 08:54:24 -0800 (PST) X-Google-Smtp-Source: AG47ELtvXwWhQa7FrjrjAyToYuWKa6eHJPRFdBF/OmxpFvEt35XFsstRjlnRVgwIDKn4vAyCmTdM X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr2476070pld.72.1519923264331; Thu, 01 Mar 2018 08:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923264; cv=none; d=google.com; s=arc-20160816; b=eevsw/jfqXqOZipsGuCI9cRyqC/wn7xFV2zhi8s93q+hrnZzyAyCsFdWjZ+BbyB+sl PeBGZRU4LkyqOysnymYVMj/x4Du1BsPrcnG6rL22gnoCt3N0BWxcffiXT1278MDm2/pd LMy7fWdxZVVvY//2tRHrMhdys5FkERZtF//8U0GWfbWkUBOcHQ9ZmvbLdZd/IuPOAKsA 3J10wVfpz5pUgHQRYLcwl2jZEKKrvcoa57tNcufaztZRwCUMK4GabdwbwLlR8uBG8dN0 QQw1BTWdBycKlPadGZ8Ip2sFAxYd0kTGJgYKPVIyOMP6p71+v/RX9ncJCgZOih4KUDYV kIKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:cc:to:from:date:user-agent :message-id:arc-authentication-results; bh=Nx/l54v9TEPDInJvEHzwLqFouS6weWiqqKjZQ4IhcKg=; b=AuUTzEzdIEaqhA3Rlk0UWIHFwxMWCg91Q+EnsOZIZrYpfyYnaWuRFP3K4m85+2rTpH KvKbvG0cAPKSGpy0+WvSvoU1LeyNhCBZDxDomExp0NJq8NwlrczHGGKCBEK/KzP8VkFG l4iiJ72KJ5mBBu27p32gmJB0PRrXn5PUcupShruBpZIID7z5Uo6lLdjddOAtkCNxpMuG vErfD+BjxOBJUPwNbF56/FWhuYhcwuvtVruLoy0PHzKTO9CmoM1w8NLUKDfJXXZGFCGK YBQeori6o05tBjyLTz6Aek/tr/antBj+ijECXOpwy87EIVSXg59CgVK1J2vl1+/41Nwc SIOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3273260pff.317.2018.03.01.08.54.09; Thu, 01 Mar 2018 08:54:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033251AbeCAQwH (ORCPT + 99 others); Thu, 1 Mar 2018 11:52:07 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:51713 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033015AbeCAQwD (ORCPT ); Thu, 1 Mar 2018 11:52:03 -0500 Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1erRNT-0000LV-Jy; Thu, 01 Mar 2018 17:48:19 +0100 Message-Id: <20180301163331.987775783@linutronix.de> User-Agent: quilt/0.63-1 Date: Thu, 01 Mar 2018 17:33:31 +0100 From: Thomas Gleixner To: LKML Cc: Linus Torvalds , Ingo Molnar , Peter Zijlstra , Steven Rostedt , John Stultz , Petr Mladek , Mark Salyzyn , Prarit Bhargava , Sergey Senozhatsky , Dmitry Torokhov , Kevin Easton , Michael Kerrisk , Jonathan Corbet Subject: [RFC/RFT patch 0/7] timekeeping: Unify clock MONOTONIC and clock BOOTTIME Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While working through the melted spectrum induced backlog I found that last years discussion about unifying clock MONOTONIC and clock BOOTTIME has died out and obviously nobody had time to do testing on that half baken RFC patch: https://lkml.kernel.org/r/alpine.DEB.2.20.1711180123360.2186@nanos So I sat down and revisited it a bit more carefully than last time. The following series is the result of this work. The main differences are: 1) Provide CLOCK_MONOTONIC_ACTIVE which has the current CLOCK_MONOTONIC behaviour, i.e. it's monotonic time since boot minus the time spent in suspend. The reason why I introduced it is that currently it's possible for user space to determine the time spent in suspend by subtracting clock monotonic and clock boot time time stamps. When CLOCK_MONOTONIC behaves like CLOCK_BOOTTIME then this is not longer possible. As a side effect when CLOCK_MONOTONIC_ACTIVE is supported by a kernel then this is also an indicator that CLOCK_MONOTONIC and CLOCK_BOOTTIME are identical. So it's possible to determine this w/o playing games with kernel versions etc. Older kernels simply return -EiNVAL if CLOCK_MONOTONIC_ACTIVE is requested in clock_gettime(). 2) Fixed a few places which I missed last time, which means also that my warning in the original changelog was justified. 3) Consolidated the core users to get rid of the seperate implementations for the two clocks Note, there are user space visible side effects. The difference between CLOCK_MONOTONIC and CLOCK_BOOTTIME is well documented and it's unclear whether applications rely on it or not. This really needs lot of testing, documentation updates and more input from userspace folks to make a final decision. Thanks, tglx --- Documentation/trace/ftrace.txt | 14 +----- drivers/input/evdev.c | 7 --- include/linux/hrtimer.h | 2 include/linux/timekeeper_internal.h | 2 include/linux/timekeeping.h | 37 +++++------------ include/uapi/linux/time.h | 1 kernel/time/hrtimer.c | 16 ------- kernel/time/posix-stubs.c | 2 kernel/time/posix-timers.c | 26 ++++-------- kernel/time/tick-common.c | 15 ++++++ kernel/time/tick-internal.h | 6 ++ kernel/time/tick-sched.c | 9 ++++ kernel/time/timekeeping.c | 78 ++++++++++++++++++------------------ kernel/time/timekeeping.h | 1 kernel/trace/trace.c | 2 15 files changed, 104 insertions(+), 114 deletions(-)