public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Peter Zijlstra <peterz@infradead.org>,
	Vinod Koul <vkoul@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Guilherme G . Piccoli" <gpiccoli@canonical.com>,
	Will Deacon <will@kernel.org>,
	dianders@chromium.org, groeck@chromium.org
Subject: Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option
Date: Wed, 24 Jun 2020 10:57:22 -0300	[thread overview]
Message-ID: <20200624135722.GF6578@ziepe.ca> (raw)
In-Reply-To: <20200624084524.259560-1-drinkcat@chromium.org>

On Wed, Jun 24, 2020 at 04:45:24PM +0800, Nicolas Boichat wrote:
> trace_printk is only meant as a debugging tool, and should never be
> compiled into production code without source code changes, as
> indicated by the warning that shows up on boot if any trace_printk
> is called:
>  **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
>  **                                                      **
>  ** trace_printk() being used. Allocating extra memory.  **
>  **                                                      **
>  ** This means that this is a DEBUG kernel and it is     **
>  ** unsafe for production use.                           **
> 
> If this option is set to n, the kernel will generate a build-time
> error if trace_printk is used.
> 
> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
>  include/linux/kernel.h | 17 ++++++++++++++++-
>  kernel/trace/Kconfig   |  9 +++++++++
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 196607aaf653082..b6addc6ba669e85 100644
> +++ b/include/linux/kernel.h
> @@ -721,10 +721,15 @@ do {									\
>  #define trace_printk(fmt, ...)				\
>  do {							\
>  	char _______STR[] = __stringify((__VA_ARGS__));	\
> +							\
> +	__static_assert(				\
> +		IS_ENABLED(CONFIG_TRACING_ALLOW_PRINTK),\
> +		"trace_printk called, please enable CONFIG_TRACING_ALLOW_PRINTK."); \
> +							\

Why __static_assert not normal static_assert?

Jason

  reply	other threads:[~2020-06-24 13:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24  8:45 [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option Nicolas Boichat
2020-06-24 13:57 ` Jason Gunthorpe [this message]
2020-06-25  1:13   ` Nicolas Boichat
2020-06-24 16:04 ` Steven Rostedt
2020-06-24 17:25   ` Alexei Starovoitov
2020-06-25  2:00     ` Nicolas Boichat
2020-06-25  3:59       ` Alexei Starovoitov
2020-06-26 22:14         ` Steven Rostedt
2020-06-28 17:27           ` Alexei Starovoitov
2020-06-28 18:46             ` Steven Rostedt
2020-06-28 19:00               ` Steven Rostedt
2020-06-28 19:21               ` Alexei Starovoitov
2020-06-28 19:43                 ` Steven Rostedt
2020-06-28 22:02                   ` Alexei Starovoitov
2020-06-28 22:28                     ` Steven Rostedt
2020-06-28 23:43                       ` Steven Rostedt
2020-06-30  5:16                         ` Alexei Starovoitov
2020-06-30 12:39                           ` Steven Rostedt
2020-06-25  1:32   ` Nicolas Boichat
2020-06-24 17:37 ` kernel test robot
2020-06-24 19:07 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200624135722.GF6578@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=drinkcat@chromium.org \
    --cc=gpiccoli@canonical.com \
    --cc=groeck@chromium.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox