virtio-devices: console: Fix descriptor chain processing - #7802
Merged
Merged
Conversation
rbradford
enabled auto-merge
March 6, 2026 20:10
auto-merge was automatically disabled
March 6, 2026 21:10
Head branch was pushed to by a user without write access
Contributor
Author
|
I have removed the unused DescriptorChainTooShort. This should fix ci failures. |
likebreath
reviewed
Mar 6, 2026
likebreath
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution! This is a good fix. I have left a couple of minor suggestions below.
Gentle reminder: As a first-time contributor, please take a moment to review our contribution guidelines.
Also, this inspired me to audit our other virtio devices for similar issues. I've opened a tracking issue here: #7803.
The update_console_size method was using fetch_and on the acked_features atomic, which modified the atomic and cleared other feature bits. Changed it to use a non-destructive load and bitwise AND. Signed-off-by: Andrei Vagin <[email protected]>
For a transmit queue (guest to host), the host only reads from the guest-provided buffers and does not write to them. According to the virtio specification (e.g., Section 2.6.8 in Virtio 1.1), the 'len' field in the used ring has to be set to the number of bytes written to the buffers. Therefore, it should be 0 for the console transmit queue. Signed-off-by: Andrei Vagin <[email protected]>
Both process_input_queue and process_output_queue were only processing the first descriptor of a chain, leading to data loss if the driver used chained descriptors. This change iterates through all descriptors in a chain. It also moves the flush call out of the descriptor loops to improve performance. Signed-off-by: Andrei Vagin <[email protected]>
rbradford
enabled auto-merge
March 8, 2026 10:27
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Mar 8, 2026
liuw
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both process_input_queue and process_output_queue were only processing the first descriptor of a chain, leading to data loss if the driver used chained descriptors.
This change iterates through all descriptors in a chain. It also fixes the
lenfield in the used ring for the transmit queue to be 0, as required by the virtio specification ((e.g., Section 2.6.8 in virtio 1.1).