[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161122121433.GC8220@pathway.suse.cz>
Date: Tue, 22 Nov 2016 13:14:33 +0100
From: Petr Mladek <pmladek@...e.com>
To: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc: Jason Wessel <jason.wessel@...driver.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kdb: Call vkdb_printf() from vprintk_default() only
when wanted
On Sun 2016-10-23 22:23:43, Sergey Senozhatsky wrote:
> On (10/21/16 14:50), Petr Mladek wrote:
> [..]
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index d5e397315473..db73e33811e7 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -1941,7 +1941,9 @@ int vprintk_default(const char *fmt, va_list args)
> > int r;
> >
> > #ifdef CONFIG_KGDB_KDB
> > - if (unlikely(kdb_trap_printk)) {
> > + /* Allow to pass printk() to kdb but avoid a recursion. */
> > + if (unlikely(kdb_trap_printk &&
> > + kdb_printf_cpu != smp_processor_id())) {
> ^^^^^
> aren't we are in preemptible here?
Yeah, I looked on this from one side only. "kdb_printf_cpu" is set
with disabled IRQs. Therefore the preemption is disabled if we
are in the recursion scenario. But you are right that we might
get a false positive if we are preempted in the middle of this check
and later scheduled on the CPU that called kdb_vprintf before.
Best Regards,
Petr
Powered by blists - more mailing lists