Messages in this thread Patch in this message | | | Date | Thu, 4 Feb 2016 17:48:24 +0100 | From | Petr Mladek <> | Subject | Re: [PATCH] printk, allow different timestamps for printk.time [v2] |
| |
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.
> --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -13,7 +13,7 @@ config PRINTK_TIME > be included, not that the timestamp is recorded. > > The behavior is also controlled by the kernel command line > - parameter printk.time=1. See Documentation/kernel-parameters.txt > + parameter printk.time=[0-3]. See Documentation/kernel-parameters.txt
Please, mention there the mention of the numbers. The cross reference is annoying if you look at the help when configuring kernel build.
Also there is a mismatch between the values and the type of CONFIG_PRINTK_TIME. You should change it to
int "Show timing information on printks" range 0 3
Then you need to update the default value for all architectures in all arch/*/configs/*_defconfig
It seems that it is enabled in most architectures. I would suggest to define
default "1" in lib/Kconfig.debug. Then you could remove the definition from most defconfigs. The advantage is that even "make oldconfig" will propose reasonable default.
Best Regards, Petr
PS: Please, put version number to the subject, e.g. [PATCH v4]. It makes it slightly easier to orientate in the variants ;-)
| |