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] Improve the efficiency of needs_notification for queues #161

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

alexandruag
Copy link
Collaborator

This PR proposes an improvement to the efficiency of storing state and executing functionality related to the needs_notification queue logic. It replaces the current signalled_used: Option<Wrapping<u16>> member of the state structure with a num_added: Wrapping<u16> (which keeps track of how many descriptor chains have been added to the used ring since the last call to needs_notification), and also simplifies the logic in needs_notification.

A similar approach is used in the Linux virtio code as well (one example can be found here). It appears to bring noticeable performance improvements in use cases where needs_notification calls constitute an increased proportion of the overall budget allocated for device model functionality (i.e. when using io_uring-based backends).

This commit changes the way state is stored and logic is computed
to determine whether the device should notify the guest driver about
adding a descriptor chain to the used ring when the EVENT_IDX feature
is negotiated. The `signalled_used` member of `QueueState`, currently
an `Option<Wrapping<u16>>`, is replaced with an `Wrapping<u16>`, and
the `needs_notification` implementation is altered as well.

Signed-off-by: Alexandru Agache <[email protected]>
@andreeaflorescu andreeaflorescu merged commit 96e3043 into rust-vmm:main Apr 21, 2022
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.

3 participants