[Devel] [PATCH RHEL7 COMMIT] ms/KVM: x86: declare a few variables as __read_mostly

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 16 04:45:52 PST 2016


The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.9
------>
commit 9eb67e921e3ec9548887ee4ad17575cd9111531d
Author: Paolo Bonzini <pbonzini at redhat.com>
Date:   Wed Nov 16 16:45:52 2016 +0400

    ms/KVM: x86: declare a few variables as __read_mostly
    
    Patchset description:
    
    add tsc_scale and fix VM pause/resume
    
    The set of patches:
    1. adds tsc_scaling functionality for VMX
    2. generalizes a number of functions responsible for tsc writing and
       reading
    3. fix VM pause/resume issue #PSBM-54338 by switching to using
       of cached tsc_offset
    
    Haozhong Zhang (12):
      KVM: x86: Collect information for setting TSC scaling ratio
      KVM: x86: Add a common TSC scaling ratio field in kvm_vcpu_arch
      KVM: x86: Add a common TSC scaling function
      KVM: x86: Replace call-back set_tsc_khz() with a common function
      KVM: x86: Replace call-back compute_tsc_offset() with a common
        function
      KVM: x86: Move TSC scaling logic out of call-back adjust_tsc_offset()
      KVM: x86: Move TSC scaling logic out of call-back read_l1_tsc()
      KVM: x86: Use the correct vcpu's TSC rate to compute time scale
      KVM: VMX: Enable and initialize VMX TSC scaling
      KVM: VMX: Setup TSC scaling ratio when a vcpu is loaded
      KVM: VMX: Use a scaled host TSC for guest readings of MSR_IA32_TSC
      KVM: VMX: Dump TSC multiplier in dump_vmcs()
    
    Luiz Capitulino (2):
      kvm: x86: add tsc_offset field to struct kvm_vcpu_arch
      kvm: x86: drop read_tsc_offset()
    
    Paolo Bonzini (2):
      KVM: x86: declare a few variables as __read_mostly
      KVM: x86: drop TSC offsetting kvm_x86_ops to fix KVM_GET/SET_CLOCK
    
    ============================================================
    This patch description:
    
    These include module parameters and variables that are set by
    kvm_x86_ops->hardware_setup.
    
    Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
    (cherry-picked from commit 893590c73426585dfd9f33358b19f18d9395fb2f)
    Signed-off-by: Denis Plotnikov <dplotnikov at virtuozzo.com>
    Signed-off-by: Roman Kagan <rkagan at virtuozzo.com>
---
 arch/x86/include/asm/kvm_host.h |  2 --
 arch/x86/kvm/x86.c              | 14 +++++++-------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index eee8034..51ad191 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -945,8 +945,6 @@ u64 vcpu_tsc_khz(struct kvm_vcpu *vcpu);
 
 /* control of guest tsc rate supported? */
 extern bool kvm_has_tsc_control;
-/* minimum supported tsc_khz for guests */
-extern u32  kvm_min_guest_tsc_khz;
 /* maximum supported tsc_khz for guests */
 extern u32  kvm_max_guest_tsc_khz;
 
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1a3bea2..992f20c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -92,10 +92,10 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu);
 static void process_nmi(struct kvm_vcpu *vcpu);
 static void __kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
 
-struct kvm_x86_ops *kvm_x86_ops;
+struct kvm_x86_ops *kvm_x86_ops __read_mostly;
 EXPORT_SYMBOL_GPL(kvm_x86_ops);
 
-static bool ignore_msrs = 0;
+static bool __read_mostly ignore_msrs = 0;
 module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
 
 unsigned int min_timer_period_us = 500;
@@ -104,20 +104,20 @@ module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
 static bool __read_mostly kvmclock_periodic_sync = true;
 module_param(kvmclock_periodic_sync, bool, S_IRUGO);
 
-bool kvm_has_tsc_control;
+bool __read_mostly kvm_has_tsc_control;
 EXPORT_SYMBOL_GPL(kvm_has_tsc_control);
-u32  kvm_max_guest_tsc_khz;
+u32  __read_mostly kvm_max_guest_tsc_khz;
 EXPORT_SYMBOL_GPL(kvm_max_guest_tsc_khz);
 
 /* tsc tolerance in parts per million - default to 1/2 of the NTP threshold */
-static u32 tsc_tolerance_ppm = 250;
+static u32 __read_mostly tsc_tolerance_ppm = 250;
 module_param(tsc_tolerance_ppm, uint, S_IRUGO | S_IWUSR);
 
 /* lapic timer advance (tscdeadline mode only) in nanoseconds */
-unsigned int lapic_timer_advance_ns = 0;
+unsigned int __read_mostly lapic_timer_advance_ns = 0;
 module_param(lapic_timer_advance_ns, uint, S_IRUGO | S_IWUSR);
 
-static bool backwards_tsc_observed = false;
+static bool __read_mostly backwards_tsc_observed = false;
 
 #define KVM_NR_SHARED_MSRS 16
 


More information about the Devel mailing list