Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4232798imj; Tue, 12 Feb 2019 12:08:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYSlehvU2lCIIjEWOBTmAmshKzbX2hzusUz5DbmbG3IINfN5U0fmqeGD4C1zYsA0Qmp3D7X X-Received: by 2002:a17:902:24e7:: with SMTP id l36mr5709961plg.61.1550002085996; Tue, 12 Feb 2019 12:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550002085; cv=none; d=google.com; s=arc-20160816; b=r51DI2NTJclPXFpPTCD+pL+2cI6pe2TYcA+qzIlKzbXM7R75LkOX/GVD8METChrtD/ jPB0P9rxAtxhsd/yR6+etsPdU0xD1EsV0/GS0SAFypSfnZNYUG0DEyDQ5Lrc/h68cRFv V8AEyfW2x4B6yY98JsnwDgpviCXKCR+W6H2fM1VtCbTvL7wOEPpFy/cDBozR0HNAFhO0 88E4HqomnIZkiNc2ICqDkuobUIMhTAqfdq3U/uSi5ps8hAwKqHi4scPxcxryhI22SCzo sJNupVgfVjiqI6JbJsDBx6v2ShRqkfjePYenrMIMsSSmz9O3/A/+P/9qwHgXqof48O2a ALZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=AVbZ4xlm8PIDLWazduS76AGDECMBJ28Hw3XdJMe7rxc=; b=eWqMyRSC31QGc+H5q3HvcbEw6vZONAdTlBtcF6lESp/eyQMWsWL3W4Nv+Mk37BymHq vuymEeyz+JBP34MLuq1UOrLO4vriwZxrTIJId78/lhWzoiitEvxWimnfPIDwwr3N9Itk RWBgcDJwDfAAlgTG6H7lQZaoK7YYKYMY9q56XjwUlPyLijbahgQg2+IguqF+bX3cOqZY /TOBdBUYbMUf8ZYuDSz/li6L+W7nIFZW8EwaVXIEv9leySuIMMpuyTN3OFsfruXqnkoF AURCRFCAPd03IyT9sgE1/P+vhuuuaaVCZ8bMUcACJ1v+q7umzh6t+0c8zCscoBoozYrv VRMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si12906061pgl.268.2019.02.12.12.07.49; Tue, 12 Feb 2019 12:08:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731999AbfBLTqJ (ORCPT + 99 others); Tue, 12 Feb 2019 14:46:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:44640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbfBLTqJ (ORCPT ); Tue, 12 Feb 2019 14:46:09 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2F7D222C1; Tue, 12 Feb 2019 19:46:07 +0000 (UTC) Date: Tue, 12 Feb 2019 14:46:06 -0500 From: Steven Rostedt To: Xiang Xiao Cc: pmladek@suse.com, sergey.senozhatsky@gmail.com, linux-kernel@vger.kernel.org, Xiang Xiao Subject: Re: [PATCH] printk: add KERN_NOTIME to skip the timestamp Message-ID: <20190212144606.4b7cf0f8@gandalf.local.home> In-Reply-To: <1549995065-27597-1-git-send-email-xiaoxiang@xiaomi.com> References: <1549995065-27597-1-git-send-email-xiaoxiang@xiaomi.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Feb 2019 02:11:05 +0800 Xiang Xiao wrote: > Because log may already add the timestamp sometime Can you be a bit more detailed on this. When and where does this happen? If anything, I would probably prefer that we export whether time is being printed, and have the caller not print time if printk is doing it already, than to add the complexity into printk itself. -- Steve > > Signed-off-by: Xiang Xiao > --- > include/linux/kern_levels.h | 2 ++ > include/linux/printk.h | 1 + > kernel/printk/printk.c | 7 ++++++- > 3 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h > index d237fe8..ed2aec6 100644 > --- a/include/linux/kern_levels.h > +++ b/include/linux/kern_levels.h > @@ -23,6 +23,8 @@ > */ > #define KERN_CONT KERN_SOH "c" > > +#define KERN_NOTIME KERN_SOH "t" /* don't print the timestamp */ > + > /* integer equivalents of KERN_ */ > #define LOGLEVEL_SCHED -2 /* Deferred messages from sched code > * are set to this special level */ > diff --git a/include/linux/printk.h b/include/linux/printk.h > index 77740a5..be12ac4 100644 > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -20,6 +20,7 @@ static inline int printk_get_level(const char *buffer) > case '0' ... '7': > case 'd': /* KERN_DEFAULT */ > case 'c': /* KERN_CONT */ > + case 't': /* KERN_NOTIME */ > return buffer[1]; > } > } > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index d3d1703..0688cf2 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -346,6 +346,7 @@ enum log_flags { > LOG_NEWLINE = 2, /* text ended with a newline */ > LOG_PREFIX = 4, /* text started with a prefix */ > LOG_CONT = 8, /* text is a fragment of a continuation line */ > + LOG_NOTIME = 16, /* don't print the timestamp */ > }; > > struct printk_log { > @@ -1247,7 +1248,7 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, > > if (syslog) > len = print_syslog((msg->facility << 3) | msg->level, buf); > - if (time) > + if (time && !(msg->flags & LOG_NOTIME)) > len += print_time(msg->ts_nsec, buf + len); > return len; > } > @@ -1873,6 +1874,10 @@ int vprintk_store(int facility, int level, > break; > case 'c': /* KERN_CONT */ > lflags |= LOG_CONT; > + break; > + case 't': /* KERN_NOTIME */ > + lflags |= LOG_NOTIME; > + break; > } > > text_len -= 2;