diff options
author | Avi Kivity <avi@redhat.com> | 2009-04-12 15:49:07 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 11:48:42 +0300 |
commit | 463656c0007ddccee78db383eeb9e6eac75ccb7f (patch) | |
tree | 7aa1c74d178a35ca6bc6e701c03fb7ff80127ba2 | |
parent | 8317c298eab14cc20e2de5289743ff0d4c5a6b30 (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.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8beccaa1769..ffbb2c818d7 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) 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); |