Re: [PATCH v6] kernel/trace: Add DISALLOW_TRACE_PRINTK make option

From: Steven Rostedt
Date: Mon Sep 28 2020 - 11:26:54 EST


On Mon, 28 Sep 2020 15:29:29 +0800
Nicolas Boichat <drinkcat@xxxxxxxxxxxx> wrote:

> trace_printk is meant as a debugging tool, and should not be
> compiled into production code without specific debug Kconfig
> options enabled, or 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 DISALLOW_TRACE_PRINTK=1 is passed on the make command
> line, the kernel will generate a build-time error if
> trace_printk is used. We expect distributors to set this
> option for their production kernels.
>
> Note that the code to handle trace_printk is still present,
> so this does not prevent people from compiling out-of-tree
> kernel modules, or BPF programs.
>
> Also, we are not making this a kernel config option as we
> want the developer convenience of being able to reuse a
> production kernel config, add trace_printk for debugging,
> and rebuild, without any config changes.
>
> Signed-off-by: Nicolas Boichat <drinkcat@xxxxxxxxxxxx>

Masahiro,

Are you OK with this change? If so can I have your Ack?

-- Steve