Skip to content
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

virtq: various simplifications #1284

Merged
merged 10 commits into from
Jun 27, 2024

Conversation

cagatay-y
Copy link
Contributor

No description provided.

@mkroening mkroening self-requested a review June 19, 2024 16:11
@mkroening mkroening self-assigned this Jun 19, 2024
@cagatay-y cagatay-y force-pushed the too-virtq-too-refactor branch 7 times, most recently from 46176b1 to 8deffb1 Compare June 20, 2024 22:29
@cagatay-y cagatay-y marked this pull request as draft June 20, 2024 23:25
@cagatay-y cagatay-y marked this pull request as ready for review June 23, 2024 20:41
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Thanks!

Except for the first commit, this looks good to me.

Regarding the last commit: Does descriptor ID exhaustion happen? What motivates this change?

src/drivers/virtio/virtqueue/mod.rs Outdated Show resolved Hide resolved
The specification only prescribes memory barriers before the setting of the flags, which is taken care of by `make_available_with_state`.
`ctrl_desc` do not belong to the individual buffers but to the whole
transfer. Moving it to the TransferToken structure allows us to avoid
aliasing.
Now that every variant has the same fields, Buffer can be a simple struct instead of an enum. The directness is specified in the TransferToken and whether the Buffer is for a single element or chained elements is deduced from the number of elements in the desc_lst.
There does not seem to be anything in the spec that requires the Buffer IDs for the packed queue to be larger than 0. For split queues, indices are already reduced by one for operations that deal with `MemDescrId`s.
Not every MemDescr necessarily has its own id in the queue. For example, descriptors that make up a chain in a packed queue share their Buffer ID. Descriptors in an indirect table have ids but they don't take them from their queue's pool. Not making the id a field of the MemDescr also removes the coupling between the MemDescr and a queue.
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Thanks!

@mkroening mkroening added this pull request to the merge queue Jun 27, 2024
Merged via the queue into hermit-os:main with commit db3fc99 Jun 27, 2024
13 checks passed
@cagatay-y cagatay-y deleted the too-virtq-too-refactor branch July 8, 2024 15:29
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.

2 participants