-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: reset KVM_REG_ARM_PTIMER_CNT on VM boot #4987
feat: reset KVM_REG_ARM_PTIMER_CNT on VM boot #4987
Conversation
b34d97d
to
b459ae3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4987 +/- ##
==========================================
+ Coverage 83.06% 83.10% +0.04%
==========================================
Files 244 245 +1
Lines 26658 26723 +65
==========================================
+ Hits 22144 22209 +65
Misses 4514 4514
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1bd3f94
to
5ea2f4a
Compare
75a7ec1
to
053f265
Compare
d3abf67
to
57b458b
Compare
f553778
to
0ab122a
Compare
e7d282b
to
98592f7
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.
feel free to ignore the nits, the changelog comment is the only one preventing me from hitting approve xP
d767541
to
1801a5f
Compare
caf5d9d
to
bfc5a84
Compare
2b0aa20
to
406c2c4
Compare
406c2c4
to
759d750
Compare
`Vm` constructor was the only place where the `/dev/kvm` was open and only there we could do any KVM (not VM) specific checks. By moving this KVM logic into a separate struct we can can do KVM specific actions (like checking optional KVM capabilities) without needing to reopen the `/dev/kvm` again. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
649235d
to
13b30a2
Compare
355cc54
to
82afe20
Compare
Reset KVM_REG_ARM_PTIMER_CNT physical counter register on VM boot to avoid passing through host physical counter. Note that resetting the register on VM boot does not guarantee that VM will see the counter value 0 at startup because there is a delta in time between register reset and VM boot during which counter continues to advance. In order to check if the kernel supports the counter reset we query KVM_CAP_COUNTER_OFFSET capability and only reset the KVM_REG_ARM_PTIMER_CNT if it is present. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Update a note about physical counter on ARM being reset instead of directly passed through on kernels with `KVM_CAP_COUNTER_OFFSET` capability. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add an entry about physical counter reset to the CHANGELOG. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Add a test to verify the reset of the physical counter on aarch64 VMs. To do this we check registers saved in the snapshot and verify the counter value is less than some reasonably small number we choose. The value is based on the observation of how much cycles it takes for a VM to boot and be snapshotted. The idea is that this value will always be smaller than the actual physical counter on the host. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
82afe20
to
d59728f
Compare
Reset KVM_REG_ARM_PTIMER_CNT physical counter register on VM boot to avoid passing through host physical counter. Note that resetting the register on VM boot does not guarantee that VM will see the counter value 0 at startup because there is a delta in time between register reset and VM boot during which counter continues to advance.
Reason
Prevent guest from reading host performance counter.
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 checkstyle
to 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
.