virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Angus Chen <angus.chen@jaguarmicro.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset
Date: Tue, 11 Apr 2023 06:15:48 -0400	[thread overview]
Message-ID: <20230411061409-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <TY2PR06MB3424DE523E669A3B1910D7F0859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>

On Tue, Apr 11, 2023 at 07:30:48AM +0000, Angus Chen wrote:
> 
> 
> > -----Original Message-----
> > From: Michael S. Tsirkin <mst@redhat.com>
> > Sent: Tuesday, April 11, 2023 3:21 PM
> > To: Angus Chen <angus.chen@jaguarmicro.com>
> > Cc: Jason Wang <jasowang@redhat.com>;
> > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset
> > 
> > On Tue, Apr 11, 2023 at 07:17:14AM +0000, Angus Chen wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Michael S. Tsirkin <mst@redhat.com>
> > > > Sent: Tuesday, April 11, 2023 2:56 PM
> > > > To: Angus Chen <angus.chen@jaguarmicro.com>
> > > > Cc: Jason Wang <jasowang@redhat.com>;
> > > > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> > > > Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset
> > > >
> > > > On Tue, Apr 11, 2023 at 06:49:03AM +0000, Angus Chen wrote:
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Michael S. Tsirkin <mst@redhat.com>
> > > > > > Sent: Tuesday, April 11, 2023 2:47 PM
> > > > > > To: Angus Chen <angus.chen@jaguarmicro.com>
> > > > > > Cc: Jason Wang <jasowang@redhat.com>;
> > > > > > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> > > > > > Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset
> > > > > >
> > > > > > On Tue, Apr 11, 2023 at 06:36:39AM +0000, Angus Chen wrote:
> > > > > > > Hi.
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Jason Wang <jasowang@redhat.com>
> > > > > > > > Sent: Tuesday, April 11, 2023 1:24 PM
> > > > > > > > To: Angus Chen <angus.chen@jaguarmicro.com>
> > > > > > > > Cc: mst@redhat.com; virtualization@lists.linux-foundation.org;
> > > > > > > > linux-kernel@vger.kernel.org
> > > > > > > > Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset
> > > > > > > >
> > > > > > > > On Tue, Apr 11, 2023 at 9:39 AM Angus Chen
> > > > > > <angus.chen@jaguarmicro.com>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > We read the status of device after reset,
> > > > > > > > > It is not guaranteed that the device be reseted successfully.
> > > > > > > > > We can use a while loop to make sure that,like the modern device
> > did.
> > > > > > > > > The spec is not request it ,but it work.
> > > > > > > >
> > > > > > > > The only concern is if it's too late to do this.
> > > > > > > >
> > > > > > > > Btw, any reason you want to have a legacy hardware implementation.
> > It
> > > > > > > > will be very tricky to work correctly.
> > > > > > >   En,I found this in the real production environment some times about
> > > > one
> > > > > > year ago.
> > > > > > > and I fix this out of tree.our virtio card had been sold about thousands .
> > > > > > >
> > > > > > >   Now,we created a new card, it support virtio 0.95,1.0,1.1 etc.
> > > > > >
> > > > > > I am not 100% sure what does this mean.
> > > > > > So it's a transitional device then?
> > > > > Hi mst,it is a real card in the In cloud computing ,not transitional device.
> > > >
> > > > yes, a real card. But you said it supports 0.95, 1.0 and 1.1 guests,
> > > > so this is what the virtio spec calls a transitional device, right?
> > > >
> > > > 	To simplify transition from these earlier draft interfaces,
> > > > 	a device MAY implement:
> > > >
> > > > 	\begin{description}
> > > > 	\item[Transitional Device]
> > > > 		a device supporting both drivers conforming to this
> > > > 		specification, and allowing legacy drivers.
> > > > 	\end{description}
> > > >
> > > > or did I misunderstand?
> > > >
> > > Yes, I'm not sure whether I make myself clear.
> > > We support the vritio spec  0.95, 1.0 and 1.1 in the same card.
> > > And the numer of devices is 1k per one card.
> > >
> > > Btw, thanks a lot for the work of redhat, we just Implement the virtio protocol
> > by hardware.
> > 
> > Yes, not very clear still. What are the device and vendor ID of the
> > card? Does it have the virtio capabilities?
> > Thanks
> It's have the virtio capabilities. 
> When it is used in bare metal ,
>    it just use PCI_VENDOR_ID_REDHAT_QUMRANET.
> When it use in vm,
>  It is just like :
> { PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
>              VIRTIO_TRANS_ID_NET,
>              PCI_VENDOR_ID_JAGUARMICRO,
>              VIRTIO_ID_NET) },
>     { PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
>              VIRTIO_TRANS_ID_BLOCK,
>              PCI_VENDOR_ID_JAGUARMICRO,
>              VIRTIO_ID_BLOCK) },
> 

Okay. So it's a transitional device. The question, then,
is how come you end up with drivers/virtio/virtio_pci_legacy.c
with a modern linux at all?
Did you by chance set force_legacy = true ?


> > 
> > > >
> > > > > >
> > > > > >
> > > > > > >   And we use this host vdpa+ legacy virtio in vm to hot migration,we
> > > > found
> > > > > > that the
> > > > > > >   Legacy model often get the middle state value after reset and probe
> > > > again.
> > > > > > >   The Soc is Simulated by fpga which is run slower than the host,so the
> > > > same
> > > > > > bug
> > > > > > >   Is found more frequently when the host use the other kernel like
> > > > ubuntu or
> > > > > > centos8.
> > > > > > >
> > > > > > >   So we hope we can fix this by upstream .
> > > > > > > >
> > > > > > > > Thanks
> > > > > > > >
> > > > > > > > >
> > > > > > > > > Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
> > > > > > > > > ---
> > > > > > > > >  drivers/virtio/virtio_pci_legacy.c | 4 +++-
> > > > > > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > > > > >
> > > > > > > > > diff --git a/drivers/virtio/virtio_pci_legacy.c
> > > > > > b/drivers/virtio/virtio_pci_legacy.c
> > > > > > > > > index 2257f1b3d8ae..f2d241563e4f 100644
> > > > > > > > > --- a/drivers/virtio/virtio_pci_legacy.c
> > > > > > > > > +++ b/drivers/virtio/virtio_pci_legacy.c
> > > > > > > > > @@ -14,6 +14,7 @@
> > > > > > > > >   *  Michael S. Tsirkin <mst@redhat.com>
> > > > > > > > >   */
> > > > > > > > >
> > > > > > > > > +#include <linux/delay.h>
> > > > > > > > >  #include "linux/virtio_pci_legacy.h"
> > > > > > > > >  #include "virtio_pci_common.h"
> > > > > > > > >
> > > > > > > > > @@ -97,7 +98,8 @@ static void vp_reset(struct virtio_device
> > *vdev)
> > > > > > > > >         vp_legacy_set_status(&vp_dev->ldev, 0);
> > > > > > > > >         /* Flush out the status write, and flush in device writes,
> > > > > > > > >          * including MSi-X interrupts, if any. */
> > > > > > > > > -       vp_legacy_get_status(&vp_dev->ldev);
> > > > > > > > > +       while (vp_legacy_get_status(&vp_dev->ldev))
> > > > > > > > > +               msleep(1);
> > > > > > > > >         /* Flush pending VQ/configuration callbacks. */
> > > > > > > > >         vp_synchronize_vectors(vdev);
> > > > > > > > >  }
> > > > > > > > > --
> > > > > > > > > 2.25.1
> > > > > > > > >
> > > > > > >
> > > > >
> > >
> 

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2023-04-11 10:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230411013833.1305-1-angus.chen@jaguarmicro.com>
2023-04-11  2:41 ` [PATCH] virtio_pci: Wait for legacy device to be reset Xuan Zhuo
2023-04-11  5:24 ` Jason Wang
     [not found]   ` <TY2PR06MB3424BACFA8B6CB463C12E31E859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11  6:39     ` Jason Wang
2023-04-11  6:44       ` Michael S. Tsirkin
2023-04-11  6:47     ` Michael S. Tsirkin
     [not found]       ` <TY2PR06MB3424E3C222C3B896BB583DFD859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11  6:55         ` Michael S. Tsirkin
     [not found]           ` <TY2PR06MB3424DB10784CA5504A10099E859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11  7:21             ` Michael S. Tsirkin
     [not found]               ` <TY2PR06MB3424DE523E669A3B1910D7F0859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11 10:15                 ` Michael S. Tsirkin [this message]
     [not found]                   ` <TY2PR06MB3424185F07F76D82746B6503859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11 11:13                     ` Michael S. Tsirkin
2023-04-11  6:29 ` Michael S. Tsirkin
     [not found]   ` <TY2PR06MB34242144FB4F944DD866567B859A9@TY2PR06MB3424.apcprd06.prod.outlook.com>
2023-04-11  6:41     ` Michael S. Tsirkin

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=20230411061409-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=angus.chen@jaguarmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).