[PATCH V3 09/11] video/hyperv_fb: Avoid taking busy spinlock on panic path
Guilherme G. Piccoli
gpiccoli at igalia.com
Sun Sep 18 07:12:15 PDT 2022
On 19/08/2022 19:17, Guilherme G. Piccoli wrote:
> The Hyper-V framebuffer code registers a panic notifier in order
> to try updating its fbdev if the kernel crashed. The notifier
> callback is straightforward, but it calls the vmbus_sendpacket()
> routine eventually, and such function takes a spinlock for the
> ring buffer operations.
>
> Panic path runs in atomic context, with local interrupts and
> preemption disabled, and all secondary CPUs shutdown. That said,
> taking a spinlock might cause a lockup if a secondary CPU was
> disabled with such lock taken. Fix it here by checking if the
> ring buffer spinlock is busy on Hyper-V framebuffer panic notifier;
> if so, bail-out avoiding the potential lockup scenario.
>
> Cc: Andrea Parri (Microsoft) <parri.andrea at gmail.com>
> Cc: Dexuan Cui <decui at microsoft.com>
> Cc: Haiyang Zhang <haiyangz at microsoft.com>
> Cc: "K. Y. Srinivasan" <kys at microsoft.com>
> Cc: Michael Kelley <mikelley at microsoft.com>
> Cc: Stephen Hemminger <sthemmin at microsoft.com>
> Cc: Tianyu Lan <Tianyu.Lan at microsoft.com>
> Cc: Wei Liu <wei.liu at kernel.org>
> Tested-by: Fabio A M Martins <fabiomirmar at gmail.com>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli at igalia.com>
>
> ---
>
> V3:
> - simplified the code based on Michael's suggestion - thanks!
>
> V2:
> - new patch, based on the discussion in [0].
> [0] https://lore.kernel.org/lkml/2787b476-6366-1c83-db80-0393da417497@igalia.com/
>
>
> drivers/hv/ring_buffer.c | 13 +++++++++++++
> drivers/video/fbdev/hyperv_fb.c | 8 +++++++-
> include/linux/hyperv.h | 2 ++
> 3 files changed, 22 insertions(+), 1 deletion(-)
> [...]
Hi Michael, apologies for the ping.
Any reviews/comments on this one are greatly appreciated!
Cheers,
Guilherme
More information about the kexec
mailing list