From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757153AbcBDR0p (ORCPT ); Thu, 4 Feb 2016 12:26:45 -0500 Received: from www.linutronix.de ([62.245.132.108]:40035 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756337AbcBDR0o (ORCPT ); Thu, 4 Feb 2016 12:26:44 -0500 Date: Thu, 4 Feb 2016 18:25:29 +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] printk, allow different timestamps for printk.time [v2] In-Reply-To: <20160204164824.GB3305@pathway.suse.cz> Message-ID: References: <1453985029-25912-1-git-send-email-prarit@redhat.com> <20160204164824.GB3305@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, 4 Feb 2016, Petr Mladek wrote: > On Thu 2016-01-28 07:43:49, Prarit Bhargava wrote: > > +static u64 printk_get_ts(void) > > +{ > > + u64 mono, offset_real; > > + > > + if (printk_time == 0) > > + return 0; > > + > > + if (printk_time == 1) > > + return local_clock(); > > + > > + mono = ktime_get_log_ts(&offset_real); > > + > > + if (printk_time == 2) > > + return mono; > > + > > + return mono + offset_real; > > At least dmesg is not capable to read the absolute size of the > real time. It expects offset against the start of the timekeeping > stuff or so. I get this: > > $> dmesg | tail -n 5 > [ 7.128924] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready > [ 0.000000] printk: timestamp set to 0. > [ 179.983704] printk: timestamp set to 1. > [ 181.895655] printk: timestamp set to 2. > [1454602412.026424] printk: timestamp set to 3. > > $dmesg -T -S | tail -n 5 > [Thu Feb 4 17:10:34 2016] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready > [Thu Feb 4 17:10:27 2016] printk: timestamp set to 0. > [Thu Feb 4 17:13:26 2016] printk: timestamp set to 1. > [Thu Feb 4 17:13:28 2016] printk: timestamp set to 2. > [Fri Mar 10 09:23:59 2062] printk: timestamp set to 3. > > Please, note that the last entry points to the year 2062. That's a problem of dmesg -T -S. It doesn't know that the timestamp (3) is actually CLOCKTIME_REAL already: -> 1454602412 / (3600 * 24 * 365) = 46.1251 -> 1970 + 46 = 2016 Thanks, tglx