Skip to content

Commit b83aea8

Browse files
committed
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
2 parents 3670426 + 3dbef3e commit b83aea8

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎arch/x86/kernel/kvm.c‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,22 @@ void __init kvm_spinlock_init(void)
775775
if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
776776
return;
777777

778-
printk(KERN_INFO "KVM setup paravirtual spinlock\n");
778+
pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning);
779+
pv_lock_ops.unlock_kick = kvm_unlock_kick;
780+
}
781+
782+
static __init int kvm_spinlock_init_jump(void)
783+
{
784+
if (!kvm_para_available())
785+
return 0;
786+
if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
787+
return 0;
779788

780789
static_key_slow_inc(&paravirt_ticketlocks_enabled);
790+
printk(KERN_INFO "KVM setup paravirtual spinlock\n");
781791

782-
pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(kvm_lock_spinning);
783-
pv_lock_ops.unlock_kick = kvm_unlock_kick;
792+
return 0;
784793
}
794+
early_initcall(kvm_spinlock_init_jump);
795+
785796
#endif /* CONFIG_PARAVIRT_SPINLOCKS */

0 commit comments

Comments
 (0)