[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200624135722.GF6578@ziepe.ca>
Date: Wed, 24 Jun 2020 10:57:22 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Nicolas Boichat <drinkcat@...omium.org>
Cc: linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Peter Zijlstra <peterz@...radead.org>,
Vinod Koul <vkoul@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Thomas Gleixner <tglx@...utronix.de>,
"Guilherme G . Piccoli" <gpiccoli@...onical.com>,
Will Deacon <will@...nel.org>, dianders@...omium.org,
groeck@...omium.org
Subject: Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option
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@...omium.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
Powered by blists - more mailing lists