-
Notifications
You must be signed in to change notification settings - Fork 48
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 vhost-device I2C support #1
Conversation
i2c/Cargo.toml
Outdated
authors = ["Viresh Kumar <viresh.kumar@linaro.org>"] | ||
description = "vhost i2c backend device" | ||
repository = "https://github.com/rust-vmm/vhost-device" | ||
edition = "2018" |
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.
Can you add all the fields that were in the root Cargo.toml?
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.
done
i2c/Cargo.toml
Outdated
@@ -9,3 +9,11 @@ edition = "2018" | |||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |||
|
|||
[dependencies] | |||
clap = { version = "2.33.3", features = ["yaml"] } | |||
epoll = "4.3" |
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.
Can you use vmm-sys-util instead? We have an epoll wrapper there that is relatively safer than the epoll
as it checks the results of unsafe functions.
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.
Can you use vmm-sys-util instead? We have an epoll wrapper there that is relatively safer than the
epoll
as it checks the results of unsafe functions.
I used epoll instead as https://github.com/rust-vmm/vhost-user-backend uses the same and my repo depends on a function prototype from there.
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.
Is that fine @andreeaflorescu ?
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.
Oh, I see. Okay.
We have to setup the repo & the CI as well. |
I've setup the Buildkite CI. On the next push we should be able to see the results of running the pipeline. |
- What are the main components of the crate? How do they interact which each | ||
other? | ||
This repository hosts various 'vhost-user' device backends in their own crates. | ||
See their individual README.md files for specific information about those |
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.
How about also mentioning all these devices (which right now is just one 😆) here as well, and have a link that takes you to their readme?
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.
done
i2c/README.md
Outdated
work with any virtual machine monitor (VMM) that supports vhost-user. See the | ||
Examples section below. | ||
|
||
##Synopsis |
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.
nit: need space after ##
.
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.
thx, done
d941338
to
04bd4bd
Compare
@vireshk this is the first time we run the tests for a workspace, so there might be problems that we discover along the way and that we might need to address. It looks like one potential problem is that the coverage seems to be 0%. This means that it is not correctly computed by |
Okay, meanwhile I am trying to fix all the problems reported by the bot and commented on by you. Few doubts though:
|
Yes, that's okay. That's the development method that we are following.
You can just ping people when you want to look at your code again. Some folks are automatically following all repositories created in rust-vmm, but you can also ask on Slack or ping people here on GitHub. We do not have a predefined process for this. |
ef87941
to
e349285
Compare
@andreeaflorescu I was able to get rid of all other errors and warnings, and only two are leftL coverage-x86 and cargo-audit and I do not understand how to fix them. If there is something wrong in my repo or it is because of the workspace thing you mentioned. will it be possible for you to look at it? |
@andreeaflorescu I have updated the code based on your feedback and all the errors generated by the CI. Please give it another glance once you get a chance. Thanks. |
It looks like you're pulling a dependency on a vulnerable crate: https://buildkite.com/rust-vmm/vhost-device-ci/builds/12#ede8f33d-722f-4da2-a7ff-57b9e2d218f7. Can you update that? Can you try some configurations with the workspace such that the coverage is correctly computed? To do that, you'll need to follow the instructions from here: https://github.com/rust-vmm/rust-vmm-ci#adaptive-coverage to run the coverage test. The latest container version is 11. To check the coverage result, you'll need to run the command with
You will find the aggregated coverage results in |
LE: it looks like this PR adds no unit tests. Can you add some? Since this crate exports a binary, it might make sense to also have an integration test. |
Cargo.toml
Outdated
|
||
[dependencies] | ||
members = [ | ||
"i2c", |
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.
Can you move this under the src/
directory? Otherwise we are going to have lots of things in the root of the repository as we add more devices.
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.
Can you move this under the
src/
directory? Otherwise we are going to have lots of things in the root of the repository as we add more devices.
done
I have this in my dependencies: clap = { version = "2.33.3", features = ["yaml"] } This clap crate is fetching yaml-rust (I am not doing that directly) and in there somehow the versioning thing is getting screwed up. Here is clap's dependency, which looks just fine: yaml-rust = { version = "0.4.1", optional = true } What should I be doing here to fix this ? |
9f5a8e5
to
b5d906d
Compare
I have raised an issue for this with clap, something is wrong. |
@andreeaflorescu gentle reminder! |
58050ad
to
b7359ad
Compare
@jiangliu I have lost your review by mistake. Ideally I should have just added a patch on top, but instead did force-push by mistake. By the time I realized I made the mistake, I coulnd't do anything to get your review back. Here is what changed since the time you reviewed this: https://pastebin.com/PDQqvS4G |
@andreeaflorescu Clap requires rustc >= 1.54, how do I fix that to make the build work ? |
Do you need the latest version of clap? Can you fix the dependency to a version that doesn't need the latest version? |
@vireshk I am not following this repository. If you need my help, can you ping me on Slack/email? |
This adds the boilerplate code and its dependencies to get the basic structure for the i2c crate. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This patch implements the low level I2C helpers responsible for transferring data and parsing the adapters and their clients. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This patch implements process_queue() to process incoming requests. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This updates the main README and adds a specific one for i2c crate. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This adds unit tests for the i2c workspace. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Done. |
Reduce the test coverage score as the files apart from i2c.rs are mostly boilerplate code and it is difficult to test them as well as it may not be worth it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
I will not be able to review the code as we are unlikely to use it in the near future, and I currently have other priorities. I can give a formal approve so you can merge the code. It would be good to find another crate owner that can help with reviewing subsequent PRs. We require 2 approvals for PRs to be merged. I think @sboeuf had some concerns related to publishing this crate before the driver changes are merged in upstream Linux. Are those now merged? Before publishing this crate to crates.io, can you please check the requirements for publishing? I am mostly concerned about the coverage which is still very low compared to the other rust-vmm crates. We can merge this initial PR first, and work on incremental changes to make sure we keep the same quality bar as for existing components. Does that make sense? |
Sure.
It is already accepted by the I2C maintainer, and is waiting for a dependency patch to land in first.
The part which is missing the testing is vhu_i2c.rs, which is mostly the implementation of vhost-user-backend device and I am not sure how to add testing code for it, since the same is missing here: https://github.com/rust-vmm/vhost-user-backend
Sure. |
And it is merged finally. |
Cool! Let's proceed with this PR then :) |
virtio_sound.rs: Added device configuration and common definitions
Hi @andreeaflorescu
Earlier discussion: rust-vmm/community#106
I have tried to migrate my existing i2c work over to this repository and did whatever made sense to me (in respect to the workspace thing). There are high chances that I might have made some mistakes here.
I know there would be a lot of things that would require improvement in the i2c code as well as I am really a newbie to the rust world, apologies in advance for reviewing not so great code.
Thanks