On Mon, Aug 10, 2015 at 10:47 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > > On 10/08/2015 16:14, Jintack Lim wrote: >>> > Yes, you just use the TSC. :) However, you first have to check that the >>> > TSC is consistent across CPUs. On older machines it's not, but the >>> > kernel can detect it. >> Thanks, Paolo. >> >> What would be the best way to check if TSC is consistent across CPUs? > > You need to have boot_cpu_has(X86_FEATURE_CONSTANT_TSC) and > boot_cpu_has(X86_FEATURE_NONSTOP_TSC). > > However, I would just use TAI (ktime_get_clocktai). x86 KVM provides a > paravirtual interface that synchronizes CLOCK_TAI with the host, and > using it is the simplest way to get synchronized times between the host > and the guest. Thank you so much. I'll try it. Jintack > > Paolo > >> Is it synchronized in nano second (or even cpu clock cycle) resolution? >> >> To get synchronized tsc across the host and the guest, >> just calling rdtscll() in host and guest would be enough? > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html