@@ -1048,6 +1048,11 @@ void __init kvm_spinlock_init(void)
return;
}
+ if (kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
+ pv_ops.lock.vcpu_is_preempted =
+ PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
+ }
+
/*
* Disable PV spinlocks and use native qspinlock when dedicated pCPUs
* are available.
@@ -1076,10 +1081,6 @@ void __init kvm_spinlock_init(void)
pv_ops.lock.wait = kvm_wait;
pv_ops.lock.kick = kvm_kick_cpu;
- if (kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
- pv_ops.lock.vcpu_is_preempted =
- PV_CALLEE_SAVE(__kvm_vcpu_is_preempted);
- }
/*
* When PV spinlock is enabled which is preferred over
* virt_spin_lock(), virt_spin_lock_key's value is meaningless.