Skip to content
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 "quiet" kernel parameter for aws and vmware #2277

Merged
merged 1 commit into from
Jul 18, 2022

Conversation

bcressey
Copy link
Contributor

Issue number:
N/A

Description of changes:
Use the "quiet" parameter for platforms where the hardware is known and the kernel output is not generally needed on the console in order to diagnose issues. This includes the "aws" and "vmware" variants.

The "metal" variants continue to use the more verbose default output so that any hardware without matching driver support can be detected.

Force systemd to always print the status of units, since this can be invaluable data when troubleshooting failures caused by dependency ordering problems.

Remove the printk settings from the default sysctls, since these will be applied by systemd very early and override the "quiet" behavior. The default values in /proc/sys/kernel/printk are controlled by the kernel config, and will be "7 4 1 7" without the "quiet" parameter, and "4 4 1 7" when it is present.

The main motivation for this is to improve boot performance and make it more consistent. printk logging is expensive, and can slow down many code paths in the kernel.

Testing done:
Verified that we still get reasonable systemd output in the "success" and "failure" cases:
https://gist.github.com/bcressey/1b8889c772cef9d88ce37b38f6051b0a

Overall this change saves at least two seconds when booting an m5ad.large instance in EC2. I ignored the results from the first boot to rule out the impact of populating the EBS volume with snapshot blocks.

Measurements were done with systemctl show --all | grep UserspaceTimestampMonotonic, which is what systemd-analyze uses as the zero point for its own measurements.

Before:

UserspaceTimestampMonotonic=1815492
UserspaceTimestampMonotonic=1711044
UserspaceTimestampMonotonic=1806789

After:

UserspaceTimestampMonotonic=598559
UserspaceTimestampMonotonic=594318
UserspaceTimestampMonotonic=599811

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Use the "quiet" parameter for platforms where the hardware is known
and the kernel output is not generally needed on the console in order
to diagnose issues. This includes the "aws" and "vmware" variants.

The "metal" variants continue to use the more verbose default output
so that any hardware without matching driver support can be detected.

Force systemd to always print the status of units, since this can be
invaluable data when troubleshooting failures caused by dependency
ordering problems.

Remove the printk settings from the default sysctls, since these will
be applied by `systemd` very early and override the "quiet" behavior.
The default values in `/proc/sys/kernel/printk` are controlled by the
kernel config, and will be "7 4 1 7" without the "quiet" parameter,
and "4 4 1 7" when it is present.

The main motivation for this is to improve boot performance and make
it more consistent. printk logging is expensive, and can slow down
many code paths in the kernel.

Signed-off-by: Ben Cressey <[email protected]>
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌃

Copy link
Member

@markusboehme markusboehme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this change saves at least two seconds when booting an m5ad.large instance in EC2.

This is an impressive improvement, even more so for such a conceptually simple change! Nice!

@@ -15,6 +15,7 @@ kernel-parameters = [
"console=ttyS0,115200n8",
"net.ifnames=0",
"netdog.default-interface=eth0:dhcp4,dhcp6?",
"quiet",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: can we skip this change? The variant will be deprecated by the next month:

#2228

@bcressey bcressey merged commit b039bad into bottlerocket-os:develop Jul 18, 2022
@bcressey bcressey deleted the quiet-boot branch July 18, 2022 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants