On Wed, Apr 03, 2024 at 02:11:09PM +0800, liu....@h3c.com wrote: > From: LiuYe <liu....@h3c.com> > > Currently, if CONFIG_KDB_KEYBOARD is enabled, then kgdboc will > attempt to use schedule_work() to provoke a keyboard reset when > transitioning out of the debugger and back to normal operation. > This can cause deadlock because schedule_work() is not NMI-safe. > > <snip> > > We fix the problem by using irq_work to call schedule_work() > instead of calling it directly. This is because we cannot > resynchronize the keyboard state from the hardirq context > provided by irq_work. This must be done from the task context > in order to call the input subsystem. > > Therefore, we have to defer the work twice. First, safely > switch from the debug trap context (similar to NMI) to the > hardirq, and then switch from the hardirq to the system work queue. > > Signed-off-by: LiuYe <liu....@h3c.com> > Co-authored-by: Daniel Thompson <daniel.thomp...@linaro.org> > Signed-off-by: Daniel Thompson <daniel.thomp...@linaro.org>
I'm happy with how this is looking. In the long term it might be good to move the keyboard resync code so it is with the rest of the kdb keyboard code rather than in tty/serial. However I certainly don't want to tangle that kind of clean up along with a bug fix so I think this is ready to go now. @Greg: I assume you want to take this via the tty/serial tree? I contributed a fair bit to the eventual patch so a Reviewed-by from me probably isn't appropriate but if you want to take the code it is certainly: Acked-by: Daniel Thompson <daniel.thomp...@linaro.org> Daniel. _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport