Skip to content
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

RFC: extend Queue to support packed queue #39

Closed
wants to merge 10 commits into from

Conversation

jiangliu
Copy link
Member

@jiangliu jiangliu commented Dec 30, 2020

Fixes: #6
This patch set is based on #38 , and aims to implement an PoC by extending current Queue implementation to support Packed Queue. Current design shares most part with split queue, and use flag to control support of packed.

Currently it only implements basic support of packed to receive available descriptors and send used descriptors. More effort is needed to support device/driver event suppress mechanism.

The virtio queue is duplex comunication channel, it receives available
descriptors from the driver and sends used descriptor to the driver.
So the queue could be split into a receive endpoint and a sender
endpoint.

With split queue, the receiver endpoint receives available descriptors
from driver by accessing the descriptor table and available ring.
It also updates device event suppression status when receiving available
descriptors. For the sender endpoint, it puts used descriptors into the
used ring. It also queries driver event suppression status when sending
used descriptors.

For packed queue, it includes a descriptor table, a driver event
suppression block and a device event suppression block. So packed queue
could be abstracted in the same way as split queue.

Current queue implementation is optimzed for single thread environment,
there a single thread will receive available descriptors, handle these
descriptors and then send those used descriptors in order. This mode
will limit the performance of high IO virtio backends, such as virtiofs.

So split the queue into receiver and sender. Due to implementation
complex, the receiver still only supports single thread environment.
For the sender endpoint, both a single thread version and a multiple
thread version are provided. For the multi-thread version, it could be
send between threads, and the sender and the receiver could work
concurrently.

Signed-off-by: Liu Jiang <[email protected]>
The Virtio 1.1 specification states that:
The device MUST ignore the write-only flag (flags&VIRTQ_DESC_F_WRITE)
in the descriptor that refers to an indirect table.

So change Descriptor.is_writable() to follow the spec.

Signed-off-by: Liu Jiang <[email protected]>
The main interface to access available descriptor chain is the
DescriptorChain, so hdie internal helper methods of Descriptor.
There are several constraints related descriptor flags, simply
exposing accessors for those flags may cause misuse. So make them
as private.

It's also a preparation for packed queue.

Signed-off-by: Liu Jiang <[email protected]>
The virtio 1.1 spec defines two types of descriptors, the traditional
split descriptor and the new packed descriptor. So add definition for
packed descriptor.

Signed-off-by: Liu Jiang <[email protected]>
Enhance the DescriptorChain iterator to handle packed descriptor too.
The SplitDescriptor is still used for external interface, and internal
PackedDescriptor is converted to SplitDescriptor because the latter
contains more information.

Signed-off-by: Liu Jiang <[email protected]>
Change AvaiIter to an enum, so it could support both split and packed
queues.

Signed-off-by: Liu Jiang <[email protected]>
Pass more informtion to UsedRingT:set_ready() for packed queue.

Signed-off-by: Liu Jiang <[email protected]>
Refine the Queue::add_used() interface to support packed queue.

Signed-off-by: Liu Jiang <[email protected]>
@serban300
Copy link

Hi @jiangliu ! I was wondering if you had the chance to run any performance tests on the packed queues implementation and if you noticed any significant improvement compared to split queues.

@jiangliu
Copy link
Member Author

jiangliu commented Feb 9, 2021

Hi @jiangliu ! I was wondering if you had the chance to run any performance tests on the packed queues implementation and if you noticed any significant improvement compared to split queues.

I have no performance data yet.
To be honest, after implementing the packed queue, I feel it's more friendly to hardware implemented virtio devices. For software emulated virtio device, I feel the packed queue may not help too much. So I'm a little hesitate whether we should implement packed queue.

@jiangliu jiangliu closed this Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants