WSL2-Linux-Kernel/drivers/misc/pvpanic
Guilherme G. Piccoli ede2512937 misc/pvpanic: Convert regular spinlock into trylock on panic path
[ Upstream commit e918c10265 ]

The pvpanic driver relies on panic notifiers to execute a callback
on panic event. Such function is executed in atomic context - the
panic function disables local IRQs, preemption and all other CPUs
that aren't running the panic code.

With that said, it's dangerous to use regular spinlocks in such path,
as introduced by commit b3c0f87746 ("misc/pvpanic: probe multiple instances").
This patch fixes that by replacing regular spinlocks with the trylock
safer approach.

It also fixes an old comment (about a long gone framebuffer code) and
the notifier priority - we should execute hypervisor notifiers early,
deferring this way the panic action to the hypervisor, as expected by
the users that are setting up pvpanic.

Fixes: b3c0f87746 ("misc/pvpanic: probe multiple instances")
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Mihai Carabas <mihai.carabas@oracle.com>
Cc: Shile Zhang <shile.zhang@linux.alibaba.com>
Cc: Wang ShaoBo <bobo.shaobowang@huawei.com>
Cc: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20220427224924.592546-6-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:36:06 +02:00
..
Kconfig misc/pvpanic: add PCI driver 2021-03-28 14:57:11 +02:00
Makefile misc/pvpanic: add PCI driver 2021-03-28 14:57:11 +02:00
pvpanic-mmio.c pvpanic: Fix typos in the comments 2022-06-14 18:36:06 +02:00
pvpanic-pci.c misc/pvpanic-pci: Allow automatic loading 2021-07-21 14:57:58 +02:00
pvpanic.c misc/pvpanic: Convert regular spinlock into trylock on panic path 2022-06-14 18:36:06 +02:00
pvpanic.h misc/pvpanic: Make 'pvpanic_probe()' resource managed 2021-05-27 14:46:57 +02:00