From: Dong, E. <edd...@in...> - 2007-11-14 00:42:12
|
>>=20 >> + kvm_get_msr(vcpu, MSR_IA32_TIME_STAMP_COUNTER, >> + &vcpu->hv_clock.last_tsc); >> + >> + ktime_get_ts(&ts); >> + vcpu->hv_clock.now_ns =3D ts.tv_nsec + (NSEC_PER_SEC * >> (u64)ts.tv_sec); + vcpu->hv_clock.wc_sec =3D get_seconds(); >>=20 >> I am even thinking we have to disable interrupt between these lines, >> otherwise guest wall clock may see backward time source when >> calculating the delta TSC since last vcpu->hv_clock.now_ns update. >>=20 >=20 > That's true. While we do need to handle vcpu migration and > descheduling, the code sequence you note needs to be as atomic as > possible.=20 >=20 Yes VCPU migration is another issue. Since the physical platform TSC is=20 totally different across migration, so we can't expose host TSC to guest. For KVM, it should be simple to just use guest_TSC (=3DHOST_TSC + = offset). thanks, eddie |