-
Notifications
You must be signed in to change notification settings - Fork 565
vhost-user-generic: add support #7221
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
base: main
Are you sure you want to change the base?
Conversation
aed497d to
cd6b328
Compare
b101b21 to
64b241c
Compare
2b46ed3 to
5c8e3f7
Compare
|
Can you give an example of what a |
5c8e3f7 to
e084e44
Compare
|
A |
|
The QEMU patch referenced in #7189 -- https://lore.kernel.org/qemu-devel/20230901110018.3704459-1-alex.bennee@linaro.org/ -- shows that it is still in RFC status. What's the latest status in QEMU? There is a flag How will this work in practice? Do you have a working backend to support this already? |
I don’t think the patch was accepted. QEMU does have a generic vhost-user device, but (like this patch) it requires parameters to be passed by the user rather than fetching them from the backend. QEMU also requires a trivial source-code patch to enable the feature, which this patch doesn’t need.
You are correct.
This works with an unmodified virtiofsd, but the caller must explicitly provide all of the parameters needed. If I did not make any copy-and-paste mistakes, I used the following option to make a virtio-fs device: --vhost-user-generic \
"socket=build/virtiofsd.sock,virtio_id=26,avail_features=$((0x5970000000)),avail_protocol_features=$((0x920b)),queue_size=1024,num_queues=1,min_queues=1,id=virtiofs0"This interface is deliberately low-level to allow maximum flexibility. Callers are expected to know the parameters for their particular device. Higher-level tooling is expected to provide a user-friendly interface. |
887cdc6 to
7cccee1
Compare
7cccee1 to
e8b8f38
Compare
|
Needs some clippy fixes. |
595b465 to
986efa7
Compare
This was breaking CI for PR cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
c52ba0a to
298d2b4
Compare
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This breaks CI for cloud-hypervisor#7221. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
298d2b4 to
cb61104
Compare
alyssais
left a comment
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.
Some proofreading issues in the commit message:
- "vhost-user-vhost"
- "generic vhost-user-generic device"
vmm/src/config.rs
Outdated
| pub const SYNTAX: &'static str = "virtio-vhost-user parameters \ | ||
| \"virtio_id=<id>,socket=<socket_path>,num_queues=<number_of_queues>,\ | ||
| queue_size=<size_of_each_queue>,id=<device_id>,pci_segment=<segment_id>,\ | ||
| min_queues=<minimum_number_of_queues>,avail_features=<available features>\""; |
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.
I wouldn't! That's maintenance burden. If we find flexibility is needed later, it's a lot easier to add it then than it is to remove unnecessary flexibility down the line.
vmm/src/config.rs
Outdated
| Ok(()) | ||
| } | ||
|
|
||
| fn validate_always_identifier( |
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.
Let's rename it to something we understand, then?
7e1c247 to
a00688b
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.
I tested this with virtiofsd and it does not work. The culprit apepars to be configuration space access: the read_config and write_config functions are never called, as shown by a panic!() in them not triggering. Also, I have no idea how much config space is needed, so I don't know how much to save and restore. Therefore, I added a todo!() in the restore code.
Update: Cause of the problem was not adding the MetaVirtioDevice to the list of devices.
a2cb9f0 to
17930d1
Compare
|
Culprit is commit a8d1411, which had an incompatible change to internal APIs. |
|
This is ready for review, but I do not expect migration to work. The reason is that the configuration space is not stored anywhere. I don’t know how large configuration space should be so I don’t know how large to make it. |
It should always succeed and is apparently implicitly called by libc or some dependency somewhere. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This adds support for a generic vhost-user-generic device. All information about this device must be provided to Cloud Hypervisor via the command-line or API. Allowing gettid() is needed to prevent seccomp violations. It has negligible attack surface. Fixes cloud-hypervisor#7189 Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
17930d1 to
a85589c
Compare
Great! I think we can still move forward with integrating but we will need to generate an error on an attempt to migrate. |
Given we just pass through configuration space reads and writes to the backend, wouldn't it be the responsibility of the backend to restore its configuration space when restarted? |
| .map_err(Error::VhostUserGetQueueMaxNum)? | ||
| as usize | ||
| } else { | ||
| default_queues.into() |
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.
Wasn't this supposed to be inferred from the queue sizes? Why do we need another parameter? It's starting to feel like every time I look at this PR there's a new redundant way to specify the number of queues! 😅
Makes sense - let's just make sure that we don't get a silent failure when trying to migrate (I don't mind that migration is unsupported - I just don't want it to blow up on the destination, I think that's a bit user hostile!) |
This adds support for a generic vhost-user-generic device. All information about this device must be provided to Cloud Hypervisor via the command-line or API.
Fixes #7189