[SRU][J/L][PATCH 0/1] Xen timekeeping performance improvement

Krister Johansen kjlx at templeofstupid.com
Sat Aug 26 00:57:14 UTC 2023


Dear Ubuntu Kernel Team:

This patch modifies which default clocksource is selected on Xen.
Users, especially those on EC2, are encouraged to select tsc as their
default clocksource.  However, this requires manual tuning of the
operating system.  Kvm can determine if it safe to use the tsc, and will
default to that instead of its pvclock when appropriate.  This patch
does the same for Xen instances.

If appropriate, it's fine if this is applied to only the linux-aws
branches.

Not all Xen EC2 instances advertise explicit nomigrate support, however,
on those that do we'll select tsc by default.  On the subset of hosts
where this is advertised, users will safely default to the more
performant clocksource.

[Impact]
Xen instances default to the xen clocksource which has been documented
to be slower.  This is required for instances where the tsc is not safe
to use, or the guest is subject to migration.  On some platforms the
performance impact can be high, and users are encouraged to select the
tsc when appropriate.  Instead of leaving up to users to figure this out
by reading a variety of different documents, pick the fast clocksource
when it can be determined to be safe to do so.

[Backport]
Clean cherry pick.  No conflicts applying to 5.15 or 6.2.

[Test]
Booted EC2 xen instances with and without this patch and validated that
on those that properly advertised the required criteria via cpuid, that
the clocksource defaulted to tsc instead of xen.

[Potential Regression]
Potential is low, since only absurd configurations could lead to a
problem.  If this is considered risky, it can be applied to only
linux-aws where the documented guidance is for users to enable tsc as
the clocksource on Xen.

Krister Johansen (1):
  x86/xen/time: prefer tsc as clocksource when it is invariant

 arch/x86/xen/time.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

-- 
2.25.1




More information about the kernel-team mailing list