]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: Replace kvmclock open-coded get_cpu_var() with the real thing
authorAvi Kivity <avi@redhat.com>
Sun, 12 Apr 2009 12:49:07 +0000 (15:49 +0300)
committerAvi Kivity <avi@redhat.com>
Mon, 13 Apr 2009 11:19:42 +0000 (14:19 +0300)
Suggested by Ingo Molnar.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 29a7fea36d4d5c565c4895d5dd83a81f54afa745..148cde2ae814f8ce03d8cf46768b278f9d3ebbbe 100644 (file)
@@ -627,16 +627,17 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
        unsigned long flags;
        struct kvm_vcpu_arch *vcpu = &v->arch;
        void *shared_kaddr;
+       unsigned long this_tsc_khz;
 
        if ((!vcpu->time_page))
                return;
 
-       preempt_disable();
-       if (unlikely(vcpu->hv_clock_tsc_khz != __get_cpu_var(cpu_tsc_khz))) {
-               kvm_set_time_scale(__get_cpu_var(cpu_tsc_khz), &vcpu->hv_clock);
-               vcpu->hv_clock_tsc_khz = __get_cpu_var(cpu_tsc_khz);
+       this_tsc_khz = get_cpu_var(cpu_tsc_khz);
+       if (unlikely(vcpu->hv_clock_tsc_khz != this_tsc_khz)) {
+               kvm_set_time_scale(this_tsc_khz, &vcpu->hv_clock);
+               vcpu->hv_clock_tsc_khz = this_tsc_khz;
        }
-       preempt_enable();
+       put_cpu_var(cpu_tsc_khz);
 
        /* Keep irq disabled to prevent changes to the clock */
        local_irq_save(flags);