[PATCH] watchdog: hpwdt: Remove spinlock acquire and BIOS calls from NMI context

From: Ingo Molnar
Date: Wed Feb 14 2018 - 04:32:09 EST



* Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> wrote:

> Dave Hansen and I had some discussions on how to handle the nested NMI and
> firmware calls. We thought of using a per cpu counter to record the nesting
> call depth and toggle IBRS appropriately for the depth 0->1 and 1->0 transition.
> Will this change be sufficient?

Yeah, so I think the first question should be: does the firmware call from NMI
context make sense to begin with?

Because in this particular case it does not appear to be so: the reason for the
BIOS/firmware call appears to be to determine how we nmi_panic() after receiving
an NMI that no other NMI handler handled: with a passive-aggressive "I don't know"
panic message or with a slightly more informative panic message.

That's not a real value-add to users - so we can avoid all these complications by
applying the patch below:

drivers/watchdog/hpwdt.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)

As a bonus the spinlock use can be removed as well.

Thanks,

Ingo

====================>