-
Notifications
You must be signed in to change notification settings - Fork 163
virtio: update core queue to have separate work and completion types #2686
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
base: main
Are you sure you want to change the base?
virtio: update core queue to have separate work and completion types #2686
Conversation
…ents Move split queue logic into specific split queue implementations.
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the virtio queue implementation to separate work fetching (reading from available ring) from work completion (writing to used ring), preparing the codebase for future packed queue support. The refactoring isolates split queue-specific logic and introduces cleaner abstractions.
Changes:
- Split
QueueCoreintoQueueCoreGetWorkandQueueCoreCompleteWorkto separate read and write operations - Introduced
QueueWork,QueueCompletionContext, andQueueDescriptortypes to encapsulate queue work and completion state - Renamed
DescriptortoSplitDescriptorto distinguish split queue format from future packed queue format - Added power-of-2 validation for queue sizes and added
VIRTIO_F_VERSION_1feature flag support - Updated tests to use valid queue sizes (changed from 5 to 8 to satisfy power-of-2 requirement)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| vm/devices/virtio/virtio/src/queue.rs | Core refactoring: split queue operations into get/complete, added new types, isolated split queue logic |
| vm/devices/virtio/virtio/src/common.rs | Updated to use new split queue APIs, modified work completion flow |
| vm/devices/virtio/virtio/src/spec.rs | Renamed Descriptor to SplitDescriptor for clarity |
| vm/devices/virtio/virtio/src/tests.rs | Added indirect descriptor feature flag, fixed queue sizes to be power-of-2 |
other minor pr feedback from copilot
|
The unsafe blocks are in the tests.rs module so not part of production. |
In preparation for adding the packed queue type, update how work is fetched and completed from a queue. Additionally, isolate split queue specific logic.