rust-vmm / vhost-user-backend

Deprecated repository, code now lives in: https://github.com/rust-vmm/vhost/
Apache License 2.0
18 stars 16 forks source link

Allow VringMutex and VringRwLock to work with MockSplitQueues #48

Closed mathieupoirier closed 2 years ago

mathieupoirier commented 2 years ago

MockSplitQueues, available in the virtio-queue crate, allows for the testing of vring operations by implementing the virtio backend side of the equation. Key to that concept is the sharing of the memory used by the Queues, something that is currently not possible since the VringT trait does not have a function to create a new element from a Queue. Something like:

let mem = GuestMemoryAtomic::new( GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0x100000), 0x10000)]).unwrap(), );

let vq = MockSplitQueue::new(&mem, 16); let q = vq.create_queue(mem); let vring = VringRwLock::new(q, 16);

That way DescriptorChains can be inserted in @vq and processed from @vring. An example of how DescriptorChains can be created and inserted in the MockSplitQueue can be found here.

For all that to work the VringState will also need to be created from an existing Queue and the GuestMemory trait implemented for GuestMemoryAtomic\<GuestMemoryMmap>.

vireshk commented 2 years ago

Please see if something like this can be done instead:

https://github.com/rust-vmm/vhost-device/pull/63

mathieupoirier commented 2 years ago

For the time being I think we can move forward with @vireshk's proposal. We can revisit making modifications to the vhost-user-backend crate if that doesn't work. As such I will close this issue.