Re: [PATCH 1/3] printk: Fix kdb_trap_printk placement

From: Greg Kroah-Hartman
Date: Thu Oct 12 2017 - 08:08:26 EST


On Thu, Oct 12, 2017 at 01:52:29PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Oct 12, 2017 at 01:34:39PM +0200, Peter Zijlstra wrote:
> > On Thu, Oct 12, 2017 at 12:03:04PM +0200, Petr Mladek wrote:
> > > On Thu 2017-10-12 11:45:37, Petr Mladek wrote:
> > > > Hi,
> > > >
> > > > I thought about this a lot from several angles. And I would prefer
> > > > sligly different placement, see the patch below.
> > > >
> > > > On Thu 2017-09-28 14:18:24, Peter Zijlstra wrote:
> > > > > Some people figured vprintk_emit() makes for a nice API and exported
> > > > > it, bypassing the kdb trap.
> > > >
> > > > Sigh, printk() API is pretty complicated and this export
> > > > made it much worse. Well, there are two things:
> > > >
> > > > First, kdb_trap_printk name is a bit misleading. It is not a
> > > > generic trap of any printk message. Instead it seems to be
> > > > used to redirect only particular messages from some existing
> > > > functions, e.g. show_regs() called from kdb_dumpregs().
> > > >
> > > > Second, it seems that the only user of the exported vprintk_emit()
> > > > is dev_vprintk_emit(). I believe that code using this wrapper
> > > > is not called in the sections where kdb_trap_printk is incremented.
> > >
> > > Well, I wonder if we should go even further and stop exporting
> > > vprintk_emit(). IMHO, the only reason was dev_print_emit() and
> > > the ability to pass the extra "dict" parameter.
> >
> > You have my blessing there, but the device folks might have an opinion
> > on that; Cc'ed Gregkh.
>
> Hm, we "need" that dict option, otherwise the whole dev_printk() family
> of messages will not work properly, right?
>
> Or am I missing something? If you can figure out a way to still support
> the same thing (we need a prefix at the beginning of the message that
> shows the device/driver/binding/etc that emitted the message), that's
> fine with me, I'm not wed to vprintk_emit() :)

Nope, this doesn't seem to deal with the prefix, except in some odd way
that is tied to the dynamic debugging logic. I really don't know what
this does anymore. Joe wrote it in 2012 as part of the dynamic debug
code.

Joe, any thoughts?

thanks,

greg k-h