-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use recommended clocksources #1328
Conversation
cat << EOF | sudo tee -a /etc/chrony.conf | ||
# This directive enables kernel synchronisation (every 11 minutes) of the | ||
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive. | ||
rtcsync | ||
EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that this is already present in /etc/chrony.conf
in the latest AL2 minimal AMI. We should not configure chrony
here to avoid diverging from the defaults provided by AL2.
# If current clocksource is xen, switch to tsc | ||
if grep --quiet xen /sys/devices/system/clocksource/clocksource0/current_clocksource \ | ||
&& grep --quiet tsc /sys/devices/system/clocksource/clocksource0/available_clocksource; then | ||
echo "tsc" | sudo tee /sys/devices/system/clocksource/clocksource0/current_clocksource | ||
else | ||
echo "tsc as a clock source is not applicable, skipping." | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only sets the current clocksource, which has no effect after a reboot.
a81eba6
to
2767d2c
Compare
# use the tsc clocksource by default | ||
# https://repost.aws/knowledge-center/manage-ec2-linux-clock-source | ||
sudo grubby \ | ||
--update-kernel=ALL \ | ||
--args="clocksource=tsc tsc=reliable" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly necessary with the configure-clocksource
unit in place, but the tsc=reliable
flag is still worth setting, and we might as well configure a default here too.
ea86740
to
213033e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #, if available:
Fixes #249
Description of changes:
The
tsc
clocksource is the recommended default for instances on the Xen hypervisor, as it's significantly more performant than thexen
clocksource (there's an interesting case study from Netflix).A previous attempt (in #272) to swap
xen
fortsc
had no effect; only the current clocksource was changed, not the default. The setting was applied during the AMI build process and had no effect after a reboot.EC2 recommends:
tsc
xen
was used by default.kvm-clock
tsc
was used by default.arch_sys_counter
clocksource
set on the kernel command-line is ignored.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Testing Done
make 1.27
).m6i.large
(Nitro):kvm-clock
used as expected.r7g.medium
(Graviton3):arch_sys_counter
used as expected.arm64
variant for this (make 1.27 arch=arm64
).m4.large
(Xen):tsc
used as expected.