On Fri, 2026-04-10 at 14:19 +0200, Thomas Gleixner wrote:
> get_cycles() is not really well defined and similar to other usaage of the
> underlying hardware CPU counters the PTP vmclock should use an explicit
> interface as well.
> 
> Implement ptp_vmclock_read_cpu_counter() in arm64 and x86 and simplify the
> Kconfig selection while at it.
> 
> No functional change.
> 
> Signed-off-by: Thomas Gleixner <[email protected]>
> Cc: David Woodhouse <[email protected]>

Acked-by: David Woodhouse <[email protected]>

Although I might follow up with a change to make this...

> +static inline u64 ptp_vmclock_read_cpu_counter(void)
> +{
> +     return cpu_feature_enabled(X86_FEATURE_TSC) ? rdtsc() : 0;
> +}
> +

... depend on TSC_RELIABLE¹, since if the guest doesn't believe that it
is, then the guest shouldn't be trying to use it as the basis for
precise timing.

¹ (Or... one of the other zoo of TSC flags for the gradually reducing
brokenness over the years...)

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to