Re: [PATCH] serial: kgdb_nmi: Remove unused knock code

From: Doug Anderson
Date: Mon Jan 13 2025 - 16:55:16 EST


Hi,

On Sun, Jan 12, 2025 at 5:58 AM <linux@xxxxxxxxxxx> wrote:
>
> From: "Dr. David Alan Gilbert" <linux@xxxxxxxxxxx>
>
> kgdb_nmi_poll_knock() has been unused since it was added in 2013 in
> commit 0c57dfcc6c1d ("tty/serial: Add kgdb_nmi driver")
>
> Remove it, the static helpers, and module parameters it used.
>
> (The comment explaining why it might be used sounds sensible, but
> it's never been wired up, perhaps it's worth doing somewhere?)
>
> Signed-off-by: Dr. David Alan Gilbert <linux@xxxxxxxxxxx>
> ---
> drivers/tty/serial/kgdb_nmi.c | 101 ----------------------------------
> include/linux/kgdb.h | 2 -
> 2 files changed, 103 deletions(-)

I guess this functionality was supposed to be added in a later patch
in the series? I see a use of the call here:

https://lore.kernel.org/lkml/1348522080-32629-9-git-send-email-anton.vorontsov@xxxxxxxxxx/

...but that never landed...

Is the answer here that we should just fully revert commit
0c57dfcc6c1d ("tty/serial: Add kgdb_nmi driver")? From a quick glance
I also don't see any architectures that implement
`arch_kgdb_ops.enable_nmi`? I guess you'd also want to revert these
two maybe?

ad394f66fa57 kdb: Implement disable_nmi command
5a14fead07bc kernel/debug: Mask KGDB NMI upon entry

I don't know all of the history here. Maybe Daniel or Sumit do?


In general I've sorta given up on the idea of trying to run a serial
driver at NMI priority. I know Sumit had some patches for that where
he wanted to interpret sysrq-g at NMI time, but it always felt a
little fragile (and I guess never landed). IMO, having the serial port
be at normal priority level is nearly always enough when combined with
a watchdog that can use NMIs to break into a locked-up CPU.