Re: [PATCH] printk/tracing: Do not trace printk_nmi_enter()

From: Sergey Senozhatsky
Date: Fri Sep 07 2018 - 04:35:46 EST


On (09/07/18 10:28), Petr Mladek wrote:
> On Fri 2018-09-07 09:45:31, Peter Zijlstra wrote:
> > On Thu, Sep 06, 2018 at 11:31:51AM +0900, Sergey Senozhatsky wrote:
> > > An alternative option, thus, could be re-instating back the rule that
> > > lockdep_off/on should be the first and the last thing we do in
> > > nmi_enter/nmi_exit. E.g.
> > >
> > > nmi_enter()
> > > lockdep_off();
> > > printk_nmi_enter();
> > >
> > > nmi_exit()
> > > printk_nmi_exit();
> > > lockdep_on();
> >
> > Yes that. Also, those should probably be inline functions.
> >
> > ---
> > Subject: locking/lockdep: Fix NMI handling
> >
> > Someone put code in the NMI handler before lockdep_off(). Since lockdep
> > is not NMI safe, this wrecks stuff.
>
> My view is that nmi_enter() has to switch several features into
> NMI-safe mode. The code must not trigger the other features when
> they are still in the unsafe mode.
>
> It is a chicken&egg problem. And it is hard to completely prevent
> regressions caused by future changes.
>
> I though that printk_nmi_enter() should never need any lockdep-related
> code. On the other hand, people might want to printk debug messages
> when lockdep_off() is called. This is why I put it in the current order.
>
> That said, I am not against this change. Especially the inlining
> is a good move. Note that lockdep_off()/lockdep_on() must not
> be traced as well.

Should't printk_nmi_enter()/printk_nmi_exit() still be notrace?
Like you and Steven said - it's still before ftrace_nmi_enter()
and should be notrace regardless.

-ss