[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC v5 5/8] pvqspinlock, x86: Enable unfair queue spinlock in a KVM guest

On 02/27/2014 04:41 AM, Paolo Bonzini wrote:
Il 26/02/2014 16:14, Waiman Long ha scritto:
This patch adds a KVM init function to activate the unfair queue
spinlock in a KVM guest when the PARAVIRT_UNFAIR_LOCKS kernel config
option is selected.

Signed-off-by: Waiman Long <Waiman.Long@xxxxxx>
 arch/x86/kernel/kvm.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 713f1b3..a489140 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -826,3 +826,20 @@ static __init int kvm_spinlock_init_jump(void)

+ * Enable unfair lock if running in a real para-virtualized environment
+ */
+static __init int kvm_unfair_locks_init_jump(void)
+    if (!kvm_para_available())
+        return 0;
+    static_key_slow_inc(&paravirt_unfairlocks_enabled);
+    printk(KERN_INFO "KVM setup unfair spinlock\n");
+    return 0;

I think this should apply to all paravirt implementations, unless pv_lock_ops.kick_cpu != NULL.


Unfair lock is currently implemented as an independent config option that can be turned on or off irrespective of the other PV settings. There are concern about lock starvation if there is a large number of virtual CPUs. So one idea that I have is to disable this feature if there is more than a certain number of virtual CPUs available. I will investigate this idea when I have time.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.