Skip to contentSkip to conversation

virtio: introduce VIRTIO_F_RING_RESET for reset queue

PATCH Jason Wang 2 participants 4 messages Aug 26, 2021 – Aug 27, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jason Wang

author
#1 lore raw
Quoted 30 lines · Xuan Zhuo

cc [email protected]

Quoted 27 lines · Xuan Zhuo

This patch allows the driver to reset a queue individually.

This is very common on general network equipment. By disabling a queue, you can quickly reclaim the buffer currently on the queue. If necessary, we can reinitialize the queue separately.

For example, when virtio-net implements support for AF_XDP, we need to disable a queue to release all the original buffers when AF_XDP setup. And quickly release all the AF_XDP buffers that have been placed in the queue when AF_XDP exits.

Since mmio's QueueReady allows setting 0 to stop the queue, there is no need to distinguish whether VIRTIO_F_RING_RESET is negotiated.

---
  content.tex | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
content.tex +0 -0
index 7cec1c3..70a9765 100644
@@ -1001,7 +1001,13 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
  After writing 0 to \field{device_status}, the driver MUST wait for a read of
  \field{device_status} to return 0 before reinitializing the device.
 
Quoted 8 lines

content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 1010

Quoted 8 lines
content.tex +7 -1
-The driver MUST NOT write a 0 to \field{queue_enable}.
+If the VIRTIO_F_RING_RESET feature bit is not negotiated,
+the driver MUST NOT write a 0 to \field{queue_enable}.
+
+Otherwise, if the VIRTIO_F_RING_RESET feature bit is negotiated,
+the driver can stop using the queue by writing a 0 to \field{queue_enable} and
+MUST read the value back to ensure synchronization. Then optionally re-enable
+the queue.

So I think we need to clarify what did "stop" mean here. Since you're use "RESET" in the feature I guess the virtqueue state is also reset. That's fine but I'm not sure if MMIO has the similar semantic.

E.g is the virtqueue state preserved during a stop and resume?

Thanks

Quoted 17 lines
Quoted 17 lines
content.tex +3 -1
  \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability}
 
@@ -6672,6 +6678,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
    transport specific.
    For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
 
+  \item[VIRTIO_F_RING_RESET(40)] This feature indicates
+  that the driver can reset a queue individually.
+
  \end{description}
 
  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--

2.31.0

Quoted 4 lines
Quoted 4 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

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/

#2 lore raw
Quoted 47 lines · Jason Wang
Quoted 30 lines · Xuan Zhuo

cc [email protected]

Quoted 27 lines · Xuan Zhuo

This patch allows the driver to reset a queue individually.

This is very common on general network equipment. By disabling a queue, you can quickly reclaim the buffer currently on the queue. If necessary, we can reinitialize the queue separately.

For example, when virtio-net implements support for AF_XDP, we need to disable a queue to release all the original buffers when AF_XDP setup. And quickly release all the AF_XDP buffers that have been placed in the queue when AF_XDP exits.

Since mmio's QueueReady allows setting 0 to stop the queue, there is no need to distinguish whether VIRTIO_F_RING_RESET is negotiated.

---
  content.tex | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)
content.tex +0 -0
index 7cec1c3..70a9765 100644
@@ -1001,7 +1001,13 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
  After writing 0 to \field{device_status}, the driver MUST wait for a read of
  \field{device_status} to return 0 before reinitializing the device.
 
Quoted 8 lines

content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 1010

Quoted 8 lines
content.tex +7 -1
-The driver MUST NOT write a 0 to \field{queue_enable}.
+If the VIRTIO_F_RING_RESET feature bit is not negotiated,
+the driver MUST NOT write a 0 to \field{queue_enable}.
+
+Otherwise, if the VIRTIO_F_RING_RESET feature bit is negotiated,
+the driver can stop using the queue by writing a 0 to \field{queue_enable} and
+MUST read the value back to ensure synchronization. Then optionally re-enable
+the queue.

So I think we need to clarify what did "stop" mean here. Since you're use "RESET" in the feature I guess the virtqueue state is also reset. That's fine but I'm not sure if MMIO has the similar semantic.

Quoted 1 line

E.g is the virtqueue state preserved during a stop and resume?

"To stop using the queue the driver MUST write zero (0x0) to this QueueReady and MUST read the value back to ensure synchronization."

Judging from the description of the spec, the more emphasis is on the stop of the queue. It does not express whether the queue can be re-enabled.

I think MMIO also adds the judgment for VIRTIO_F_RING_RESET here. If this function is successfully negotiated, then MMIO also supports queue reset, otherwise MMIO only supports stop queue.

The "stop" I understand means the destruction of all the states of the entire queue and the release of memory. Re-enable means reallocating the memory as when the device is initialized, and synchronizing this information to the device. I will improve this part of the information in the next version.

Regarding the description of the state during a stop and resume, I will add it in the next version.

Thanks.

Quoted 21 lines

Thanks

Quoted 17 lines
Quoted 17 lines
content.tex +3 -1
  \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability}
 
@@ -6672,6 +6678,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
    transport specific.
    For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
 
+  \item[VIRTIO_F_RING_RESET(40)] This feature indicates
+  that the driver can reset a queue individually.
+
  \end{description}
 
  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--

2.31.0

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#3 lore raw
Quoted 46 lines · Xuan Zhuo
Quoted 45 lines · Jason Wang
Quoted 30 lines · Xuan Zhuo

cc [email protected]

Quoted 27 lines · Xuan Zhuo

This patch allows the driver to reset a queue individually.

This is very common on general network equipment. By disabling a queue, you can quickly reclaim the buffer currently on the queue. If necessary, we can reinitialize the queue separately.

For example, when virtio-net implements support for AF_XDP, we need to disable a queue to release all the original buffers when AF_XDP setup. And quickly release all the AF_XDP buffers that have been placed in the queue when AF_XDP exits.

Since mmio's QueueReady allows setting 0 to stop the queue, there is no need to distinguish whether VIRTIO_F_RING_RESET is negotiated.

---
   content.tex | 11 ++++++++++-
   1 file changed, 10 insertions(+), 1 deletion(-)
content.tex +0 -0
index 7cec1c3..70a9765 100644
@@ -1001,7 +1001,13 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
   After writing 0 to \field{device_status}, the driver MUST wait for a read of
   \field{device_status} to return 0 before reinitializing the device.
 
Quoted 8 lines

content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 1010

Quoted 8 lines
content.tex +7 -1
-The driver MUST NOT write a 0 to \field{queue_enable}.
+If the VIRTIO_F_RING_RESET feature bit is not negotiated,
+the driver MUST NOT write a 0 to \field{queue_enable}.
+
+Otherwise, if the VIRTIO_F_RING_RESET feature bit is negotiated,
+the driver can stop using the queue by writing a 0 to \field{queue_enable} and
+MUST read the value back to ensure synchronization. Then optionally re-enable
+the queue.

So I think we need to clarify what did "stop" mean here. Since you're use "RESET" in the feature I guess the virtqueue state is also reset. That's fine but I'm not sure if MMIO has the similar semantic.

Quoted 6 lines
Quoted 1 line

E.g is the virtqueue state preserved during a stop and resume?

"To stop using the queue the driver MUST write zero (0x0) to this QueueReady and MUST read the value back to ensure synchronization."

Judging from the description of the spec, the more emphasis is on the stop of the queue. It does not express whether the queue can be re-enabled.

Yes.

Quoted 5 lines

I think MMIO also adds the judgment for VIRTIO_F_RING_RESET here. If this function is successfully negotiated, then MMIO also supports queue reset, otherwise MMIO only supports stop queue.

Quoted 7 lines

The "stop" I understand means the destruction of all the states of the entire queue and the release of memory. Re-enable means reallocating the memory as when the device is initialized, and synchronizing this information to the device. I will improve this part of the information in the next version.

Regarding the description of the state during a stop and resume, I will add it in the next version.

A question regarding to the semantic of "resume". I guess it means the virtqueue will start from e.g avail index 0?

Thanks

Quoted 22 lines

Thanks.

Quoted 19 lines

Thanks

Quoted 16 lines
Quoted 16 lines
content.tex +3 -1
   \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability}
 
@@ -6672,6 +6678,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
     transport specific.
     For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
 
+  \item[VIRTIO_F_RING_RESET(40)] This feature indicates
+  that the driver can reset a queue individually.
+
   \end{description}
 
   \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--

2.31.0

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

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/

#4 lore raw
Quoted 69 lines · Jason Wang
Quoted 46 lines · Xuan Zhuo
Quoted 45 lines · Jason Wang
Quoted 30 lines · Xuan Zhuo

cc [email protected]

Quoted 27 lines · Xuan Zhuo

This patch allows the driver to reset a queue individually.

This is very common on general network equipment. By disabling a queue, you can quickly reclaim the buffer currently on the queue. If necessary, we can reinitialize the queue separately.

For example, when virtio-net implements support for AF_XDP, we need to disable a queue to release all the original buffers when AF_XDP setup. And quickly release all the AF_XDP buffers that have been placed in the queue when AF_XDP exits.

Since mmio's QueueReady allows setting 0 to stop the queue, there is no need to distinguish whether VIRTIO_F_RING_RESET is negotiated.

---
   content.tex | 11 ++++++++++-
   1 file changed, 10 insertions(+), 1 deletion(-)
content.tex +0 -0
index 7cec1c3..70a9765 100644
@@ -1001,7 +1001,13 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport
   After writing 0 to \field{device_status}, the driver MUST wait for a read of
   \field{device_status} to return 0 before reinitializing the device.
 
Quoted 8 lines

content.tex \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport · line 1010

Quoted 8 lines
content.tex +7 -1
-The driver MUST NOT write a 0 to \field{queue_enable}.
+If the VIRTIO_F_RING_RESET feature bit is not negotiated,
+the driver MUST NOT write a 0 to \field{queue_enable}.
+
+Otherwise, if the VIRTIO_F_RING_RESET feature bit is negotiated,
+the driver can stop using the queue by writing a 0 to \field{queue_enable} and
+MUST read the value back to ensure synchronization. Then optionally re-enable
+the queue.

So I think we need to clarify what did "stop" mean here. Since you're use "RESET" in the feature I guess the virtqueue state is also reset. That's fine but I'm not sure if MMIO has the similar semantic.

Quoted 6 lines
Quoted 1 line

E.g is the virtqueue state preserved during a stop and resume?

"To stop using the queue the driver MUST write zero (0x0) to this QueueReady and MUST read the value back to ensure synchronization."

Judging from the description of the spec, the more emphasis is on the stop of the queue. It does not express whether the queue can be re-enabled.

Yes.

Quoted 10 lines

I think MMIO also adds the judgment for VIRTIO_F_RING_RESET here. If this function is successfully negotiated, then MMIO also supports queue reset, otherwise MMIO only supports stop queue.

The "stop" I understand means the destruction of all the states of the entire queue and the release of memory. Re-enable means reallocating the memory as when the device is initialized, and synchronizing this information to the device. I will improve this part of the information in the next version.

Quoted 6 lines
Quoted 2 lines

Regarding the description of the state during a stop and resume, I will add it in the next version.

A question regarding to the semantic of "resume". I guess it means the virtqueue will start from e.g avail index 0?

Yes.

Thanks.

Quoted 26 lines

Thanks

Quoted 22 lines

Thanks.

Quoted 19 lines

Thanks

Quoted 16 lines
Quoted 16 lines
content.tex +3 -1
   \subsubsection{Notification structure layout}\label{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Notification capability}
 
@@ -6672,6 +6678,9 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
     transport specific.
     For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
 
+  \item[VIRTIO_F_RING_RESET(40)] This feature indicates
+  that the driver can reset a queue individually.
+
   \end{description}
 
   \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
--

2.31.0

Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]