Re: [PATCH 2/2] kdb: Call vkdb_printf() from vprintk_default() only when wanted

From: Sergey Senozhatsky
Date: Sun Oct 23 2016 - 09:25:05 EST


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?

-ss

> r = vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
> return r;