Skip to content

Conversation

Manciukic
Copy link
Contributor

@Manciukic Manciukic commented Oct 3, 2025

Changes

TODO

Reason

TODO

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 checkbuild --all to verify that the PR passes
    build checks on all supported architectures.
  • 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 Oct 3, 2025

Codecov Report

❌ Patch coverage is 91.90871% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.11%. Comparing base (dab0533) to head (370eb4e).

Files with missing lines Patch % Lines
src/vmm/src/devices/virtio/mem/device.rs 95.88% 11 Missing ⚠️
src/vmm/src/lib.rs 0.00% 7 Missing ⚠️
src/vmm/src/rpc_interface.rs 0.00% 7 Missing ⚠️
src/vmm/src/devices/virtio/mem/request.rs 95.20% 6 Missing ⚠️
src/vmm/src/builder.rs 58.33% 5 Missing ⚠️
src/firecracker/src/api_server/parsed_request.rs 0.00% 2 Missing ⚠️
src/vmm/src/devices/virtio/mem/persist.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/virtio-mem    #5462      +/-   ##
======================================================
+ Coverage               82.70%   83.11%   +0.41%     
======================================================
  Files                     270      271       +1     
  Lines                   27850    28315     +465     
======================================================
+ Hits                    23033    23534     +501     
+ Misses                   4817     4781      -36     
Flag Coverage Δ
5.10-m5n.metal 83.31% <91.90%> (+0.45%) ⬆️
5.10-m6a.metal 82.60% <91.90%> (+0.48%) ⬆️
5.10-m6g.metal 80.00% <91.90%> (+0.47%) ⬆️
5.10-m6i.metal 83.30% <91.90%> (+0.45%) ⬆️
5.10-m7a.metal-48xl 82.59% <91.90%> (+0.48%) ⬆️
5.10-m7g.metal 80.01% <91.90%> (+0.48%) ⬆️
5.10-m7i.metal-24xl 83.27% <91.90%> (+0.44%) ⬆️
5.10-m7i.metal-48xl 83.28% <91.90%> (+0.45%) ⬆️
5.10-m8g.metal-24xl 80.00% <91.90%> (+0.46%) ⬆️
5.10-m8g.metal-48xl 80.00% <91.90%> (+0.47%) ⬆️
6.1-m5n.metal 83.34% <91.90%> (+0.46%) ⬆️
6.1-m6a.metal 82.63% <91.90%> (+0.48%) ⬆️
6.1-m6g.metal 80.00% <91.90%> (+0.47%) ⬆️
6.1-m6i.metal 83.33% <91.90%> (+0.45%) ⬆️
6.1-m7a.metal-48xl 82.62% <91.90%> (+0.48%) ⬆️
6.1-m7g.metal 80.00% <91.90%> (+0.47%) ⬆️
6.1-m7i.metal-24xl 83.35% <91.90%> (+0.46%) ⬆️
6.1-m7i.metal-48xl 83.35% <91.90%> (+0.45%) ⬆️
6.1-m8g.metal-24xl 80.00% <91.90%> (+0.47%) ⬆️
6.1-m8g.metal-48xl 80.00% <91.90%> (+0.47%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Allocate the memory that will be used for hotplugging. Initially, this
memory will be registered with KVM, but that will change later when we
add dynamic slot support.

Signed-off-by: Riccardo Mancini <[email protected]>
Wire up PATCH requests with the virtio-mem device.
All the validation is performed in the device, but the actual operation
is not yet implemented.

Signed-off-by: Riccardo Mancini <[email protected]>
Add entry for the patch API in Swagger and in the docs.

Signed-off-by: Riccardo Mancini <[email protected]>
Test that the new PATCH API behaves as expected.
Also updates expected metrics and fixes memory monitor to account for
hotplugging.

Signed-off-by: Riccardo Mancini <[email protected]>
Parse virtio requests over the queue and always ack them. Following
commits will add the state management inside the device.

Signed-off-by: Riccardo Mancini <[email protected]>
This commit adds block state management and implements the virtio
requests for the virtio-mem device.

Block state is tracked using a BitVec, each bit representing a single
block.

Plug/Unplug requests are validated before being executed to verify the
range is valid (aligned and within range), and that all blocks in range
are unplugged/plugged, as per the virtio spec.

UplugAll is the only request where usable_region_size can be lowered.

This commit is missing the dynamic KVM slot management which will be
added later.

Signed-off-by: Riccardo Mancini <[email protected]>
Adds unit tests using VirtioTestHelper to verify correct functioning of
the new device.

Signed-off-by: Riccardo Mancini <[email protected]>
Add the virtio-mem device metrics to the integ test validation.

Signed-off-by: Riccardo Mancini <[email protected]>
If the handler receives a UFFD remove event, it currently stores the PFN
and will reply with a zero page whenever it receives a pagefault event
for that page.
This works well with 4k pages, but zeropage is not supported on
hugepages. In order to support hugepages, let's just unregister from
UFFD whenever we get a remove event. By doing so, the handler won't
receive a notification for the removed page, and the VM will get a new
zero page from the kernel.

Signed-off-by: Riccardo Mancini <[email protected]>
This moves the logic to measure RSS to framework.utils and adds a logic
to also include huge pages in the measurement.

Furthermore, this also adds caching for the firecracker_pid, as well as
a new property to get the corresponding psutil.Process.

Signed-off-by: Riccardo Mancini <[email protected]>
Move the logic to get the MemAvailable from /proc/meminfo inside the
guest to a new guest_stats module in the test framework. This provides a
new class MeminfoGuest that can be used to retrieve this information
(and more!).

Signed-off-by: Riccardo Mancini <[email protected]>
Add integration tests for the new device:
 - check that the device is detected
 - check that hotplugging and unplugging works
 - check that memory can be used after hotplugging
 - check that memory is freed on hotunplug
 - check different config combinations
 - check different uvm types
 - check that contents are preserved across snapshot-restore

Signed-off-by: Riccardo Mancini <[email protected]>
Since these tests need to be run on an ag=1 host, move them under the
"performance" folder.

Signed-off-by: Riccardo Mancini <[email protected]>
These tests add unit test coverage to the builder.rs and vm.rs files
which where previously untested in the memory hotplug case.

Signed-off-by: Riccardo Mancini <[email protected]>
@Manciukic Manciukic force-pushed the virtio-mem/patch-api branch from c507d69 to 370eb4e Compare October 6, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant