Open tzneal opened 7 months ago
My initial implementation idea is to have a pair of systemd units.
# ec2-nitro-clocksource.service
[Unit]
Description=Set Preferred Clock Source (Nitro)
DefaultDependencies=no
ConditionVirtualization=amazon
[Service]
Type=oneshot
ExecStart=/usr/bin/echo kvm-clock
RemainAfterExit=true
StandardOutput=file:/sys/devices/system/clocksource/clocksource0/current_clocksource
[Install]
WantedBy=sysinit.target
# ec2-xen-clocksource.service
[Unit]
Description=Set Preferred Clock Source (Xen)
DefaultDependencies=no
ConditionVirtualization=xen
ConditionCPUFeature=constant_tsc
[Service]
Type=oneshot
ExecStart=/usr/bin/echo tsc
RemainAfterExit=true
StandardOutput=file:/sys/devices/system/clocksource/clocksource0/current_clocksource
[Install]
WantedBy=sysinit.target
I need to make sure that the Xen unit does the right thing for the older instance types with an emulated TSC timer. Also, I believe the feature we actually want to test for is "invariant_tsc" or "nonstop_tsc" instead of just "constant_tsc", which may require a systemd patch.
What I'd like:
I would like the clock source (/sys/devices/system/clocksource/clocksource0/current_clocksource) to be defaulted on boot per the guidance at https://repost.aws/knowledge-center/manage-ec2-linux-clock-source
Any alternatives you've considered: