virtio-rng: add a control queue
PATCH 1/1 virtio-rng: add a control queue
A control queue is needed to send command to ask the device to release the request buffers if it cannot provide data.
Changes:
5.4.2 Virtqueues
0 requestq
1 controlq
controlq only exists if VIRTIO_RNG_F_CTRL_VQ set.
5.4.3 Feature bits
VIRTIO_RNG_F_CTRL_VQ (0)
Device has a control queue
5.4.5 Device Initialization
Identify and initialize the request virtqueue. If the VIRTIO_RNG_F_CTRL_VQ feature bit is negotiated, identify the control virtqueue.
5.4.6.3 Control Virtqueue
The driver uses the control virtqueue (if VIRTIO_RNG_F_CTRL_VQ is negotiated) to send commands to control the device.
All commands are of the following form:
struct virtio_rng_ctrl_hdr {
u8 cmd;};
5.4.6.3.1 Request Virtqueue Flushing
When the device is not able to provide enough entropy to the driver, the driver can be stuck. And for instance, it cannot be removed from the system to switch to another one. The flush command allows the driver to ask the device to release all the buffers sent to the device and to unlock the driver.
#define VIRTIO_RNG_CMD_FLUSH 0
Bug-Link: https://github.com/oasis-tcs/virtio-spec/issues/83
--- content.tex | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-)
content.tex +36 -2
@@ -4952,10 +4952,16 @@ \subsection{Device ID}\label{sec:Device Types / Entropy Device / Device ID} \subsection{Virtqueues}\label{sec:Device Types / Entropy Device / Virtqueues} \begin{description} \item[0] requestq +\item[1] controlq \end{description} +controlq only exists if VIRTIO_RNG_F_CTRL_VQ set. + \subsection{Feature bits}\label{sec:Device Types / Entropy Device / Feature bits} - None currently defined + +\begin{description} +\item[VIRTIO_RNG_F_CTRL_VQ (0)] Device has a control queue +\end{description} \subsection{Device configuration layout}\label{sec:Device Types / Entropy Device / Device configuration layout} None currently defined.
@@ -4963,7 +4969,11 @@ \subsection{Device configuration layout}\label{sec:Device Types / Entropy Device \subsection{Device Initialization}\label{sec:Device Types / Entropy Device / Device Initialization} \begin{enumerate} -\item The virtqueue is initialized +\item Identify and initialize the request virtqueue. + +\item If the VIRTIO_RNG_F_CTRL_VQ feature bit is negotiated, + identify the control virtqueue. + \end{enumerate} \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device Operation}
@@ -4984,6 +4994,30 @@ \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O The device MUST place one or more random bytes into the buffer, but it MAY use less than the entire buffer length. +\subsubsection{Control Virtqueue}\label{sec:Device Types / Entropy Device / Device Operation / Control Virtqueue} + +The driver uses the control virtqueue (if VIRTIO_RNG_F_CTRL_VQ is +negotiated) to send commands to control the device. + +All commands are of the following form: + +\begin{lstlisting} +struct virtio_rng_ctrl_hdr { + u8 cmd; +}; +\end{lstlisting} + +\paragraph{Request Virtqueue Flushing}\label{sec:Device Types / Entropy Device / Device Operation / Control Virtqueue / Request Virtqueue Flushing} + +When the device is not able to provide enough entropy to the driver, the driver can be stuck. +And for instance, it cannot be removed from the system to switch to another one. +The flush command allows the driver to ask the device to release all the buffers sent to the +device and to unlock the driver. + +\begin{lstlisting} +#define VIRTIO_RNG_CMD_FLUSH 0 +\end{lstlisting} + \section{Traditional Memory Balloon Device}\label{sec:Device Types / Memory Balloon Device} This is the traditional balloon device. The device number 13 is
Signature · 18 lines
2.26.2 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: [email protected] Unsubscribe: [email protected] List help: [email protected] List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/
Quoted 40 lines · On Mon, 3 Aug 2020 15:24:31 +0200 Laurent Vivier <[email protected]> wrote:
A control queue is needed to send command to ask the device to release the request buffers if it cannot provide data.
Changes:
5.4.2 Virtqueues
0 requestq
1 controlq
controlq only exists ifVIRTIO_RNG_F_CTRL_VQset.5.4.3 Feature bits
VIRTIO_RNG_F_CTRL_VQ(0)
Device has a control queue5.4.5 Device Initialization
Identify and initialize the request virtqueue. If theVIRTIO_RNG_F_CTRL_VQfeature bit is negotiated, identify the control virtqueue.5.4.6.3 Control Virtqueue
The driver uses the control virtqueue (ifVIRTIO_RNG_F_CTRL_VQis negotiated) to send commands to control the device.
All commands are of the following form:struct virtio_rng_ctrl_hdr { u8 cmd;};
5.4.6.3.1 Request Virtqueue Flushing
When the device is not able to provide enough entropy to the driver, the driver can be stuck. And for instance, it cannot be removed from the system to switch to another one. The flush command allows the driver to ask the device to release all the buffers sent to the device and to unlock the driver.
#defineVIRTIO_RNG_CMD_FLUSH0Bug-Link: https://github.com/oasis-tcs/virtio-spec/issues/83
Signed-off-by Laurent Vivier <[email protected]>--- content.tex | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-)
(...)
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5013
Quoted 4 lines
+\paragraph{Request Virtqueue Flushing}\label{sec:Device Types / Entropy Device / Device Operation / Control Virtqueue / Request Virtqueue Flushing}
content.tex +3
-0+ +When the device is not able to provide enough entropy to the driver, the driver can be stuck. +And for instance, it cannot be removed from the system to switch to another one.
Maybe
"...the driver may be stuck waiting for the device returning buffers, and cannot be removed..." ?
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5015
Quoted 2 lines
content.tex +2
-0+The flush command allows the driver to ask the device to release all the buffers sent to the +device and to unlock the driver.
What does "unlock the driver" mean?
You'll probably also want a device normative statement for that, something like
"When the driver sends a flush request, the device MUST release all outstanding buffers."
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5019
Quoted 4 lines
content.tex +4
-0+ +\begin{lstlisting} +#define VIRTIO_RNG_CMD_FLUSH 0 +\end{lstlisting}
As we (currently) have only that one command, I think we need to specify that (a) negotiation of the CTRL_VQ feature implies that the flush command is available, and that (b) any other value of cmd should (must?) be ignored by the device. (I'd assume that new commands would require new feature bits.)
Quoted 4 lines
+
\section{Traditional Memory Balloon Device}\label{sec:Device Types / Memory Balloon Device}This is the traditional balloon device. The device number 13 is
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Quoted 53 lines · Cornelia Huck
Quoted 40 lines · On Mon, 3 Aug 2020 15:24:31 +0200 Laurent Vivier <[email protected]> wrote:
A control queue is needed to send command to ask the device to release the request buffers if it cannot provide data.
Changes:
5.4.2 Virtqueues
0 requestq
1 controlq
controlq only exists ifVIRTIO_RNG_F_CTRL_VQset.5.4.3 Feature bits
VIRTIO_RNG_F_CTRL_VQ(0)
Device has a control queue5.4.5 Device Initialization
Identify and initialize the request virtqueue. If theVIRTIO_RNG_F_CTRL_VQfeature bit is negotiated, identify the control virtqueue.5.4.6.3 Control Virtqueue
The driver uses the control virtqueue (ifVIRTIO_RNG_F_CTRL_VQis negotiated) to send commands to control the device.
All commands are of the following form:struct virtio_rng_ctrl_hdr { u8 cmd;};
5.4.6.3.1 Request Virtqueue Flushing
When the device is not able to provide enough entropy to the driver, the driver can be stuck. And for instance, it cannot be removed from the system to switch to another one. The flush command allows the driver to ask the device to release all the buffers sent to the device and to unlock the driver.
#defineVIRTIO_RNG_CMD_FLUSH0Bug-Link: https://github.com/oasis-tcs/virtio-spec/issues/83
Signed-off-by Laurent Vivier <[email protected]>--- content.tex | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-)(...)
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5013
Quoted 4 lines
+\paragraph{Request Virtqueue Flushing}\label{sec:Device Types / Entropy Device / Device Operation / Control Virtqueue / Request Virtqueue Flushing}
content.tex +3
-0+ +When the device is not able to provide enough entropy to the driver, the driver can be stuck. +And for instance, it cannot be removed from the system to switch to another one.Maybe
Quoted 2 lines
"...the driver may be stuck waiting for the device returning buffers, and cannot be removed..." ?
ok
Quoted 5 lines
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5015
Quoted 3 lines
content.tex +2
-0+The flush command allows the driver to ask the device to release all the buffers sent to the +device and to unlock the driver.What does "unlock the driver" mean?
In fact, this is very implementation specific: in current linux implementation the driver is waiting on the data with read mutex locked. And with this mutex locked you can't do anything else in the driver...
I will replace this by:
"This allows the driver to release resources allocated to receive data from the device."
Quoted 6 lines
You'll probably also want a device normative statement for that, something like
"When the driver sends a flush request, the device MUST release all outstanding buffers."
Quoted 10 lines
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5019
Quoted 4 lines
content.tex +4
-0+ +\begin{lstlisting} +#define VIRTIO_RNG_CMD_FLUSH 0 +\end{lstlisting}As we (currently) have only that one command, I think we need to specify that (a) negotiation of the
CTRL_VQfeature implies that the flush command is available, and that (b) any other value of cmd should (must?) be ignored by the device. (I'd assume that new commands would require new feature bits.)
I will add:
"The negociation of the CTRL_VQ feature implies that the flush command is available."
"Any other value of cmd MUST be ignored by the device."
But where? In this section?
Thanks,
Laurent
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
Quoted 65 lines · On Mon, 3 Aug 2020 17:00:34 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 53 lines · Cornelia Huck
Quoted 40 lines · On Mon, 3 Aug 2020 15:24:31 +0200 Laurent Vivier <[email protected]> wrote:
A control queue is needed to send command to ask the device to release the request buffers if it cannot provide data.
Changes:
5.4.2 Virtqueues
0 requestq
1 controlq
controlq only exists ifVIRTIO_RNG_F_CTRL_VQset.5.4.3 Feature bits
VIRTIO_RNG_F_CTRL_VQ(0)
Device has a control queue5.4.5 Device Initialization
Identify and initialize the request virtqueue. If theVIRTIO_RNG_F_CTRL_VQfeature bit is negotiated, identify the control virtqueue.5.4.6.3 Control Virtqueue
The driver uses the control virtqueue (ifVIRTIO_RNG_F_CTRL_VQis negotiated) to send commands to control the device.
All commands are of the following form:struct virtio_rng_ctrl_hdr { u8 cmd;};
5.4.6.3.1 Request Virtqueue Flushing
When the device is not able to provide enough entropy to the driver, the driver can be stuck. And for instance, it cannot be removed from the system to switch to another one. The flush command allows the driver to ask the device to release all the buffers sent to the device and to unlock the driver.
#defineVIRTIO_RNG_CMD_FLUSH0Bug-Link: https://github.com/oasis-tcs/virtio-spec/issues/83
Signed-off-by Laurent Vivier <[email protected]>--- content.tex | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-)(...)
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5013
Quoted 4 lines
+\paragraph{Request Virtqueue Flushing}\label{sec:Device Types / Entropy Device / Device Operation / Control Virtqueue / Request Virtqueue Flushing}
content.tex +3
-0+ +When the device is not able to provide enough entropy to the driver, the driver can be stuck. +And for instance, it cannot be removed from the system to switch to another one.Maybe
Quoted 2 lines
"...the driver may be stuck waiting for the device returning buffers, and cannot be removed..." ?
ok
Quoted 5 lines
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5015
Quoted 3 lines
content.tex +2
-0+The flush command allows the driver to ask the device to release all the buffers sent to the +device and to unlock the driver.What does "unlock the driver" mean?
Quoted 7 lines
In fact, this is very implementation specific: in current linux implementation the driver is waiting on the data with read mutex locked. And with this mutex locked you can't do anything else in the driver...
I will replace this by:
"This allows the driver to release resources allocated to receive data from the device."
Sounds good.
Quoted 18 lines
Quoted 7 lines
You'll probably also want a device normative statement for that, something like
"When the driver sends a flush request, the device MUST release all outstanding buffers."
Quoted 10 lines
content.tex \subsection{Device Operation}\label{sec:Device Types / Entropy Device / Device O · line 5019
Quoted 4 lines
content.tex +4
-0+ +\begin{lstlisting} +#define VIRTIO_RNG_CMD_FLUSH 0 +\end{lstlisting}As we (currently) have only that one command, I think we need to specify that (a) negotiation of the
CTRL_VQfeature implies that the flush command is available, and that (b) any other value of cmd should (must?) be ignored by the device. (I'd assume that new commands would require new feature bits.)
Quoted 4 lines
I will add:
"The negociation of the
CTRL_VQfeature implies that the flush command is available."
"If VIRTIO_RNG_F_CTRL_VQ is negotiated, the device MUST implement the flush command." ?
Quoted 3 lines
"Any other value of cmd MUST be ignored by the device."
But where? In this section?
I think you want a devicenormative paragraph in the control vq subsection (also for the MUST statement above.) This needs to be referenced by the conformance part of the spec.
Quoted 4 lines
Thanks,
Laurent
This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/