Re: [PATCH 2/2 v9] printk: Add monotonic, boottime, and realtime timestamps

From: Thomas Gleixner
Date: Fri Aug 25 2017 - 15:02:11 EST


On Fri, 25 Aug 2017, Prarit Bhargava wrote:
> +
> + if (printk_time_source == PRINTK_TIME_UNDEFINED)
> + printk_time_source = _printk_time;
> +#ifndef CONFIG_PRINTK_TIME_DEBUG
> + else if ((printk_time_source != _printk_time) &&
> + (_printk_time != PRINTK_TIME_DISABLED)) {

You can avoid the #ifdef ugliness by writing this as:

} else if (IS_ENABLED(CONFIG_PRINTK_DEBUG) &&
printk_time_source != _prinkt_time &&
_printk_time != PRINTK_TIME_DISABLED) {

Aside of that I'm not too fond of that extra config switch. Why shouldn't
we allow the admin to switch between time sources as he sees fit by
default? It's not Joe user who is allowed to do that and in general we give
admins the biggest guns we have to shoot themself in the foot.

Seriously, switching it is not making anything explode, insecure or
whatever dangerous. It's merily changing the time stamp source so dmesg and
syslog get harder to parse.

Thanks,

tglx