Skip to content

Conversation

zulinx86
Copy link
Contributor

@zulinx86 zulinx86 commented Nov 7, 2024

Reason

PR #4884 introduced a test that ensures CPU feature diff between host and guest hasn't been changed.

However, the expected diff can vary depending on a combination of host kernel version and guest kernel version.

The current our setting is as follows:

  • Host
    • Amazon Linux 2 (v5.10)
    • Amazon Linux 2023 (v6.1)
    • Ubuntu 24.04 (v6.8)
  • Guest
    • Amazon Linux microvm kernel (v5.10)
    • Amazon Linux microvm kernel (v6.1)

Changes

  • aarch64
    • Add "ssbs" to the expected diff if needed.
  • x86_64
    • Remove "flush_l1d" from the expected diff if the host passes through it.
    • Add "invpcd_single" to the expected diff if needed.

Note that I implemented it in a general way as possible because we might want to support more host and guest kernels in the future.

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.

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.10%. Comparing base (2e994b5) to head (461ee31).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4900   +/-   ##
=======================================
  Coverage   84.10%   84.10%           
=======================================
  Files         251      251           
  Lines       28080    28080           
=======================================
  Hits        23616    23616           
  Misses       4464     4464           
Flag Coverage Δ
5.10-c5n.metal 84.67% <ø> (+<0.01%) ⬆️
5.10-m5n.metal 84.65% <ø> (ø)
5.10-m6a.metal 83.96% <ø> (-0.01%) ⬇️
5.10-m6g.metal 80.78% <ø> (ø)
5.10-m6i.metal 84.65% <ø> (ø)
5.10-m7g.metal 80.78% <ø> (ø)
6.1-c5n.metal 84.67% <ø> (+<0.01%) ⬆️
6.1-m5n.metal 84.65% <ø> (ø)
6.1-m6a.metal 83.96% <ø> (ø)
6.1-m6g.metal 80.77% <ø> (-0.01%) ⬇️
6.1-m6i.metal 84.65% <ø> (ø)
6.1-m7g.metal 80.78% <ø> (ø)

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.

@zulinx86 zulinx86 force-pushed the ssbs_on_ubuntu branch 4 times, most recently from f05347d to 46ce60d Compare November 7, 2024 13:22
@zulinx86 zulinx86 force-pushed the ssbs_on_ubuntu branch 5 times, most recently from a54a2cc to b276fc1 Compare November 7, 2024 16:39
@zulinx86 zulinx86 marked this pull request as ready for review November 7, 2024 16:43
Linux kernel should hide "ssbs" since Neoverse-N1 and Neoverse-V1 have
an errata whereby an MSR to the SSBS special-purpose register does not
affect subsequent speculative instructions, permitting speculative store
bypassing for a window of time. Although Amazon Linux host kernels
(v5.10 and v6.1) backported it, the guest kernels (v5.10 and v6.1) and
the ubuntu host kernel (currently v6.8) lack the change.

Fixes: 2babc80 ("test(aarch64): add host vs guest cpu feature test")
Signed-off-by: Takahiro Itazuri <[email protected]>
Linux kernel v6.4+ passes through the "l1d_flush" CPUID bit to guests.
While the ubuntu host kernel (v6.8) has the change, the latest Amazon
Linux 2 and Amazon Linux 2023 doesn't.

Fixes: 4e014a1 ("test(x86_64): add host vs guest cpu feature test")
Signed-off-by: Takahiro Itazuri <[email protected]>
Linux kernel v6.6+ drops the synthetic feature flag. While the ubuntu
host kernel (v6.8) has the change, the Amazon Linux kernels (v5.10 and
v6.1) and the guest kernels (v5.10 and v6.1) don't.

Fixes: 4e014a1 ("test(x86_64): add host vs guest cpu feature test")
Signed-off-by: Takahiro Itazuri <[email protected]>
@zulinx86 zulinx86 added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Nov 7, 2024
@zulinx86 zulinx86 changed the title Add exceptions to the check of CPU feature diff between host and guest on ubuntu Handle CPU feature diff between host and guest correctly Nov 7, 2024
@zulinx86 zulinx86 changed the title Handle CPU feature diff between host and guest correctly fix(test): Handle CPU feature diff between host and guest correctly Nov 7, 2024
@zulinx86 zulinx86 merged commit cbe79ea into firecracker-microvm:main Nov 7, 2024
8 checks passed
@zulinx86 zulinx86 deleted the ssbs_on_ubuntu branch November 7, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants