Re: [PATCH] KVM: selftests: use unified time type for comparison

From: Oliver Upton
Date: Wed Aug 02 2023 - 15:53:01 EST


Howdy,

On Wed, Aug 02, 2023 at 12:30:43PM -0700, Sean Christopherson wrote:
> On Mon, Jul 31, 2023, Bibo Mao wrote:
> > With test case kvm_page_table_test, start time is acquired with
> > time type CLOCK_MONOTONIC_RAW, however end time in function timespec_elapsed
> > is acquired with time type CLOCK_MONOTONIC. This will cause
> > inaccurate elapsed time calculation on some platform such as LoongArch.

Well, there's the fundamental issue of mixing to timebases, so this
really isn't platform specific. One is subject to NTP frequency
adjustments and the other is not.

> > This patch modified test case kvm_page_table_test, and uses unified
> > time type CLOCK_MONOTONIC for start time.
>
> AFAICT, there's zero reason to use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC.
> If there are no objections, I'll take this through kvm-x86/selftests for 6.6.

CLOCK_MONOTONIC is objectively the better choice if you want something
that accurately tracks wall time, which we certainly do. So yeah, fine
by me to take this through the x86 tree:

Reviewed-by: Oliver Upton <oliver.upton@xxxxxxxxx>

--
Thanks,
Oliver