Re: [PATCH 1/3] printk: Fix kdb_trap_printk placement
From: Petr Mladek
Date: Mon Oct 09 2017 - 11:06:06 EST
On Thu 2017-10-05 15:42:27, Peter Zijlstra wrote:
> On Thu, Oct 05, 2017 at 03:38:44PM +0200, Petr Mladek wrote:
> > Or can the kdb console commands be called in NMI context?
>
> IIRC most of KDB runs from NMI context.
To be honest, I am not familiar with kdb. I tried the following
from Documentation/dev-tools/kgdb.rst:
$> echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc
$> echo g >/proc/sysrq-trigger
Result: I was able to do kdb commands on the serial console.
Note: It seems that this stuff was _not_ running in NMI.
Then I tried to set breakpoint for a function that is
called in NMI context:
$kdb> bt show_regs
Where show_regs() is called from nmi_cpu_backtrace(). I unblocked
the system and triggered ''l'' sysrq to show stacks from all CPUs:
$kdb> go
$> echo l >/proc/sysrq-trigger
Result: The system frozen and I had to reboot using a power switch.
I wonder if the break point in NMI is supposed to work and if the
kdb commands are handled in NMI context on the serial console then.
By other words, do you need this patch for a particular use-case?
Or did you added this patch just to fix a theoretical problem?
Best Regards,
Petr