Skip to content

Commit

Permalink
packed virtqueues: more efficient virtqueue layout
Browse files Browse the repository at this point in the history
Performance analysis of this is in my kvm forum 2016 presentation.  The
idea is to have a r/w descriptor in a ring structure, replacing the used
and available ring, index and descriptor buffer.

This is also easier for devices to implement than the 1.0 layout.
Several more enhancements will be necessary to actually make this
efficient for devices to use.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Approved-by: https://www.oasis-open.org/apps/org/workgroup/virtio/ballot.php?id=3177
Fixes: oasis-tcs#3
  • Loading branch information
mstsirkin committed Mar 20, 2018
1 parent 8ff142a commit 40d6ce0
Show file tree
Hide file tree
Showing 2 changed files with 715 additions and 3 deletions.
28 changes: 25 additions & 3 deletions content.tex
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,20 @@ \section{Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Virtqueues}

\end{note}

Two formats are supported: Split Virtqueues (see \ref{sec:Basic
Facilities of a Virtio Device / Split
Virtqueues}~\nameref{sec:Basic Facilities of a Virtio Device /
Split Virtqueues}) and Packed Virtqueues (see \ref{sec:Basic
Facilities of a Virtio Device / Packed
Virtqueues}~\nameref{sec:Basic Facilities of a Virtio Device /
Packed Virtqueues}).

Every driver and device supports either the Packed or the Split
Virtqueue format, or both.

\input{split-ring.tex}

\input{packed-ring.tex}
\chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation}

We start with an overview of device initialization, then expand on the
Expand Down Expand Up @@ -5215,10 +5227,15 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
\begin{description}
\item[VIRTIO_F_RING_INDIRECT_DESC (28)] Negotiating this feature indicates
that the driver can use descriptors with the VIRTQ_DESC_F_INDIRECT
flag set, as described in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table / Indirect Descriptors}~\nameref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table / Indirect Descriptors}.

flag set, as described in \ref{sec:Basic Facilities of a Virtio
Device / Virtqueues / The Virtqueue Descriptor Table / Indirect
Descriptors}~\nameref{sec:Basic Facilities of a Virtio Device /
Virtqueues / The Virtqueue Descriptor Table / Indirect
Descriptors} and \ref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Support}~\nameref{sec:Packed Virtqueues / Indirect Flag: Scatter-Gather Support}.
\item[VIRTIO_F_RING_EVENT_IDX(29)] This feature enables the \field{used_event}
and the \field{avail_event} fields as described in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Interrupt Suppression} and \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Used Ring}.
and the \field{avail_event} fields as described in
\ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Interrupt Suppression}, \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Used Ring} and \ref{sec:Packed Virtqueues / Driver and Device Event Suppression}.


\item[VIRTIO_F_VERSION_1(32)] This indicates compliance with this
specification, giving a simple way to detect legacy devices or drivers.
Expand All @@ -5228,6 +5245,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
addresses in memory. If this feature bit is set to 0, then the device emits
physical addresses which are not translated further, even though an IOMMU
may be present.
\item[VIRTIO_F_RING_PACKED(34)] This feature indicates
support for the packed virtqueue layout as described in
\ref{sec:Basic Facilities of a Virtio Device / Packed Virtqueues}~\nameref{sec:Basic Facilities of a Virtio Device / Packed Virtqueues}.
\end{description}

\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
Expand All @@ -5241,6 +5261,8 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
VIRTIO_F_IOMMU_PLATFORM is not offered, then a driver MUST pass only physical
addresses to the device.

A driver SHOULD accept VIRTIO_F_RING_PACKED if it is offered.

\devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}

A device MUST offer VIRTIO_F_VERSION_1. A device MAY fail to operate further
Expand Down
Loading

0 comments on commit 40d6ce0

Please sign in to comment.