From: Dong, E. <edd...@in...> - 2007-11-13 05:01:06
|
> +static void kvm_write_guest_time(struct kvm_vcpu *vcpu) +{ > + struct timespec ts; > + int r; > + > + if (!vcpu->clock_gpa) > + return; > + > + /* Updates version to the next odd number, indicating > we're writing */ > + vcpu->hv_clock.version++; > + kvm_write_guest(vcpu->kvm, vcpu->clock_gpa, > &vcpu->hv_clock, PAGE_SIZE); > + > + kvm_get_msr(vcpu, MSR_IA32_TIME_STAMP_COUNTER, > + &vcpu->hv_clock.last_tsc); > + > + ktime_get_ts(&ts); Do we need to disable preemption here? > + vcpu->hv_clock.now_ns =3D ts.tv_nsec + (NSEC_PER_SEC * > (u64)ts.tv_sec); + vcpu->hv_clock.wc_sec =3D get_seconds(); > + vcpu->hv_clock.version++; > + kvm_write_guest(vcpu->kvm, vcpu->clock_gpa, > &vcpu->hv_clock, PAGE_SIZE); > +} > + thx,eddie |