aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2018-05-17 10:54:24 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-05-17 13:12:13 -0400
commit633711e82878dc29083fc5d2605166755e25b57a (patch)
tree7abc99cfd5b05e144b41d7b56a4b929cf7a1e19d
parent711702b57cc3c50b84bd648de0f1ca0a378805be (diff)
kvm: rename KVM_HINTS_DEDICATED to KVM_HINTS_REALTIME
KVM_HINTS_DEDICATED seems to be somewhat confusing: Guest doesn't really care whether it's the only task running on a host CPU as long as it's not preempted. And there are more reasons for Guest to be preempted than host CPU sharing, for example, with memory overcommit it can get preempted on a memory access, post copy migration can cause preemption, etc. Let's call it KVM_HINTS_REALTIME which seems to better match what guests expect. Also, the flag most be set on all vCPUs - current guests assume this. Note so in the documentation. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--Documentation/virtual/kvm/cpuid.txt6
-rw-r--r--arch/x86/include/uapi/asm/kvm_para.h2
-rw-r--r--arch/x86/kernel/kvm.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/Documentation/virtual/kvm/cpuid.txt b/Documentation/virtual/kvm/cpuid.txt
index d4f33eb805dd..ab022dcd0911 100644
--- a/Documentation/virtual/kvm/cpuid.txt
+++ b/Documentation/virtual/kvm/cpuid.txt
@@ -72,8 +72,8 @@ KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side
72 72
73flag || value || meaning 73flag || value || meaning
74================================================================================== 74==================================================================================
75KVM_HINTS_DEDICATED || 0 || guest checks this feature bit to 75KVM_HINTS_REALTIME || 0 || guest checks this feature bit to
76 || || determine if there is vCPU pinning 76 || || determine that vCPUs are never
77 || || and there is no vCPU over-commitment, 77 || || preempted for an unlimited time,
78 || || allowing optimizations 78 || || allowing optimizations
79---------------------------------------------------------------------------------- 79----------------------------------------------------------------------------------
diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h
index 4c851ebb3ceb..0ede697c3961 100644
--- a/arch/x86/include/uapi/asm/kvm_para.h
+++ b/arch/x86/include/uapi/asm/kvm_para.h
@@ -29,7 +29,7 @@
29#define KVM_FEATURE_PV_TLB_FLUSH 9 29#define KVM_FEATURE_PV_TLB_FLUSH 9
30#define KVM_FEATURE_ASYNC_PF_VMEXIT 10 30#define KVM_FEATURE_ASYNC_PF_VMEXIT 10
31 31
32#define KVM_HINTS_DEDICATED 0 32#define KVM_HINTS_REALTIME 0
33 33
34/* The last 8 bits are used to indicate how to interpret the flags field 34/* The last 8 bits are used to indicate how to interpret the flags field
35 * in pvclock structure. If no bits are set, all flags are ignored. 35 * in pvclock structure. If no bits are set, all flags are ignored.
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 7867417cfaff..5b2300b818af 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -457,7 +457,7 @@ static void __init sev_map_percpu_data(void)
457static void __init kvm_smp_prepare_cpus(unsigned int max_cpus) 457static void __init kvm_smp_prepare_cpus(unsigned int max_cpus)
458{ 458{
459 native_smp_prepare_cpus(max_cpus); 459 native_smp_prepare_cpus(max_cpus);
460 if (kvm_para_has_hint(KVM_HINTS_DEDICATED)) 460 if (kvm_para_has_hint(KVM_HINTS_REALTIME))
461 static_branch_disable(&virt_spin_lock_key); 461 static_branch_disable(&virt_spin_lock_key);
462} 462}
463 463
@@ -553,7 +553,7 @@ static void __init kvm_guest_init(void)
553 } 553 }
554 554
555 if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && 555 if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
556 !kvm_para_has_hint(KVM_HINTS_DEDICATED) && 556 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
557 kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) 557 kvm_para_has_feature(KVM_FEATURE_STEAL_TIME))
558 pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others; 558 pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others;
559 559
@@ -649,7 +649,7 @@ static __init int kvm_setup_pv_tlb_flush(void)
649 int cpu; 649 int cpu;
650 650
651 if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) && 651 if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
652 !kvm_para_has_hint(KVM_HINTS_DEDICATED) && 652 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
653 kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) { 653 kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
654 for_each_possible_cpu(cpu) { 654 for_each_possible_cpu(cpu) {
655 zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu), 655 zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu),
@@ -745,7 +745,7 @@ void __init kvm_spinlock_init(void)
745 if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT)) 745 if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
746 return; 746 return;
747 747
748 if (kvm_para_has_hint(KVM_HINTS_DEDICATED)) 748 if (kvm_para_has_hint(KVM_HINTS_REALTIME))
749 return; 749 return;
750 750
751 __pv_init_lock_hash(); 751 __pv_init_lock_hash();