Re: [PATCH v2] x86/nmi: Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus()

From: Waiman Long
Date: Tue Dec 03 2024 - 20:40:03 EST



On 12/3/24 8:00 PM, Rik van Riel wrote:
On Tue, 2024-12-03 at 10:07 -0500, Waiman Long wrote:
Another way to fix this problem while allowing panic() calls from
NMI context is by adding a new emergency NMI handler to the nmi_desc
structure and provide a new set_emergency_nmi_handler() helper to
atomically set crash_nmi_callback() in any context. The new emergency
handler will be invoked first before other handlers in the linked
list. That will eliminate the need to take any lock and serve the
panic
in NMI use case.

Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
I've seen that panic come by a number of times, but
never came up with a good fix.

Your idea certainly looks like it should work, and
avoid all the issues along the way.

Acked-by: Rik van Riel <riel@xxxxxxxxxxx>

Thanks for the review.

Cheers,
Longman