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

Guo Ren guoren at kernel.org
Sat Dec 21 19:57:10 PST 2024


On Mon, Dec 16, 2024 at 5:47 PM Radim Krčmář <rkrcmar at ventanamicro.com> wrote:
>
> 2024-12-15T11:13:22-0500, guoren at kernel.org:
> > 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?

Here is the up-to-date paravirtualized slowpath version:
https://lore.kernel.org/linux-riscv/20241222033917.1754495-1-guoren@kernel.org/

We could continue the discussion on the SBI spec side.

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



-- 
Best Regards
 Guo Ren



More information about the linux-riscv mailing list