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 fast_page_fault_helper crashing instead of causing page faults #5054

Merged
merged 6 commits into from
Feb 27, 2025

Conversation

roypat
Copy link
Contributor

@roypat roypat commented Feb 27, 2025

Make page fault helper used in test_ept_violation_count actually cause page faults post restore. Currently, it is just crashing because the signal that is supposed to wake it up is actually killing it, due to no signal mask being installed.

Surrounded by a few refactors/fixes that came from me working on a page fault latency test before realizing that my approach was fundamentally flawed and I had to throw most of it away.

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

  • I have read and understand CONTRIBUTING.md.
  • I have run tools/devtool checkstyle to verify that the PR passes the
    automated style checks.
  • I have described what is done in these changes, why they are needed, and
    how they are solving the problem in a clear and encompassing way.
  • I have updated any relevant documentation (both in code and in the docs)
    in the PR.
  • I have mentioned all user-facing changes in CHANGELOG.md.
  • If a specific issue led to this PR, this PR closes the issue.
  • When making API changes, I have followed the
    Runbook for Firecracker API changes.
  • I have tested all new and changed functionalities in unit tests and/or
    integration tests.
  • I have linked an issue to every new TODO.

  • This functionality cannot be added in rust-vmm.

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.19%. Comparing base (dd0bf86) to head (febb888).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5054   +/-   ##
=======================================
  Coverage   83.19%   83.19%           
=======================================
  Files         247      247           
  Lines       26641    26641           
=======================================
  Hits        22163    22163           
  Misses       4478     4478           
Flag Coverage Δ
5.10-c5n.metal 83.67% <ø> (ø)
5.10-m5n.metal 83.66% <ø> (+<0.01%) ⬆️
5.10-m6a.metal 82.86% <ø> (ø)
5.10-m6g.metal 79.66% <ø> (ø)
5.10-m6i.metal 83.64% <ø> (-0.01%) ⬇️
5.10-m7g.metal 79.66% <ø> (ø)
6.1-c5n.metal 83.67% <ø> (+<0.01%) ⬆️
6.1-m5n.metal 83.65% <ø> (ø)
6.1-m6a.metal 82.86% <ø> (ø)
6.1-m6g.metal 79.66% <ø> (ø)
6.1-m6i.metal 83.65% <ø> (ø)
6.1-m7g.metal 79.66% <ø> (ø)

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 added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Feb 27, 2025
Add spaces before parenthesis

Suggested-by: Babis Chalios <[email protected]>
Signed-off-by: Patrick Roy <[email protected]>
mmap should never fail, but having the check for failure after the
memset is just wrong.

Signed-off-by: Patrick Roy <[email protected]>
-1 wraps around to 255, which in case of commands executed over SSH
clashes with SSH defined return codes.

Signed-off-by: Patrick Roy <[email protected]>
Without calling sigprocmask, the SIGUSR1 that we're using will actually
just kill the process instead of waking it up, as sigwait can only be
used to wait for _pending_ signals, but signals are only marked as
pending if they're blocked by a signal mask. If they're not blocked,
they will instead call signal handlers, which will in this case just
kill the process.

This does mean that this program never worked the intended way, which
also kinda proves it was not needed to show the different in page faults
between huge pages and normal pages (test_ept_violation_count).

Signed-off-by: Patrick Roy <[email protected]>
Currently, all tests that want to make use of UFFD import UFFD related
functions from test_uffd.py. That's a bit awkward, so move them into
their own utility module.

Signed-off-by: Patrick Roy <[email protected]>
There's really no use in having this be a fixture, it's just a
dictionary - it used to be a fixture because we were building the
binaries inside of the test framework (and so each call to it as a
function would trigger compilations), but now that we pre-compile
everything that's no longer something to worry about.

Signed-off-by: Patrick Roy <[email protected]>
@roypat roypat force-pushed the fast_page_helper-fix branch from 4fb84a3 to febb888 Compare February 27, 2025 16:39
@roypat roypat merged commit a8f38cb into firecracker-microvm:main Feb 27, 2025
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