All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	stefanha@redhat.com, virtio-comment@lists.oasis-open.org,
	eperezma@redhat.com, sgarzare@redhat.com
Subject: Re: [virtio-comment] [PATCH RFC] virtio: introduce VIRTIO_F_DEVICE_STOP
Date: Tue, 12 Jan 2021 13:13:19 +0100	[thread overview]
Message-ID: <20210112131319.39014c19.cohuck@redhat.com> (raw)
In-Reply-To: <a8544ac8-4b4b-79b8-4345-5fc4f584f719@redhat.com>

On Tue, 12 Jan 2021 11:27:20 +0800
Jason Wang <jasowang@redhat.com> wrote:

> On 2021/1/12 上午2:16, Cornelia Huck wrote:
> > On Wed, 30 Dec 2020 16:15:47 +0800
> > Jason Wang <jasowang@redhat.com> wrote:
> >  
> >> On 2020/12/29 下午9:35, Halil Pasic wrote:  
> >>> On Mon, 28 Dec 2020 15:01:57 +0800
> >>> Jason Wang <jasowang@redhat.com> wrote:
> >>>     
> >>>> Some part of the virtio has enforced an asynchronous interface during reset:
> >>>>
> >>>> For MMIO the spec said:
> >>>>
> >>>> """
> >>>>
> >>>> To stop using the queue the driver MUST write zero (0x0) to this
> >>>> QueueReady and MUST read the value back to ensure synchronization.
> >>>>
> >>>> """  
> >>> I read the MMIO quote like a single read is sufficient to ensure
> >>> synchronization. I.e. it does not require a loop which waits for
> >>> the read to yield the expected value.
> >>>     
> >>>> For PCI it said:
> >>>>
> >>>> """
> >>>>
> >>>> After writing 0 to device_status, the driver MUST wait for a read of
> >>>> device_status to return 0 before reinitializing the device.
> >>>>
> >>>> """  
> >>> Yes, this does sound like a loop. And that's what Linux does. But this
> >>> is transport (PCI) specific. On a spec level, a reset is a distinct
> >>> operation from setting device status (to 0).  
> >>
> >> I'm not sure or it looks unclear to me for this point.
> >>
> >> E.g the device reset is mentioned in "Device Status Field" belongs to
> >> "Basic Facilities of a Virtio Device". But there's no "Device Reset" in
> >> "Basic Facilities of a Virtio Device".  
> > I think it should be, just to make clear what a driver-initiated reset
> > of a device actually resets (and that the method for doing so is
> > transport-specific.)  
> 
> 
> Then we need some clarifications in the spec. It would be easily imply 
> that reset is part of device status after reading "Basic Facilities of a 
> Virtio Device".

I can try to come up with a patch.

> 
> 
> >  
> >>  
> >>> It just happens to be
> >>> mapped to the PCI transport as setting the status to 0.  
> >>
> >> MMIO did the same. And it makes sense since using a single API to
> >> configure/change device status looks simpler.
> >>
> >>  
> >>> For the channel IO transport it is mapped via CCW_CMD_VDEV_RESET while
> >>> setting the status is mapped via CCW_CMD_WRITE_STATUS.  
> >>
> >> Yes, but I think actually there's no limitation if we want to tread 0 as
> >> a reset command for CCW_CMD_WRITE_STATUS.  
> > I'm not a fan of the "driver writes 0 to status to initiate a device
> > reset" method, but we are stuck with it. I think it's actually not
> > working well with two other requirements in the spec:
> >
> > - "The driver MUST NOT clear a device status bit."  
> 
> 
> Yes, that's kind of conflict but it was how PCI works now ...

Nod.

> 
> 
> > - "The device MUST initialize device status to 0 upon reset." (This
> >    suggests to me that a zero status is something set by the device as
> >    the result of a reset request by the driver, and _not_ set by the
> >    driver.)  
> 
> 
> Not a native speaker but we probably need to define "set" and "clear" 
> mean, E.g:
> 
> Clear a bit from driver means write with that bit cleared. Set a bit 
> from driver means write with that bit set.

Agreed.

> Clear a bit from device means read with that be cleared. Set a bit from 
> device means read with that bit set.

I always saw the status as an actual part of the device. I.e., the
device setting or clearing a bit means that the device is modifying the
status in the device. The driver doing a read will get the status as it
currently is within the device. IOW, the device "controls" the status,
and the driver can submit changes to the status.

[Maybe that's closer to how ccw operates with its commands for reading
or writing the status. Are pci/mmio envisioning the status more like
some kind of shared area?]

> 
> So a question here is how to trigger the device set as we discussed before.
> 
> 
> >
> > Also, treating CCW_CMD_WRITE_STATUS with 0 as a reset request would be
> > incompatible with older devices, wouldn't it?  
> 
> 
> Probably, but we can make both methods work. Note that I'm not 
> suggesting doing something like this. Just to point out it may work. And 
> there's something not clear in the spec.

I'm still not convinced that's the way to go. But first, we should be
clear on how the status really is supposed to work.


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/


  reply	other threads:[~2021-01-12 12:13 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  4:23 [virtio-comment] [PATCH RFC] virtio: introduce VIRTIO_F_DEVICE_STOP Jason Wang
2020-12-18 10:15 ` [virtio-comment] " Stefano Garzarella
2020-12-21  3:08   ` Jason Wang
2020-12-21 11:06     ` Stefano Garzarella
2020-12-22  2:38       ` Jason Wang
2020-12-21 21:33 ` [virtio-comment] " Halil Pasic
2020-12-22  2:36   ` Jason Wang
2020-12-22  6:50     ` Halil Pasic
2020-12-22  7:30       ` Jason Wang
2020-12-22 12:14         ` Cornelia Huck
2020-12-22 12:51           ` Jason Wang
2020-12-22 15:54             ` Cornelia Huck
2020-12-23  2:48               ` Jason Wang
2020-12-25  7:38                 ` Halil Pasic
2020-12-27 10:00                   ` Michael S. Tsirkin
2020-12-28  6:21                     ` Halil Pasic
2020-12-28  7:01                       ` Jason Wang
2020-12-28 12:30                         ` Michael S. Tsirkin
2020-12-29  9:04                           ` Jason Wang
2021-01-12 10:54                             ` Michael S. Tsirkin
2021-01-13  3:35                               ` Jason Wang
2020-12-29 13:35                         ` Halil Pasic
2020-12-30  8:15                           ` Jason Wang
2021-01-11 18:16                             ` Cornelia Huck
2021-01-12  3:27                               ` Jason Wang
2021-01-12 12:13                                 ` Cornelia Huck [this message]
2021-01-13  2:52                                   ` Jason Wang
2021-01-14 12:00                                     ` Cornelia Huck
2020-12-28  6:47                   ` Jason Wang
2020-12-29 13:20                     ` Halil Pasic
2020-12-30  8:03                       ` Jason Wang
2020-12-24  4:52             ` Halil Pasic
2020-12-24  5:51               ` Jason Wang
2020-12-25  3:18                 ` Halil Pasic
2020-12-25  6:45                   ` Jason Wang
2020-12-27 11:12                     ` Michael S. Tsirkin
2020-12-28  7:05                       ` Jason Wang
2020-12-28 12:27                         ` Michael S. Tsirkin
2020-12-29  8:57                           ` Jason Wang
2021-05-03  9:02 ` [virtio-comment] " Eugenio Perez Martin
2021-05-06  2:51   ` Jason Wang
2021-05-05 13:16 ` Michael S. Tsirkin
2021-05-06  7:26   ` Jason Wang

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=20210112131319.39014c19.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.