On Mon, May 23, 2016 at 06:55:06PM -0300, Marcelo Tosatti wrote: > On Thu, Apr 21, 2016 at 08:21:25PM +0300, Roman Kagan wrote: > > From: Paolo Bonzini <pbonzini@xxxxxxxxxx> > > > > The test checks the relative precision of the reference TSC page > > and the time reference counter. > > > > Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> > > [Adjust types to pass printf type checks - Roman Kagan] > > Signed-off-by: Roman Kagan <rkagan@xxxxxxxxxxxxx> > [...] > > + if (t >= end) { > > + long long ref = rdmsr(HV_X64_MSR_TIME_REF_COUNT); > > + if (i == 0) > > + printf("Time reference MSR drift: %lld\n\n", ref - end); > > + ok[i] &= (ref - end) > -5 && (ref - end) < 5; > > This is prone to fail: guest can be scheduled at "***" above and > test will fail. > > The [-5,5] comes from the standard? What the standard dictates? No standard of course, it's arbitrary. I tend to think a better test would be to alternate clock reads from the MSR and the TSC page and check that neither goes ahead of the other. Roman. -- 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