Skip to content

Conversation

@MatiasVara
Copy link
Contributor

@MatiasVara MatiasVara commented Jan 7, 2026

Summary of the PR

Consume descriptor chains from the rx queue based on the size of the reception fifo queue. Before this fix, the device was consuming all available buffers from the rx queue. If the reception fifo queue was shorter than the number of descriptors, those remainder descriptors were lost, i.e., the device was signaling that it used them but they were never returned to the used vring. Some descriptors chains are returned though thus allowing the driver to recycle them. This results in an available ring with less and less descriptors until the vring runs out of descriptors thus blocking the device.

Fixes: #923

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@MatiasVara
Copy link
Contributor Author

MatiasVara commented Jan 9, 2026

CC @TimosAmpel

@MatiasVara
Copy link
Contributor Author

MatiasVara commented Jan 9, 2026

Due to the changes some tests are not passing, I am working on it.

Consume descriptor chains from the rx queue based on the size of the
reception fifo queue. Before this fix, the device was consuming all
available buffers from the rx queue. If the reception fifo queue was
shorter than the number of descriptors, those remainder descriptors were
lost, i.e., the device was signaling that it used them but they were
never returned to the used vring. Some descriptors chains are returned
though thus allowing the driver to recycle them. This results in an
available ring with less and less descriptors until the vring runs out
of descriptors thus blocking the device. Also, break the loop if the
rx_fifo queue is empty since there is nothing else to process otherwise
the loop is never break since none descriptor is consumed.

process_ctrl_requests(), process_tx_requests(), and
process_rx_requests() now return true only if the device needs to notify
guest, i.e., descriptor chains have been processed and added to used.
Fix the tests accordingly.

Fixes: rust-vmm#923

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
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.

vhost-device-can: the device does not return the descriptors to the rx queue

1 participant