[Backport 1.16] Gate clidr overwrite - #6181
Merged
ShadowCurse merged 5 commits intoSep 3, 2026
Merged
Conversation
Add a simple `u32` backed `Version` type with standard `major`/`minor`/`patch` fileds. The `u32` backing allows for trivial comparison. This type will be used in the next commit for host kernel version reporting. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Use `uname` syscall to obtain information about the host kernel including it's release string which can be converted to the kernel version. If this fails for some reason, default to 0.0.0 (the oldest we can represent). Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Original CLIDR_EL1 overwrite was done in Firecracker in the
"b5ac3a6ee7bc0828596c386c9def1bf228f1234c"("fix(aarch64): override
fabricated CLIDR_EL1 to match host cache topology") commit to fix the
change in behavior in the kernel 6.3 from the commit "7af0c2534f4c"
("KVM: arm64: Normalize cache configuration") which started fabricating
CLIDR_EL1 register.
The issue here is that for secondary vcpus on aarch64 the PSCI boot up
process resets vcpu registers (including ID registers like CLIDR_EL1).
This in creates a situation where the vcpu0 has correct CLIDR_EL1 while
all secondary vcpus have KVM default CLIDR_EL1. This combination affects
guest kernel scheduling behavior significantly affecting the
performance.
6.10 kernel contains a fix for this issue
"e016333745c70c960e02b4a9b123c807669d2b22"("KVM: arm64: Only reset
vCPU-scoped feature ID regs once"). This commit (as the title suggests)
prevents resetting of ID registers for already initialized vcpus (all
vcpus are initialized by Firecracker before VM starts). This fixes the
issue of CLIDR_EL1.
All of this creates an unfortunate situation where [6.3..6.10) range of
kernels is affected and have a degraded performance. Even though this
range of kernels does not contain any officially supported kernels by
Firecracker, it would be nice to mediate the impact.
One fix for it is to make secondary vcpu threads to wait until they are
booted by the vcpu0 and only then enter the `KVM_RUN` syscall. This way
there is a window of time where CLIDR_EL1 can be set again to the
correct value. We decide to not use this option since it can potentially
introduce boot time regression and in general adds unwanted complexity.
This leaves the option of gating the CLIDR_EL1 overwrite to only kernels
past 6.10 release. This is not ideal either since cache topology in
affected range of kernels will encounter the original problem the
CLIDR_EL1 override was solving, but at least it does not introduce
performance regressions in the guest.
In the future we will investigate if removing CLIRD_EL1 overwrite and
any cache information from the DT is reasonable to alleviate this
problem once and for all.
Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
The test will fail on those kernels since the KVM does fabricate CLIDR_EL1, but we skip overwriting CLIDR_EL1 with correct version. This causes guest to not provide info about L1$, and so the test fails. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add entry about CLIRD_EL1 override gate Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
ShadowCurse
force-pushed
the
gate_clidr_overwrite_1_16
branch
from
September 2, 2026 16:33
7cf7e54 to
4e57549
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## firecracker-v1.16 #6181 +/- ##
=====================================================
+ Coverage 83.02% 83.04% +0.01%
=====================================================
Files 277 277
Lines 30149 30196 +47
=====================================================
+ Hits 25032 25075 +43
- Misses 5117 5121 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ShadowCurse
marked this pull request as ready for review
September 2, 2026 16:42
ilstam
approved these changes
Sep 2, 2026
PierreBertholom
approved these changes
Sep 2, 2026
ShadowCurse
enabled auto-merge (rebase)
September 2, 2026 17:00
zulinx86
approved these changes
Sep 3, 2026
ShadowCurse
disabled auto-merge
September 3, 2026 08:59
ShadowCurse
enabled auto-merge (rebase)
September 3, 2026 08:59
Manciukic
approved these changes
Sep 3, 2026
ShadowCurse
disabled auto-merge
September 3, 2026 09:31
ShadowCurse
merged commit Sep 3, 2026
eec3484
into
firecracker-microvm:firecracker-v1.16
8 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Backport of #6172
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.