Re: [PATCH linux-next] x86/xen/time: prefer tsc as clocksource when it is invariant

From: Boris Ostrovsky
Date: Fri Dec 09 2022 - 14:32:58 EST



On 12/8/22 11:36 AM, Krister Johansen wrote:
+ /*
+ * As Dom0 is never moved, no penalty on using TSC there.
+ *
+ * If the guest has invariant tsc, then set xen_clocksource rating
+ * below that of the tsc so that the system prefers tsc instead. This
+ * check excludes PV domains, because PV is unable to guarantee that the
+ * guest's cpuid call has been intercepted by the hypervisor.
+ */
+ if (xen_initial_domain()) {
xen_clocksource.rating = 275;
+ } else if ((xen_hvm_domain() || xen_pvh_domain()) &&
+ boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
+ boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
+ !check_tsc_unstable()) {
+ xen_clocksource.rating = 299;
+ }


What if RDTSC is intercepted?


-boris