-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add experimental vhost-user-video backend #445
Conversation
4e81427
to
bc18810
Compare
Regarding the code coverage, unfortunately I have decreased it :( I will try to cover as much as posible, but for testing the decoder module we may need to have a video device available. |
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.
Just some random, all over the place comments. Nothing serious, but also no systematic review.
Looks overall, fairly straight forward. Some of the unsafe blocks look pretty big... But I will wait for the // SAFETY
comments on those :)
crates/video/src/main.rs
Outdated
} | ||
|
||
pub(crate) fn start_backend(config: VuVideoConfig) -> Result<()> { | ||
loop { |
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.
We should maybe find a standard way for all the vhost-device daemons regarding looping serving requests.
I think currently looping by restarting daemons is a bit hacky since the socket will actually killed and reinitialized, leaving a window where it becomes unavailable...
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.
At the moment, this loop is in line with what other backends do. If we decide to modify the strategy, I would be happy to prepare a separate PR with a proposal that applies to all backends to keep them consistent.
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.
Except for scsi (I just realized), that it has no loop... do you think it would be better to remove this loop for now?
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.
My comment was mostly reflecting on the current situation. This PR is fine with or without loop. We should just eventually figure out how to prevent each backend to re-decide on this :). Thats of course out-of-scope for this PR.
Ah, did not read that. My fault :). |
bc18810
to
8885fd1
Compare
No worries, I just didn't want to waste anyone's time. I'll check your comments now :) |
8885fd1
to
97dc637
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.
random comments until I get a pretty close look at the whole thing.
39169b0
to
2dc64c7
Compare
44c12ee
to
9f3f4c4
Compare
So, unless I missed something, I tackled all review comments above. I think this PR is ready for another round. In parallel, I want to close the coverage gap as much as possible, but I try to run |
Will try to take a look soon. But won't get around it this week. We will also need to decide how to handle devices that are not fully upstreamed yet. Probably we will want to move them to some separate folder...
You can follow https://github.com/rust-vmm/rust-vmm-ci#running-the-tests-locally to run things locally. |
Which failure do you have? You can also use the cd vhost-device
podman run --device=/dev/kvm -it --rm --security-opt=seccomp=unconfined --volume $(pwd):/crate rustvmm/dev:v26
cd crate
pytest --profile=devel rust-vmm-ci/integration_tests/test_coverage.py Inspired from https://github.com/rust-vmm/rust-vmm-ci#adaptive-coverage |
I was getting:
I was trying yesterday, but I think I picked every source except
So I will add some tests and see where I can get. Thanks! |
Maybe
Strange, I'm not using
Great :-) |
Yep, like a nested workspace maybe called |
We briefly discussed this next to our Linaro Employee meeting in Amsterdam. I think @epilys plans to post a RFC to suggest a solution. |
Yes, that works, and I can omit the container altogether. Thanks! I am not so experienced in Rust so running the |
Okay, I just opened an issue #459. I'll update it, so we are all aware of that. |
I'll keep an eye on both the issue and the RFC, and update this PR accordingly on the decisions. I agree in that having them separated is probably a good idea. |
@stsquad any last comments before we merge this ? |
Should I retrigger the pipelines now that the staging CI is (iinm) fixed? |
I didn't think it would be so long ;-P but we have to wait for this last PR to be merged, then we have to update the submodule here, and at that point we should be ready ;-) |
c7cd582
Looks like the merge did break the lockfile (?). Anyway, let me fix it before merging, so that we leave CIs in a sane state. Will the coverage check run now for the |
Yep, thanks!
Not yet :-( sorry. We still have some issues: #493 Don't worry about that for now, we can fix it later if we have issues. |
Initial skeleton for virtio-video crate. This crate is based on the v3 of the virtio-video specs patch[1]. It has a big part of the infrastructure required, although not all commands are implemented, and does not have any backend available. Includes support for async responses to the driver (through VIDEO_EVENT) to QueueResource messages. [1] - https://lists.oasis-open.org/archives/virtio-dev/202002/msg00002.html Related: rust-vmm#364 Signed-off-by: Albert Esteve <[email protected]>
Add new v4l2-decoder backend, that uses v4l2r [1] for interactions with the video device in the host. Specialized for Linux systems. [1] - https://github.com/Gnurou/v4l2r Signed-off-by: Albert Esteve <[email protected]>
Add test for all modules, with dev-dependencies (including rstest [1] for parametrized tests), and infrastructure. [1] - https://docs.rs/rstest/latest/rstest/ Signed-off-by: Albert Esteve <[email protected]>
Complete the README file for the video crate with the help information for the CLI, and a working example to run and test the device. Signed-off-by: Albert Esteve <[email protected]>
Add v4l2 wrapper functions to be able to mock (and test) v4l2r library responses without the need of having a underlying video device. Signed-off-by: Albert Esteve <[email protected]>
c7cd582
to
2113ad1
Compare
Summary of the PR
This PR adds an experimental virtio-video vhost-user backend, that support v4l2 decoding.
Comments
The virtio specification concerning virtio-video is still being discussed. As such, this device should be considered as
experimental
. It is based in the v3 patch of the specification, as it has its driver working, and even included in someout-of-tree kernels (e.g. chromeos and AAOS). This version of the specification patch was also used for the experimental support of virtio-video in crosvm.
In that sense, I have these branches available to be able to test the device using Qemu:
The driver is available at
https://github.com/aesteve-rh/linux
And the Qemu backend device is available at
https://github.com/aesteve-rh/qemu/tree/virtio-video-v3
The plan in the long term is to update this crate to follow virtio specification once it gets agreed on and published, at which point it will lose its
experimental
status. In the meantime this can be used as PoC, add encoder support, or be used as a basis for verifying a later revision of the specs and help to get them merged.Related: #364
Requirements
These items may not be covered by the patch, I'll address (and mark) them ASAP.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.