-
Notifications
You must be signed in to change notification settings - Fork 87
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: use a struct with the actual layout rather than a struct of references #1150
Conversation
721e4be
to
b79e219
Compare
I am not sure if the use of |
f69e530
to
1366a92
Compare
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.
Thanks!
Apart from one comment, this looks excellent! :)
…ferences Using a struct of references for the ring structures of the split virtqueue adds an unnecessary level of indirection and complicates the initialization. Use dynamically sized structs with appropriate accessor methods instead.
Endianness-specified numbers from zerocopy, as opposed to the ones from virtio-def, do not guarantee appropriate alignment.
The fields are used to send data to and receive data from the host and Rust cannot reason about the changes done by the host and changes to the memory that are needed for their side effect. As such, we need to use volatile references for them.
FYI, in addition to the deprecation change, I also switched a kernel/src/drivers/virtio/virtqueue/split.rs Lines 477 to 485 in 8e446e2
|
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.
Thanks! :)
The code is not ready as I haven't yet figured out how the existing code ensures that the whole allocation is on the same page. This PR needs to be modified to ensure that as well. It is also based on #1141.