[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180518081042.6n6guianv3v53e4f@pathway.suse.cz>
Date: Fri, 18 May 2018 10:10:42 +0200
From: Petr Mladek <pmladek@...e.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
linux-kernel@...r.kernel.org, "4 . 13+" <stable@...r.kernel.org>
Subject: Re: [PATCH] printk/nmi: Prevent deadlock when serializing NMI
backtraces
On Fri 2018-05-18 15:38:20, Sergey Senozhatsky wrote:
> On (05/18/18 11:07), Sergey Senozhatsky wrote:
> >
> > if (this_cpu_read(printk_context) & PRINTK_SAFE_CONTEXT_MASK) ||
> > raw_spin_is_locked(&logbuf_lock)
> >
> > just to check per-CPU `printk_context' first and only afterwards
> > access the global `logbuf_lock'. printk_nmi_enter() happens on
> > every CPU, so maybe we can avoid some overhead by checking the
> > local per-CPU data first.
>
> Nah, may be it won't. This, probably, would have been the case if we
> had continue to call console drivers from printk_safe section [at least].
> CPUs don't spend that much time in printk_safe sections.
Yeah, I do not think that the more complicated code is worth it.
There is really minimal chance to hit printk_safe context on the given
CPU. The eventual win would be negligible to the cost of printk().
In case of trigger_all_cpu_backtrace(), most CPUs spend a lot
of time waiting for the spinlock in nmi_cpu_backtrace() anyway.
Thanks for the ack.
Best Regards,
Petr
Powered by blists - more mailing lists