Discussion of the VIRTIO specification
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>,
	virtio-comment@lists.oasis-open.org,
	Jason Wang <jasowang@redhat.com>
Subject: Re: [virtio-comment] [PATCH RFC v2] clarify device reset
Date: Tue, 19 Jan 2021 03:40:08 +0100	[thread overview]
Message-ID: <20210119034008.735f80ad.pasic@linux.ibm.com> (raw)
In-Reply-To: <20210118164132.GC9899@work-vm>

On Mon, 18 Jan 2021 16:41:32 +0000
"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:

> * Cornelia Huck (cohuck@redhat.com) 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.
> > 
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> > 
> > RFC -> RFC v2:
> >   - moved reset spec to basic facilities
> > 
> > ---
> >  conformance.tex |  1 +
> >  content.tex     | 13 +++++++++++++
> >  2 files changed, 14 insertions(+)
> > 
> > diff --git a/conformance.tex b/conformance.tex
> > index eb3324053080..3be499ae3c5e 100644
> > --- a/conformance.tex
> > +++ b/conformance.tex
> > @@ -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}
> > diff --git a/content.tex b/content.tex
> > index 620c0e28c9a7..782ddf3ed78d 100644
> > --- a/content.tex
> > +++ b/content.tex
> > @@ -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.
> > +

s/after receiving a reset/after presenting a 0 status, that indicates
the reset is done/  
> 
> 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: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
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/


  parent reply	other threads:[~2021-01-19  2:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 16:38 [virtio-comment] [PATCH RFC v2] clarify device reset Cornelia Huck
2021-01-18 16:41 ` Dr. David Alan Gilbert
2021-01-18 16:48   ` Cornelia Huck
2021-01-19  2:42     ` Halil Pasic
2021-01-19  2:40   ` Halil Pasic [this message]
2021-01-19 17:45     ` Cornelia Huck
2021-01-19 18:52       ` Halil Pasic
2021-01-20  3:13         ` Jason Wang
2021-01-22 10:42           ` Cornelia Huck
2021-01-23  2:48             ` Halil Pasic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210119034008.735f80ad.pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox