Re: [PATCH] riscv: qspinlock: Add virt_spin_lock() support for KVM guests

From: Radim Krčmář
Date: Mon Dec 16 2024 - 04:48:11 EST


2024-12-15T11:13:22-0500, guoren@xxxxxxxxxx:
> Add a static key controlling whether virt_spin_lock() should be
> called or not. When running on bare metal set the new key to
> false.

Wouldn't re-using the combo spinlock qspinlock_key be better?

> The VM guests should fall back to a Test-and-Set spinlock,
> because fair locks have horrible lock 'holder' preemption issues.
> The virt_spin_lock_key would shortcut for the queued_spin_lock_-
> slowpath() function that allow virt_spin_lock to hijack it.

I think we want the proper paravirtualized slowpath, have the
discussions stalled on the SBI side?

Btw. how bad are the performance numbers without this patch?

Thanks.