All of lore.kernel.org
 help / color / mirror / Atom feed
From: Parav Pandit <parav@nvidia.com>
To: Cornelia Huck <cohuck@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Cc: "virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>, Oren Duer <oren@nvidia.com>
Subject: RE: [PATCH v2] Add device reset timeout field
Date: Mon, 11 Oct 2021 15:44:14 +0000	[thread overview]
Message-ID: <PH0PR12MB5481502C480B6A7C1B61DFD6DCB59@PH0PR12MB5481.namprd12.prod.outlook.com> (raw)
In-Reply-To: <871r4ry5do.fsf@redhat.com>



> From: Cornelia Huck <cohuck@redhat.com>
> Sent: Monday, October 11, 2021 8:29 PM
> 
> On Mon, Oct 11 2021, Parav Pandit <parav@nvidia.com> wrote:
> 
> >> From: Michael S. Tsirkin <mst@redhat.com>
> >> Sent: Saturday, October 9, 2021 4:39 AM
> >>
> >> On Fri, Oct 08, 2021 at 01:23:52PM +0000, Parav Pandit wrote:
> >> >
> >> >
> >> > > From: Michael S. Tsirkin <mst@redhat.com>
> >> > > Sent: Friday, October 8, 2021 6:27 PM
> >> >
> >> > > > 2. A sriov VF virtio device for our case takes a lot lesser
> >> > > > than this, but may
> >> > > take anywhere between 10 msec to 250msec.
> >> > > > This can happen on a firmware where user enabled 500 SR-IOV VFs.
> >> > > > Pci spec indicates that all VFs to initialize within 100msec.
> >> > > > This translates to
> >> > > 0.2msec for one VF.
> >> > > > In some scenario this can be a hard to initialize a VF in 0.2
> >> > > > msec depending
> >> > > on what else a firmware is doing at that time.
> >> > >
> >> > > That's separate from virtio reset though. virtio reset is much
> >> > > lighter weight than a VF reset, all it needs to do is return
> >> > > config space to original values and stop DMA.
> >> > Again you took the valid example to stop the DMA of already
> >> > initialized device, while above case is for the first init. :-)
> >> > virtio device is going
> >> the first reset during initialization. It should be able to tell how long to wait.
> >> > A device firmware may take more than 0.2msec to finish needed
> >> > initialization
> >> to serve a virtio device.
> >> > Infinite wait of today works here.
> >>
> >> Looks like it's as Cornelia said - nothing to do with reset. E.g.
> >> it's likely device can not even serve pci config before the init is complete.
> >>
> > Not sure. I replied to Cornelia.
> > A pci device once placed on the pci bus has to respond to the config requests.
> > However virtio pci device virtio config registers can be accessed only after
> reset is completed.
> 
> What I don't understand: if a pci device is in such a state that it cannot
> complete a reset, how can it be able to serve the pci config? In the cases I saw
> mentioned (hotunplug, slow device startup), I'd expect the device simply being
> slow/unable to respond to anything.
> >
Not necessarily.
PCI device implementation in hw/fw needs to comply to the PCI spec that defines pci level semantics.
Device implements virtio specification on top of the PCI spec.
Serving virtio functionality is more than just PCI configs, so device implementation able to service pci requests but may not be ready to serve virtio block and networking IOs.
This provides best tradeoffs in hw implementation of what is done in which layer of hw/fw etc for PCI and virtio layer.

Such implementation is very common in multiple PCI device families such as mlx5, nvme and more.
For example nvme device has controller ready timeout with granularity of 500msec and has 16-bits of timeout.

> > More below.
> >
> > Feature negotiation is mainly for backward compatibility.
> 
> Related, I found I had opened this issue some time ago:
> https://github.com/oasis-tcs/virtio-spec/issues/98 Might be relevant when
> considering guarding this via a feature bit.
> 
If you think above can see day light, we may have feature bit for device reset too.
However above github note says "read optional field before FEATURES_OK", and not read optional field _before_ device reset.
Do you plan to modify issues/98 to read optional field before device reset?

> > This is unlikely to work the reset is completed. Because a real device
> implementing this would prefer to do this in fw for 1000 virtio devices sitting on
> the physical card.
> > And it is very much driven by such implementation at device devel.
> > So it cannot update the counter value if reset is not completed for the device.
> >
> > I think read only device reset timeout is most elegant option during device
> initialization phase that eliminates infinite loop of today.
> 
> Why can't a driver just go ahead and do a timeout regardless? 
o.k. lets consider this thought exercise. What is the timeout value that driver will choose if device doesn't specify one?
I explained in previous thread and you acked that actual fw based device may take longer to initialize than pure sw implementation backend.
In second example a pre-boot device can take even longer initialization time.
Sriov VF device may initialize lot faster.
Instead of driver having such transport, and device specific checks, (or some very short or very long timeout), we propose, that let device mention such timeout value.

> This seems
> pretty much to depend on the implementation. Nothing in the virtio spec forces
> the driver to reset all devices serially and wait potentially forever. (If you deal
> with a large amount of subdevices you cannot access concurrently, you likely
> already have problems.)
Sure, nothing in driver forces serial initialization.
However in reality, PCI device scanning on the bus in hotplug driver, preboot env, sriov vf initialization is serial.
In preboot case, even the order is defined, so it is sort of serial.

In other uses, concurrent access is fine and host does that today when it disables autoprobe on the PCI Bus and probes them in parallel after enabling sriov.
I hope you understand that there are both use-cases exists which scan parallel and some serial.


  reply	other threads:[~2021-10-11 15:44 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 14:10 [PATCH v2] Add device reset timeout field Parav Pandit
2021-10-06 15:22 ` Michael S. Tsirkin
2021-10-06 16:11   ` Parav Pandit
2021-10-06 20:53     ` Michael S. Tsirkin
2021-10-07  3:42       ` Parav Pandit
2021-10-07 16:10         ` [virtio-dev] " Cornelia Huck
2021-10-07 17:58           ` Parav Pandit
2021-10-08 10:00             ` [virtio-dev] " Cornelia Huck
2021-10-08 10:19               ` Parav Pandit
2021-10-08 10:12             ` Michael S. Tsirkin
2021-10-08 10:51               ` Parav Pandit
2021-10-08 11:18                 ` [virtio-dev] " Michael S. Tsirkin
2021-10-08 12:55                   ` Parav Pandit
2021-10-08 10:44         ` Michael S. Tsirkin
2021-10-08 10:59           ` Parav Pandit
2021-10-08 11:21             ` Michael S. Tsirkin
2021-10-08 11:45               ` Parav Pandit
2021-10-08 11:47               ` [virtio-dev] " Cornelia Huck
2021-10-08 12:12                 ` Parav Pandit
2021-10-08 12:57                   ` Michael S. Tsirkin
2021-10-08 13:23                     ` Parav Pandit
2021-10-08 23:09                       ` Michael S. Tsirkin
2021-10-11 14:29                         ` Parav Pandit
2021-10-11 14:59                           ` [virtio-dev] " Cornelia Huck
2021-10-11 15:44                             ` Parav Pandit [this message]
2021-10-11 16:00                               ` Michael S. Tsirkin
2021-10-12  8:51                                 ` Parav Pandit
2021-10-12  9:01                                   ` Michael S. Tsirkin
2021-10-12  9:12                                     ` Parav Pandit
2021-10-14 17:35                                       ` Parav Pandit
2021-10-14 22:28                                         ` Michael S. Tsirkin
2021-10-15  4:36                                           ` Parav Pandit
2021-10-15  5:15                                             ` [virtio-dev] " Jason Wang
2021-10-15  5:20                                               ` Parav Pandit
2021-10-15  6:40                                                 ` Jason Wang
2021-10-15  6:42                                                 ` Jason Wang
2021-10-15  6:48                                                   ` Parav Pandit
2021-10-15  7:02                                                     ` Jason Wang
2021-10-15  8:21                                                       ` Parav Pandit
2021-10-15  8:42                                                         ` Jason Wang
2021-10-22  7:20                                                           ` Parav Pandit
2021-10-25  5:41                                                             ` Jason Wang
2021-10-25  6:11                                                               ` Parav Pandit
2021-10-26  4:03                                                                 ` Jason Wang
2021-10-27  8:04                                                                   ` Parav Pandit
2021-10-27  8:26                                                                     ` Michael S. Tsirkin
2021-10-28  4:01                                                                       ` Parav Pandit
2021-10-28  5:50                                                                         ` Michael S. Tsirkin
2021-10-28  6:06                                                                           ` Parav Pandit
2021-10-15  6:51                                             ` Cornelia Huck
2021-10-15  8:09                                               ` Parav Pandit
2021-10-15  9:25                                                 ` [virtio-dev] " Cornelia Huck
2021-10-22  6:29                                                   ` Parav Pandit
2021-10-11 16:22                               ` [virtio-dev] " Cornelia Huck
2021-10-12 10:35                                 ` Parav Pandit

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=PH0PR12MB5481502C480B6A7C1B61DFD6DCB59@PH0PR12MB5481.namprd12.prod.outlook.com \
    --to=parav@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=mst@redhat.com \
    --cc=oren@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=virtio-dev@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.