Skip to content

Virtio tweaks #4683

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

Merged
merged 5 commits into from
Jul 17, 2024
Merged

Conversation

ShadowCurse
Copy link
Contributor

@ShadowCurse ShadowCurse commented Jul 16, 2024

Changes

Minor tweaks to the virtio queue methods:

  • more explicit offset calculations
  • more descriptive names and methods

Reason

These changes were part of #4658, but are quite independent of it, so moved to separate PR.

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.

@ShadowCurse ShadowCurse force-pushed the virtio_tweaks branch 6 times, most recently from 9a9b2ad to af31cb5 Compare July 16, 2024 14:00
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.16%. Comparing base (cb3b00e) to head (fa8f751).

Files Patch % Lines
src/vmm/src/devices/virtio/queue.rs 96.61% 2 Missing ⚠️
src/vmm/src/devices/virtio/net/device.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4683      +/-   ##
==========================================
+ Coverage   82.14%   82.16%   +0.01%     
==========================================
  Files         255      255              
  Lines       31321    31361      +40     
==========================================
+ Hits        25729    25768      +39     
- Misses       5592     5593       +1     
Flag Coverage Δ
4.14-c5n.metal 79.67% <95.45%> (+0.02%) ⬆️
4.14-m5n.metal 79.65% <95.45%> (+0.02%) ⬆️
4.14-m6a.metal 78.88% <95.45%> (+0.02%) ⬆️
4.14-m6g.metal 76.70% <95.45%> (+0.03%) ⬆️
4.14-m6i.metal 79.65% <95.45%> (+0.02%) ⬆️
4.14-m7g.metal 76.70% <95.45%> (+0.03%) ⬆️
5.10-c5n.metal 82.18% <95.45%> (+0.02%) ⬆️
5.10-m5n.metal 82.16% <95.45%> (+0.02%) ⬆️
5.10-m6a.metal 81.47% <95.45%> (+0.02%) ⬆️
5.10-m6g.metal 79.47% <95.45%> (+0.02%) ⬆️
5.10-m6i.metal 82.16% <95.45%> (+0.02%) ⬆️
5.10-m7g.metal 79.47% <95.45%> (+0.02%) ⬆️
6.1-c5n.metal 82.17% <95.45%> (+0.02%) ⬆️
6.1-m5n.metal 82.16% <95.45%> (+0.02%) ⬆️
6.1-m6a.metal 81.48% <95.45%> (?)
6.1-m6g.metal 79.47% <95.45%> (+0.02%) ⬆️
6.1-m6i.metal 82.16% <95.45%> (+0.02%) ⬆️
6.1-m7g.metal 79.47% <95.45%> (+0.02%) ⬆️

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.

@ShadowCurse ShadowCurse self-assigned this Jul 16, 2024
@ShadowCurse ShadowCurse marked this pull request as ready for review July 16, 2024 14:23
@ShadowCurse ShadowCurse added Status: Awaiting review Indicates that a pull request is ready to be reviewed Type: Enhancement Indicates new feature requests labels Jul 16, 2024
roypat
roypat previously approved these changes Jul 16, 2024
Copy link
Contributor

@roypat roypat left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, and the offset calculations do indeed look clearer now

Add info about queue len and actual size to the
message.

Signed-off-by: Egor Lazarchuk <[email protected]>
Usize to u64 is safe as Firecracker only supports 64bit
platforms where usize == u64.

Signed-off-by: Egor Lazarchuk <[email protected]>
bchalios
bchalios previously approved these changes Jul 17, 2024
Copy link
Contributor

@bchalios bchalios left a comment

Choose a reason for hiding this comment

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

Cool changes. I do agree the offset calculations are much cleaner and safer now.

Replace offset calculations with hard coded values with
more descriptive `std::mem::sizeof` with better comments
of why the offset should be calculated this way.
Additionally replace setting used element fields one by one
with single call to `write_obj`.

Signed-off-by: Egor Lazarchuk <[email protected]>
Update methods that set values in the `used_ring`
to be more descriptive and coherent.

Signed-off-by: Egor Lazarchuk <[email protected]>
Rename `signal_used_queue` to `try_signal_queue`.
Add a description for the `try_signal_queue` method.

Signed-off-by: Egor Lazarchuk <[email protected]>
@ShadowCurse ShadowCurse merged commit 2321e76 into firecracker-microvm:main Jul 17, 2024
7 checks passed
@ShadowCurse ShadowCurse deleted the virtio_tweaks branch July 17, 2024 14:38
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 Type: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants