All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: setup_vmcs_config: disable TSC scaling on unlike processors
@ 2016-12-02  2:32 Don Bowman
  2016-12-02 15:07 ` Radim Krčmář
  0 siblings, 1 reply; 17+ messages in thread
From: Don Bowman @ 2016-12-02  2:32 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar

Add an enable_tsc_scaling parameter to kvm

Signed-off-by: Don Bowman <db@donbowman.ca>
---

My system has what i thought were two identical processors (same
stepping ID etc).
However, bafflingly, one of them has the ability to do TSC scaling,
and one does not (as reported in the vmcs).

This in turn causes kvm to give up entirely.

I feel a better solution is to mask off this capability on the one processor.
If enable_tsc_scaling is set false, the feature is ignored, and all
processors end up matching each other, enabling acceleration.

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 5382b82..5ace575 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -103,6 +103,9 @@ module_param_named(enable_shadow_vmcs,
enable_shadow_vmcs, bool, S_IRUGO);
 static bool __read_mostly nested = 0;
 module_param(nested, bool, S_IRUGO);

+static bool __read_mostly enable_tsc_scaling = true;
+module_param(enable_tsc_scaling, bool, S_IRUGO);
+
 static u64 __read_mostly host_xss;

 static bool __read_mostly enable_pml = 1;
@@ -3449,6 +3452,8 @@ static __init int setup_vmcs_config(struct
vmcs_config *vmcs_conf)
        vmcs_conf->pin_based_exec_ctrl = _pin_based_exec_control;
        vmcs_conf->cpu_based_exec_ctrl = _cpu_based_exec_control;
        vmcs_conf->cpu_based_2nd_exec_ctrl = _cpu_based_2nd_exec_control;
+        if (!enable_tsc_scaling)
+            vmcs_conf->cpu_based_2nd_exec_ctrl &= ~SECONDARY_EXEC_TSC_SCALING;
        vmcs_conf->vmexit_ctrl         = _vmexit_control;
        vmcs_conf->vmentry_ctrl        = _vmentry_control;

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-12-14 12:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02  2:32 PATCH: setup_vmcs_config: disable TSC scaling on unlike processors Don Bowman
2016-12-02 15:07 ` Radim Krčmář
2016-12-02 19:10   ` Don Bowman
2016-12-02 20:58     ` Don Bowman
2016-12-05 16:37       ` Radim Krčmář
2016-12-06  8:49   ` David Hildenbrand
2016-12-06  9:09     ` Paolo Bonzini
2016-12-06 11:08       ` Radim Krčmář
2016-12-07 11:37         ` David Hildenbrand
2016-12-07 15:25           ` Radim Krčmář
2016-12-08 11:46             ` David Hildenbrand
2016-12-08 14:32               ` Radim Krčmář
2016-12-09 15:12                 ` Don Bowman
2016-12-13 15:43                   ` Radim Krčmář
2016-12-14  4:07                     ` Don Bowman
2016-12-14 12:30                       ` Paolo Bonzini
2016-12-14 12:46                     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.