From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbdHARAe (ORCPT ); Tue, 1 Aug 2017 13:00:34 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:32993 "EHLO mail-qk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdHARAb (ORCPT ); Tue, 1 Aug 2017 13:00:31 -0400 MIME-Version: 1.0 In-Reply-To: <1501592128-11334-1-git-send-email-prarit@redhat.com> References: <1501592128-11334-1-git-send-email-prarit@redhat.com> From: John Stultz Date: Tue, 1 Aug 2017 10:00:30 -0700 Message-ID: Subject: Re: [PATCH v2] printk: Add boottime and real timestamps To: Prarit Bhargava Cc: lkml , Mark Salyzyn , Jonathan Corbet , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , Stephen Boyd , Andrew Morton , Greg Kroah-Hartman , "Paul E. McKenney" , Christoffer Dall , Deepa Dinamani , Ingo Molnar , Joel Fernandes , Kees Cook , Peter Zijlstra , Geert Uytterhoeven , "Luis R. Rodriguez" , Nicholas Piggin , "Jason A. Donenfeld" , Olof Johansson , Josh Poimboeuf , linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 1, 2017 at 5:55 AM, Prarit Bhargava wrote: > printk.time=1/CONFIG_PRINTK_TIME=1 adds a unmodified local hardware clock > timestamp to printk messages. The local hardware clock loses time each > day making it difficult to determine exactly when an issue has occurred in > the kernel log, and making it difficult to determine how kernel and > hardware issues relate to each other in real time. > > Make printk output different timestampes by adding options for no > timestamp, the local hardware clock, the monotonic clock, and the real > clock. Allow a user to pick one of the clocks by using the printk.time > kernel parameter. Output the type of clock in > /sys/module/printk/parameters/time so userspace programs can interpret the > timestamp. > > Real clock & 32-bit systems: Selecting the real clock printk timestamp may > lead to unlikely situations where a timestamp is wrong because the real time > offset is read without the protection of a sequence lock in the call to > ktime_get_log_ts() in printk_get_ts(). > > v2: Use peterz's suggested Kconfig options. Merge patchset together. Fix > i386 !CONFIG_PRINTK builds. > > Signed-off-by: Prarit Bhargava ... > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index 98fe715522e8..7a8870b4ddbb 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -1,8 +1,39 @@ > menu "printk and dmesg options" > > +choice > + prompt "printk default clock" > + config PRINTK_TIME_DISABLE > + bool "Disabled" > + help > + Selecting this option disables the time stamps of printk(). > + > + config PRINTK_TIME_LOCAL > + bool "Local Clock" > + help > + Selecting this option causes the time stamps of printk() to be > + stamped with the unadjusted hardware clock. > + > + config PRINTK_TIME_MONO > + bool "CLOCK_MONOTONIC" > + help > + Selecting this option causes the time stamps of printk() to be > + stamped with the adjusted monotonic clock. > + > + config PRINTK_TIME_REAL > + bool "CLOCK_REALTIME" > + help > + Selecting this option causes the time stamps of printk() to be > + stamped with the adjusted realtime clock. Its been asked already, but I've not yet seen an answer. Is there a reason your not also adding PRINTK_TIME_BOOT here (which to me would be more generally useful then REAL or MONO)? thanks -john