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

fix: only pass TSC deadline feature if the host supports it #4655

Closed
wants to merge 3 commits into from

Conversation

pb8o
Copy link
Contributor

@pb8o pb8o commented Jun 26, 2024

Changes

...

Reason

...

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

  • If a specific issue led to this PR, this PR closes the issue.
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this
    PR.
  • API changes follow the Runbook for Firecracker API changes.
  • User-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.
  • New TODOs link to an issue.
  • Commits meet
    contribution quality standards.

  • This functionality cannot be added in rust-vmm.

@pb8o pb8o self-assigned this Jun 26, 2024
@pb8o pb8o added the Status: Awaiting author Indicates that an issue or pull request requires author action label Jun 26, 2024
@pb8o pb8o force-pushed the gh-4099 branch 2 times, most recently from 728c92b to f061302 Compare June 26, 2024 13:32
pb8o added 2 commits June 26, 2024 17:43
In commit f5906ee we moved the
initialization of the list but forgot to change it here.

Fixes: f5906ee

Signed-off-by: Pablo Barbáchano <[email protected]>
AMD hosts do not have TSC deadline enabled, and that seems to cause
issues like in firecracker-microvm#4099.

Only expose TSC_DEADLINE to the guest if the host supports it.

Closes firecracker-microvm#4099

Signed-off-by: Pablo Barbáchano <[email protected]>
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.08%. Comparing base (6d6caf4) to head (4079fdb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4655    /-   ##
=======================================
  Coverage   82.08%   82.08%           
=======================================
  Files         255      255           
  Lines       31257    31264     7     
=======================================
  Hits        25656    25663     7     
  Misses       5601     5601           
Flag Coverage Δ
4.14-c5n.metal 79.57% <100.00%> ( <0.01%) ⬆️
4.14-m5n.metal 79.56% <100.00%> ( <0.01%) ⬆️
4.14-m6a.metal 78.75% <100.00%> (-0.04%) ⬇️
4.14-m6g.metal 76.60% <ø> (ø)
4.14-m6i.metal 79.55% <100.00%> (-0.01%) ⬇️
4.14-m7g.metal 76.60% <ø> (ø)
5.10-c5n.metal 82.09% <100.00%> ( <0.01%) ⬆️
5.10-m5n.metal 82.08% <100.00%> ( <0.01%) ⬆️
5.10-m6a.metal 81.36% <100.00%> (-0.03%) ⬇️
5.10-m6g.metal 79.37% <ø> (-0.01%) ⬇️
5.10-m6i.metal 82.07% <100.00%> (-0.01%) ⬇️
5.10-m7g.metal 79.37% <ø> (ø)
6.1-c5n.metal 82.09% <100.00%> ( <0.01%) ⬆️
6.1-m5n.metal 82.07% <100.00%> (-0.01%) ⬇️
6.1-m6a.metal 81.35% <100.00%> (-0.04%) ⬇️
6.1-m6g.metal 79.36% <ø> (-0.01%) ⬇️
6.1-m6i.metal 82.07% <100.00%> ( <0.01%) ⬆️
6.1-m7g.metal 79.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -247,7 247,14 @@ impl super::Cpuid {
// operation using a TSC deadline value.
//
// tsc_deadline: 24,
set_bit(&mut leaf_1.result.ecx, ECX_TSC_DEADLINE_BITINDEX, true);
let host_leaf_1 = cpuid(0x1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lest we forget: in case this makes it off the draft, we'll need to update the doc: https://github.com/firecracker-microvm/firecracker/blob/main/docs/cpu_templates/cpuid-normalization.md

set_bit(
&mut leaf_1.result.ecx,
ECX_TSC_DEADLINE_BITINDEX,
host_tsc_deadline,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This causes a 40-50% regression in boot time. Currently investigating.

@pb8o
Copy link
Contributor Author

pb8o commented Jul 8, 2024

Superseded by #4666

@pb8o pb8o closed this Jul 8, 2024
@pb8o pb8o deleted the gh-4099 branch July 8, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting author Indicates that an issue or pull request requires author action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants