summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds2013-10-16 01:22:51 +0200
committerLinus Torvalds2013-10-16 01:22:51 +0200
commitb83aea88d3ab24a427351b496e64f0725ab09bc3 (patch)
treeb06b697c89ea7dda0daaebb149fd356ee7dac833
parentMerge tag 'stable/for-linus-3.12-rc4-tag' of git://git.kernel.org/pub/scm/lin... (diff)
parentKVM: Enable pvspinlock after jump_label_init() to avoid VM hang (diff)
downloadkernel-qcow2-linux-b83aea88d3ab24a427351b496e64f0725ab09bc3.tar.gz
kernel-qcow2-linux-b83aea88d3ab24a427351b496e64f0725ab09bc3.tar.xz
kernel-qcow2-linux-b83aea88d3ab24a427351b496e64f0725ab09bc3.zip
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm fix from Gleb Natapov. * git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: Enable pvspinlock after jump_label_init() to avoid VM hang
-rw-r--r--arch/x86/kernel/kvm.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 697b93af02dd..a0e2a8a80c94 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -775,11 +775,22 @@ void __init kvm_spinlock_init(void)
if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
return;
- printk(KERN_INFO "KVM setup paravirtual spinlock\n");
+ pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning);
+ pv_lock_ops.unlock_kick = kvm_unlock_kick;
+}
+
+static __init int kvm_spinlock_init_jump(void)
+{
+ if (!kvm_para_available())
+ return 0;
+ if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
+ return 0;
static_key_slow_inc(&paravirt_ticketlocks_enabled);
+ printk(KERN_INFO "KVM setup paravirtual spinlock\n");
- pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning);
- pv_lock_ops.unlock_kick = kvm_unlock_kick;
+ return 0;
}
+early_initcall(kvm_spinlock_init_jump);
+
#endif /* CONFIG_PARAVIRT_SPINLOCKS */