clocksource: hyper-v: Adjust hv_read_tsc_page_tsc() to avoid special casing U64_MAX
authorPeter Zijlstra <peterz@infradead.org>
Fri, 19 May 2023 10:21:07 +0000 (12:21 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 5 Jun 2023 19:11:07 +0000 (21:11 +0200)
commit9397fa2ea3e7634f61da1ab76b9eb88ba04dfdfc
treef7e754cc61e0394b21845060b3f41f6b5f7bc450
parent77750f78b0b3247c64b9821b49158cafe0506880
clocksource: hyper-v: Adjust hv_read_tsc_page_tsc() to avoid special casing U64_MAX

Currently hv_read_tsc_page_tsc() (ab)uses the (valid) time value of
U64_MAX as an error return. This breaks the clean wrap-around of the
clock.

Modify the function signature to return a boolean state and provide
another u64 pointer to store the actual time on success. This obviates
the need to steal one time value and restores the full counter width.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Michael Kelley <mikelley@microsoft.com> # Hyper-V
Link: https://lore.kernel.org/r/20230519102715.775630881@infradead.org
arch/x86/include/asm/vdso/gettimeofday.h
arch/x86/kvm/x86.c
drivers/clocksource/hyperv_timer.c
include/clocksource/hyperv_timer.h