Re: [PATCH v6 03/10] KVM: selftests: Use flag CLOCK_MONOTONIC_RAW for timing

From: wangyanan (Y)
Date: Mon Apr 19 2021 - 02:40:12 EST


Hi Paolo,

On 2021/4/17 21:23, Paolo Bonzini wrote:
On 30/03/21 10:08, Yanan Wang wrote:
In addition to function of CLOCK_MONOTONIC, flag CLOCK_MONOTONIC_RAW can
also shield possiable impact of NTP, which can provide more robustness.

Suggested-by: Vitaly Kuznetsov<vkuznets@xxxxxxxxxx>
Signed-off-by: Yanan Wang<wangyanan55@xxxxxxxxxx>
Reviewed-by: Ben Gardon<bgardon@xxxxxxxxxx>
Reviewed-by: Andrew Jones<drjones@xxxxxxxxxx>

I'm not sure about this one, is the effect visible?

In practice, difference between results got with CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW
actually is too little to be visible. But if just in theory, CLOCK_MONOTONIC_RAW can ensure time results
of the compared tests are based on the same local oscillator frequency, which is not subject to possible
NTP frequency adjustment. Change in this patch seems like a bit of optimization.

But either of these two flags is good to me. If this patch is not convincing enough to be accepted, I will
post a patch later in fix use of CLOCK_MONOTONIC_RAW in kvm_page_table_test.c just to be consistent
with other kvm tests, please queue. :)

Thanks,
Yanan