From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753067AbcCJPhK (ORCPT ); Thu, 10 Mar 2016 10:37:10 -0500 Received: from www.linutronix.de ([62.245.132.108]:33448 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753086AbcCJPgs (ORCPT ); Thu, 10 Mar 2016 10:36:48 -0500 Date: Thu, 10 Mar 2016 16:35:16 +0100 (CET) From: Thomas Gleixner To: Petr Mladek cc: Prarit Bhargava , linux-kernel@vger.kernel.org, John Stultz , Xunlei Pang , Baolin Wang , Andrew Morton , Greg Kroah-Hartman , Tejun Heo , Peter Hurley , Vasily Averin , Joe Perches Subject: Re: [PATCH 0/2 v6] printk, Add monotonic and real printk timestamps In-Reply-To: <20160310100012.GQ10940@pathway.suse.cz> Message-ID: References: <1456250040-22351-1-git-send-email-prarit@redhat.com> <56DEB17C.9000201@redhat.com> <20160310100012.GQ10940@pathway.suse.cz> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Mar 2016, Petr Mladek wrote: > On Tue 2016-03-08 06:03:24, Prarit Bhargava wrote: > > > > > > On 03/08/2016 02:59 AM, Thomas Gleixner wrote: > > > On Tue, 23 Feb 2016, Prarit Bhargava wrote: > > > > > >> This patchset adds monotonic and real printk timestamps. The first patch > > >> changes CONFIG_PRINT_TIME from a bool to an int to allow for the additional > > >> timestamps that are added in patch 2. > > >> > > >> Changes from v6: Petr Mladek pointed out that the current patch > > >> fails to indicate to userspace programs which timestamp is being used. > > > > > > How is that solved? > > > > Hi Thomas, > > > > Userspace programs can now look at /sys/modules/printk/parameters/time which > > will contain [0-3] for the timestamp clock. > > But it includes only the current setting that is valid only for > messages printed with this setting. The ring buffer might include > different messages produced with different setting. > > I suggest to look how dmesg handles the time stamp. I wonder how it > converts the relative time into an absolute one. I wonder if you > could convert all timestamps to the relative format, so that you > do not need to change all userspace tools at all. ctime = system_boot_time + dmesg_stamp The reason why you see wrong values here is that dmesg_stamp is not based on clock monotonic. So if printk uses clock monotonic, dmesg does not have to be changed. Though you have to know, that the above is a linearized history because system_boot_time is clock_monotonic_now() + boot_offset So you can't observe stuff like leap seconds, settimeofday or other things which result in a non linear behaviour of clock realtime. Thanks, tglx