Skip to contentSkip to conversation

clarify device reset

RFC PATCH Superseded Cornelia Huck 4 participants 10 messages Jan 18, 2021 – Jan 23, 2021

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 clarify device reset

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +13 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+
 \section{Device Configuration Space}\label{sec:Basic Facilities of a Virtio Device / Device Configuration Space}
 
 Device configuration space is generally used for rarely-changing or
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/
#1 lore raw
Quoted 38 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +3 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 10 lines
content.tex +10 -0
+device initialization and device cleanup.
+
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

Dave

Quoted 23 lines
content.tex +0 -0
 \section{Device Configuration Space}\label{sec:Basic Facilities of a Virtio Device / Device Configuration Space}
 
 Device configuration space is generally used for rarely-changing or
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/
Signature · 18 lines
Dr. David Alan Gilbert / [email protected] / Manchester, UK


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 46 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 45 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +10 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 3 lines
content.tex +3 -0
+
+A device MUST NOT send notifications after receiving a reset.
+  

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I'm actually not 100% sure about that requirement... we can also drop it.

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/

#3 lore raw
Quoted 58 lines · On Mon, 18 Jan 2021 17:48:42 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 46 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 45 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +10 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 3 lines
content.tex +3 -0
+
+A device MUST NOT send notifications after receiving a reset.
+    

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

Quoted 3 lines

I'm actually not 100% sure about that requirement... we can also drop it.

Please see my response to Dave's mail. In short, I don't we need to drop it , I think we need to improve and expand.

Regards,
Halil

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
In reply to Dr. David Alan Gilbert
Quoted 36 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 35 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +0 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
Quoted 13 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 13 lines
content.tex +13 -0
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+

s/after receiving a reset/after presenting a 0 status, that indicates the reset is done/

Quoted 5 lines

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I agree, but with the proposed modification not any more.

To answer your question: PCI has the following driver normative (which I believe needs to be generalized so we have something similar for each transport, and thus the same semantics):
"After writing 0 to device_status, the driver MUST wait for a read of device_status to return 0 before reinitializing the device." (4.1.4.3.2 Driver Requirements: Common configuration structure layout,
https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-1090004)

In general, after asking for a reset, the driver should/must ensure that the reset was performed by the device by reading a 0 status. If the status is non-zero, the reset at the device may still be in progress. IMHO we need another driver normative for that.

Of course tying this kind of sequencing (happens-before) to the receiving of a reset does not work. I agree with that to the fullest.

Regards,
Halil

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/

#5 lore raw
Quoted 39 lines · On Tue, 19 Jan 2021 03:40:08 +0100 Halil Pasic <[email protected]> wrote:
Quoted 36 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 35 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +0 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
content.tex +5 -0
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 8 lines
content.tex +8 -0
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+  

s/after receiving a reset/after presenting a 0 status, that indicates the reset is done/

"A device MUST NOT send notifications after indicating completion of the reset by reinitializing the device status to 0."

?

Quoted 16 lines
Quoted 5 lines

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I agree, but with the proposed modification not any more.

To answer your question: PCI has the following driver normative (which I believe needs to be generalized so we have something similar for each transport, and thus the same semantics):
"After writing 0 to device_status, the driver MUST wait for a read of device_status to return 0 before reinitializing the device." (4.1.4.3.2 Driver Requirements: Common configuration structure layout,
https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-1090004)

Quoted 4 lines

In general, after asking for a reset, the driver should/must ensure that the reset was performed by the device by reading a 0 status. If the status is non-zero, the reset at the device may still be in progress. IMHO we need another driver normative for that.

"After the driver has initiated a reset of the device, it MUST NOT consider the reset to be completed if the device status is not 0."

?

Maybe without the double negation.

(We could consider the reset for ccw devices done once we get final status for the reset ccw. Would save the round trip for a read status ccw, but would also be different from the other transports.)

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/

#6 lore raw
Quoted 59 lines · On Tue, 19 Jan 2021 18:45:06 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 39 lines · On Tue, 19 Jan 2021 03:40:08 +0100 Halil Pasic <[email protected]> wrote:
Quoted 36 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 35 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
 conformance.tex |  1 +
 content.tex     | 13 +++++++++++++
 2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
 \begin{itemize}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
 \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +0 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
 terminology. Occasionally, the term event is used to refer to
 a notification or a receipt of a notification.
 
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
content.tex +5 -0
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 8 lines
content.tex +8 -0
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+    

s/after receiving a reset/after presenting a 0 status, that indicates the reset is done/

Quoted 4 lines

"A device MUST NOT send notifications after indicating completion of the reset by reinitializing the device status to 0."

?

Works with me. I tried to align my wording with the pci wording.

Quoted 22 lines
Quoted 17 lines
Quoted 6 lines

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I agree, but with the proposed modification not any more.

To answer your question: PCI has the following driver normative (which I believe needs to be generalized so we have something similar for each transport, and thus the same semantics):
"After writing 0 to device_status, the driver MUST wait for a read of device_status to return 0 before reinitializing the device." (4.1.4.3.2 Driver Requirements: Common configuration structure layout,
https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-1090004)

Quoted 4 lines

In general, after asking for a reset, the driver should/must ensure that the reset was performed by the device by reading a 0 status. If the status is non-zero, the reset at the device may still be in progress. IMHO we need another driver normative for that.

Quoted 4 lines

"After the driver has initiated a reset of the device, it MUST NOT consider the reset to be completed if the device status is not 0."

?

", before it reads status 0."

My point is, that usually when I do an assignment to a memory location with a single instruction, and the instruction completes successfully, for me (on my CPU), that memory location is 0.

PCI is however not like this: the device can delay or reject the write, apparently. Jason taught me that. So I think we should insist on the read.

Quoted 6 lines

Maybe without the double negation.

(We could consider the reset for ccw devices done once we get final status for the reset ccw. Would save the round trip for a read status ccw, but would also be different from the other transports.)

We could work around that by making a positive statement. Not telling, when the driver MUST NOT consider the reset completed, but tell when the driver SHOULD consider the reset completed.

The MUST NOT does not buy much to the driver. It knows, what is certainly wrong, but it still does not know what is right. What the driver needs is a criterion when the reset is certainly completed (so it can free up resources for example).

Regards,
Halil

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/

#7 lore raw
Quoted 90 lines · Halil Pasic
Quoted 57 lines · On Tue, 19 Jan 2021 18:45:06 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 39 lines · On Tue, 19 Jan 2021 03:40:08 +0100 Halil Pasic <[email protected]> wrote:
Quoted 36 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 35 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
  conformance.tex |  1 +
  content.tex     | 13 +++++++++++++
  2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
  \begin{itemize}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +0 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
  terminology. Occasionally, the term event is used to refer to
  a notification or a receipt of a notification.
 
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
content.tex +5 -0
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 8 lines
content.tex +8 -0
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+

s/after receiving a reset/after presenting a 0 status, that indicates the reset is done/

Quoted 4 lines

"A device MUST NOT send notifications after indicating completion of the reset by reinitializing the device status to 0."

?

Works with me. I tried to align my wording with the pci wording.

Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I agree, but with the proposed modification not any more.

To answer your question: PCI has the following driver normative (which I believe needs to be generalized so we have something similar for each transport, and thus the same semantics):
"After writing 0 to device_status, the driver MUST wait for a read of device_status to return 0 before reinitializing the device." (4.1.4.3.2 Driver Requirements: Common configuration structure layout,
https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-1090004)

Quoted 8 lines
Quoted 4 lines

In general, after asking for a reset, the driver should/must ensure that the reset was performed by the device by reading a 0 status. If the status is non-zero, the reset at the device may still be in progress. IMHO we need another driver normative for that.

"After the driver has initiated a reset of the device, it MUST NOT consider the reset to be completed if the device status is not 0."

?

", before it reads status 0."

Quoted 7 lines

My point is, that usually when I do an assignment to a memory location with a single instruction, and the instruction completes successfully, for me (on my CPU), that memory location is 0.

PCI is however not like this: the device can delay or reject the write, apparently. Jason taught me that. So I think we should insist on the read.

Yes. For PCI the status is implemented via registers, there's no guarantee a read is 0 after write 0 to that.

Quoted 6 lines
Quoted 6 lines

Maybe without the double negation.

(We could consider the reset for ccw devices done once we get final status for the reset ccw. Would save the round trip for a read status ccw, but would also be different from the other transports.)

I think it's probably not a problem since we don't care about the performance of reset.

Thanks

Quoted 19 lines

We could work around that by making a positive statement. Not telling, when the driver MUST NOT consider the reset completed, but tell when the driver SHOULD consider the reset completed.

The MUST NOT does not buy much to the driver. It knows, what is certainly wrong, but it still does not know what is right. What the driver needs is a criterion when the reset is certainly completed (so it can free up resources for example).

Regards,
Halil

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.

Quoted 9 lines

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/

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/

#8 lore raw
Quoted 95 lines · On Wed, 20 Jan 2021 11:13:37 +0800 Jason Wang <[email protected]> wrote:
Quoted 94 lines · Halil Pasic
Quoted 57 lines · On Tue, 19 Jan 2021 18:45:06 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 39 lines · On Tue, 19 Jan 2021 03:40:08 +0100 Halil Pasic <[email protected]> wrote:
Quoted 36 lines · On Mon, 18 Jan 2021 16:41:32 +0000 "Dr. David Alan Gilbert"…
Quoted 35 lines · * Cornelia Huck ([email protected]) wrote:

Properly specify that the method for the driver to request a device reset is transport specific, and some action the device has to take.

---

RFC -> RFC v2:
- moved reset spec to basic facilities

---
  conformance.tex |  1 +
  content.tex     | 13 +++++++++++++
  2 files changed, 14 insertions(+)
conformance.tex +1 -0
index eb3324053080..3be499ae3c5e 100644
@@ -271,6 +271,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Targets}
  \begin{itemize}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Status Field}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Feature Bits}
+\item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Reset}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Device Configuration Space}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Message Framing}
  \item \ref{devicenormative:Basic Facilities of a Virtio Device / Virtqueues / The Virtqueue Descriptor Table}
content.tex +0 -0
index 620c0e28c9a7..782ddf3ed78d 100644
@@ -193,6 +193,19 @@ \section{Notifications}\label{sec:Basic Facilities of a Virtio Device
  terminology. Occasionally, the term event is used to refer to
  a notification or a receipt of a notification.
 
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
content.tex +5 -0
+\section{Device Reset}\label{sec:Basic Facilities of a Virtio Device / Device Reset}
+
+The driver may initiate a device reset at various times; notably, during
+device initialization and device cleanup.
+
Quoted 8 lines

content.tex \section{Notifications}\label{sec:Basic Facilities of a Virtio Device · line 208

Quoted 8 lines
content.tex +8 -0
+The mechanism used by the driver to initiate the reset is transport specific.
+
+\devicenormative{\subsection}{Device Reset}{Basic Facilities of a Virtio Device / Device Reset}
+
+A device MUST reinitialize device status to 0 after receiving a reset.
+
+A device MUST NOT send notifications after receiving a reset.
+  

s/after receiving a reset/after presenting a 0 status, that indicates the reset is done/

Quoted 4 lines

"A device MUST NOT send notifications after indicating completion of the reset by reinitializing the device status to 0."

?

Works with me. I tried to align my wording with the pci wording.

Quoted 14 lines
Quoted 14 lines
Quoted 4 lines

This feels like a bit of a race in the description; a Device may have just sent a notification at the point that it receives a reset. When a driver initiates a reset, how does the driver know that the device has received it?

I agree, but with the proposed modification not any more.

To answer your question: PCI has the following driver normative (which I believe needs to be generalized so we have something similar for each transport, and thus the same semantics):
"After writing 0 to device_status, the driver MUST wait for a read of device_status to return 0 before reinitializing the device." (4.1.4.3.2 Driver Requirements: Common configuration structure layout,
https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-1090004)

Quoted 8 lines
Quoted 4 lines

In general, after asking for a reset, the driver should/must ensure that the reset was performed by the device by reading a 0 status. If the status is non-zero, the reset at the device may still be in progress. IMHO we need another driver normative for that.

"After the driver has initiated a reset of the device, it MUST NOT consider the reset to be completed if the device status is not 0."

?

", before it reads status 0."

My point is, that usually when I do an assignment to a memory location with a single instruction, and the instruction completes successfully, for me (on my CPU), that memory location is 0.

Quoted 7 lines
Quoted 3 lines

PCI is however not like this: the device can delay or reject the write, apparently. Jason taught me that. So I think we should insist on the read.

Yes. For PCI the status is implemented via registers, there's no guarantee a read is 0 after write 0 to that.

I thought it was clear that the driver cannot know the device status without doing a read, but we certainly can make that explicit.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Maybe without the double negation.

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

(We could consider the reset for ccw devices done once we get final status for the reset ccw. Would save the round trip for a read status ccw, but would also be different from the other transports.)

I think it's probably not a problem since we don't care about the performance of reset.

I was less concerned about the performance, more about the complexity of the implementation. Sending an extra command is not that bad, though.

Quoted 7 lines

Thanks

Quoted 3 lines

We could work around that by making a positive statement. Not telling, when the driver MUST NOT consider the reset completed, but tell when the driver SHOULD consider the reset completed.

That could be

"The driver SHOULD consider a driver-initiated reset complete when it reads the device status as 0."

Quoted 5 lines
Quoted 5 lines

The MUST NOT does not buy much to the driver. It knows, what is certainly wrong, but it still does not know what is right. What the driver needs is a criterion when the reset is certainly completed (so it can free up resources for example).

Any further comments before I put together a v3 (without the RFC)? I also need to open a github issue for this.

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/

#9 lore raw
Quoted 8 lines · On Fri, 22 Jan 2021 11:42:12 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

We could work around that by making a positive statement. Not telling, when the driver MUST NOT consider the reset completed, but tell when the driver SHOULD consider the reset completed.

That could be

"The driver SHOULD consider a driver-initiated reset complete when it reads the device status as 0."

Sounds good to me!

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

The MUST NOT does not buy much to the driver. It knows, what is certainly wrong, but it still does not know what is right. What the driver needs is a criterion when the reset is certainly completed (so it can free up resources for example).

Any further comments before I put together a v3 (without the RFC)? I also need to open a github issue for this.

No further comments. I think we are heading in the right direction.

Regards,
Halil

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/