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

Have Firecracker tell UFFD handler about page size during initial handshake #4449

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Feb 14, 2024

This will make orchestration easier, as the whatever spawns the Firecracker and UFFD handler processes now does not have to ensure both get the passed the same hugepages configuration (and it also simplifies our testing setup)

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 Feb 14, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (f3549ec) 81.37% compared to head (395bbaf) 81.56%.

Files Patch % Lines
src/vmm/src/persist.rs 70.37% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4449      +/-   ##
==========================================
+ Coverage   81.37%   81.56%   +0.18%     
==========================================
  Files         243      243              
  Lines       29518    29542      +24     
==========================================
+ Hits        24021    24095      +74     
+ Misses       5497     5447      -50     
Flag Coverage Δ
4.14-c5n.metal 78.86% <75.00%> (+0.20%) ⬆️
4.14-c7g.metal ?
4.14-m5d.metal ?
4.14-m5n.metal 78.85% <75.00%> (+0.20%) ⬆️
4.14-m6a.metal 77.98% <75.00%> (+0.21%) ⬆️
4.14-m6g.metal 76.96% <75.00%> (+0.22%) ⬆️
4.14-m6i.metal 78.85% <75.00%> (+0.20%) ⬆️
4.14-m7g.metal 76.96% <75.00%> (+0.22%) ⬆️
5.10-c5n.metal 81.52% <75.00%> (+0.20%) ⬆️
5.10-c7g.metal ?
5.10-m5d.metal ?
5.10-m5n.metal 81.51% <75.00%> (+0.20%) ⬆️
5.10-m6a.metal 80.74% <75.00%> (+0.20%) ⬆️
5.10-m6g.metal 79.85% <75.00%> (+0.21%) ⬆️
5.10-m6i.metal 81.51% <75.00%> (+0.20%) ⬆️
5.10-m7g.metal 79.85% <75.00%> (+0.21%) ⬆️
6.1-c5n.metal 81.52% <75.00%> (+0.20%) ⬆️
6.1-c7g.metal ?
6.1-m5d.metal ?
6.1-m5n.metal 81.51% <75.00%> (+0.20%) ⬆️
6.1-m6a.metal 80.74% <75.00%> (+0.20%) ⬆️
6.1-m6g.metal 79.85% <75.00%> (+0.21%) ⬆️
6.1-m6i.metal 81.51% <75.00%> (+0.20%) ⬆️
6.1-m7g.metal 79.85% <75.00%> (+0.21%) ⬆️

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.

@roypat roypat force-pushed the fc-tell-uffd-about-hugepages branch from 0cd73ad to deae98a Compare February 14, 2024 13:14
@roypat roypat marked this pull request as ready for review February 14, 2024 16:39
@roypat roypat added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Feb 14, 2024
@roypat roypat force-pushed the fc-tell-uffd-about-hugepages branch 2 times, most recently from e50a9c0 to 94a2caa Compare February 14, 2024 17:00
src/vmm/src/vmm_config/machine_config.rs Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@roypat roypat force-pushed the fc-tell-uffd-about-hugepages branch from 94a2caa to a792bd1 Compare February 14, 2024 17:09
ShadowCurse
ShadowCurse previously approved these changes Feb 14, 2024
When using a page-size agnostic UFFD handler, orchestration becomes
easier if Firecracker tells the UFFD handler about page size (instead of
some orchestrator having to tell both Firecracker and the UFFD handler
about the page size independently). Thus, send along the page size in
the initial payload that Firecracker sends to the UFFD handler (e.g. the
one also containing information about the memory regions).

We send the page size information for each region (even though
Firecracker does not support per-region configuration of huge pages)
for backward compatibility reasons (changing the top-level json object
from a list of region to a dictionary would be a breaking change, but
adding a field to each list entry is not).

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Document the new part of the initial handshake where Firecracker tells
the UFFD handler about page size in KiB.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Have the examples and tests utilize the page size information that
Firecracker sends as part of the initial UFFD payload. This allows us to
get rid of the separate uffd handler examples for the 4K and 2M test
cases.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Factor out the parts of the function that do not require holding a valid
UFFD object into their own functions for which we can then write
unittests. Also write the unittests.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Copy link
Contributor

@kalyazin kalyazin left a comment

Choose a reason for hiding this comment

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

LGTM, we agreed to run a little bit of the tests manually to make sure https://buildkite.com/firecracker/firecracker-pr/builds/9088#018dac2d-4b95-4b19-a327-a59ddee918e2 is a spurious failure not caused by the content of the PR.

@roypat
Copy link
Contributor Author

roypat commented Feb 15, 2024

LGTM, we agreed to run a little bit of the tests manually to make sure https://buildkite.com/firecracker/firecracker-pr/builds/9088#018dac2d-4b95-4b19-a327-a59ddee918e2 is a spurious failure not caused by the content of the PR.

We managed to reproduce this intermittent failure on the main branch (albeit on m6i/6.1 instead of m6i/5.10), so we're confident enough that this is a pre-existing issue.

@roypat roypat merged commit cb4e7cf into firecracker-microvm:main Feb 15, 2024
6 of 7 checks passed
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