aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-04-12 08:49:07 -0400
committerAvi Kivity <avi@redhat.com>2009-06-10 04:48:42 -0400
commit463656c0007ddccee78db383eeb9e6eac75ccb7f (patch)
tree7aa1c74d178a35ca6bc6e701c03fb7ff80127ba2
parent8317c298eab14cc20e2de5289743ff0d4c5a6b30 (diff)
KVM: Replace kvmclock open-coded get_cpu_var() with the real thing
Suggested by Ingo Molnar. Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8beccaa17690..ffbb2c818d78 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -631,16 +631,17 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
631 unsigned long flags; 631 unsigned long flags;
632 struct kvm_vcpu_arch *vcpu = &v->arch; 632 struct kvm_vcpu_arch *vcpu = &v->arch;
633 void *shared_kaddr; 633 void *shared_kaddr;
634 unsigned long this_tsc_khz;
634 635
635 if ((!vcpu->time_page)) 636 if ((!vcpu->time_page))
636 return; 637 return;
637 638
638 preempt_disable(); 639 this_tsc_khz = get_cpu_var(cpu_tsc_khz);
639 if (unlikely(vcpu->hv_clock_tsc_khz != __get_cpu_var(cpu_tsc_khz))) { 640 if (unlikely(vcpu->hv_clock_tsc_khz != this_tsc_khz)) {
640 kvm_set_time_scale(__get_cpu_var(cpu_tsc_khz), &vcpu->hv_clock); 641 kvm_set_time_scale(this_tsc_khz, &vcpu->hv_clock);
641 vcpu->hv_clock_tsc_khz = __get_cpu_var(cpu_tsc_khz); 642 vcpu->hv_clock_tsc_khz = this_tsc_khz;
642 } 643 }
643 preempt_enable(); 644 put_cpu_var(cpu_tsc_khz);
644 645
645 /* Keep irq disabled to prevent changes to the clock */ 646 /* Keep irq disabled to prevent changes to the clock */
646 local_irq_save(flags); 647 local_irq_save(flags);