From: Guo Ren <guo...@linux.alibaba.com>

Add kconfig entry for paravirt_spinlock, an unfair qspinlock
virtualization-friendly backend, by halting the virtual CPU rather
than spinning.

Signed-off-by: Guo Ren <guo...@linux.alibaba.com>
Signed-off-by: Guo Ren <guo...@kernel.org>
---
 arch/riscv/Kconfig         | 12 ++++++++++++
 arch/riscv/kernel/Makefile |  1 +
 2 files changed, 13 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 4bcff2860f48..ec0da24ed6fb 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -813,6 +813,18 @@ config RELOCATABLE
 
           If unsure, say N.
 
+config PARAVIRT_SPINLOCKS
+       bool "Paravirtualization layer for spinlocks"
+       depends on QUEUED_SPINLOCKS
+       default y
+       help
+         Paravirtualized spinlocks allow a unfair qspinlock to replace the
+         test-set kvm-guest virt spinlock implementation with something
+         virtualization-friendly, for example, halt the virtual CPU rather
+         than spinning.
+
+         If you are unsure how to answer this question, answer Y.
+
 endmenu # "Kernel features"
 
 menu "Boot options"
diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile
index 671ad85f28f2..114b29234c46 100644
--- a/arch/riscv/kernel/Makefile
+++ b/arch/riscv/kernel/Makefile
@@ -103,3 +103,4 @@ obj-$(CONFIG_ARCH_RV64ILP32)        += compat_signal.o
 
 obj-$(CONFIG_64BIT)            += pi/
 obj-$(CONFIG_ACPI)             += acpi.o
+obj-$(CONFIG_PARAVIRT_SPINLOCKS) += qspinlock_paravirt.o
-- 
2.36.1

Reply via email to