Re: [PATCH] do not call trace_printk on non-debug build

From: Steven Rostedt
Date: Tue Apr 24 2018 - 15:14:26 EST


On Tue, 24 Apr 2018 19:02:34 +0000
Wei Wang <wvw@xxxxxxxxxx> wrote:

> We have seen many cases vendor have shipped kernel/drivers with it, and
> have to clean up that every year. This was brought up in an internal
> discussion and Greg suggested have some feedback from upstream about what
> should be taken to prevent this globally besides fixing individual drivers.
> From him "I think this change makes sense at a high level, but there could
> be non-obvious reasons why this isn't the way things are handled right now."

The thing is, trace_printk() should not be used except for development
and debugging. There should be no use cases in the kernel that us it,
unless it's part of something else that should never be used (I use it
for the ring buffer benchmark which itself will destabilize the
system and is why I use it - I want that warning for it too).

Any trace_printk() in a patch submitted to the kernel should simply be
stripped out. If someone wants a trace_printk() in their code, then
they should create a trace event, which is the proper way of retrieving
static data from the kernel. Using trace_printk() is just a lazy fast
way to create trace events.

Hmm, ideally I think check_patch needs to add a warning if
trace_printk() is used.

-- Steve