[PATCH 04/30] firmware: google: Convert regular spinlock into trylock on panic path
Steven Rostedt
rostedt at goodmis.org
Wed May 11 03:20:15 AEST 2022
On Tue, 10 May 2022 13:38:39 +0200
Petr Mladek <pmladek at suse.com> wrote:
> As already mentioned in the other reply, panic() sometimes stops
> the other CPUs using NMI, for example, see kdump_nmi_shootdown_cpus().
>
> Another situation is when the CPU using the lock ends in some
> infinite loop because something went wrong. The system is in
> an unpredictable state during panic().
>
> I am not sure if this is possible with the code under gsmi_dev.lock
> but such things really happen during panic() in other subsystems.
> Using trylock in the panic() code path is a good practice.
I believe that Peter Zijlstra had a special spin lock for NMIs or early
printk, where it would not block if the lock was held on the same CPU. That
is, if an NMI happened and paniced while this lock was held on the same
CPU, it would not deadlock. But it would block if the lock was held on
another CPU.
-- Steve
More information about the Linuxppc-dev
mailing list