All of lore.kernel.org
 help / color / mirror / Atom feed
From: Parav Pandit via Virtualization <virtualization@lists.linux-foundation.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: RE: [PATCH 4/4] virtio_pci: Support surprise removal of virtio pci device
Date: Mon, 19 Jul 2021 05:44:49 +0000	[thread overview]
Message-ID: <PH0PR12MB54813A3CA2397ACE87A1DAF6DCE19@PH0PR12MB5481.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20210717164152-mutt-send-email-mst@kernel.org>



> From: Michael S. Tsirkin <mst@redhat.com>
> Sent: Sunday, July 18, 2021 2:17 AM
> 
> On Sat, Jul 17, 2021 at 10:42:58AM +0300, Parav Pandit wrote:
> > When a virtio pci device undergo surprise removal (aka async removaln
> > in
> 
> typo
Fixing it. Checkpatch.pl and codespell, both didn't catch it. 😊

> 
> OK that's nice, but I suspect this is not enough.
> For example we need to also fix up all config space reads to handle all-ones
> patterns specially.
> 
> E.g.
> 
>         /* After writing 0 to device_status, the driver MUST wait for a read of
>          * device_status to return 0 before reinitializing the device.
>          * This will flush out the status write, and flush in device writes,
>          * including MSI-X interrupts, if any.
>          */
>         while (vp_modern_get_status(mdev))
>                 msleep(1);
> 
> lots of code in drivers needs to be fixed too.
Above one particularly known to us in the hot plug area.
Above fix is needed to close the race of hot plug and unplug happening in parallel, which is occurring today, but less common.
It is in my todo list to fix it.
Will take care of it in near future in other series.

> 
> I guess we need to annotate drivers somehow to mark up whether they
> support surprise removal? And maybe find a way to let host know?
What is the benefit of it? Who can make use of that information?

In virtio pci case, it is similar improvement to what nvme pci driver went through few years back to support hot plug/unplug.
Lets complete this of fixes to make it little more robust like nvme.

> 
> 
> 
> > ---
> >  drivers/virtio/virtio_pci_common.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/virtio/virtio_pci_common.c
> > b/drivers/virtio/virtio_pci_common.c
> > index 222d630c41fc..b35bb2d57f62 100644
> > --- a/drivers/virtio/virtio_pci_common.c
> > +++ b/drivers/virtio/virtio_pci_common.c
> > @@ -576,6 +576,13 @@ static void virtio_pci_remove(struct pci_dev
> *pci_dev)
> >  	struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
> >  	struct device *dev = get_device(&vp_dev->vdev.dev);
> >
> > +	/*
> > +	 * Device is marked broken on surprise removal so that virtio upper
> > +	 * layers can abort any ongoing operation.
> > +	 */
> > +	if (!pci_device_is_present(pci_dev))
> > +		virtio_break_device(&vp_dev->vdev);
> > +
> >  	pci_disable_sriov(pci_dev);
> >
> >  	unregister_virtio_device(&vp_dev->vdev);
> > --
> > 2.27.0

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

  reply	other threads:[~2021-07-19  5:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17  7:42 [PATCH 0/4] virtio short improvements Parav Pandit via Virtualization
2021-07-17  7:42 ` [PATCH 1/4] virtio: Improve vq->broken access to avoid any compiler optimization Parav Pandit via Virtualization
2021-07-17 20:38   ` Michael S. Tsirkin
2021-07-19  5:26     ` Parav Pandit via Virtualization
2021-07-19 12:04       ` Michael S. Tsirkin
2021-07-19 14:20         ` Parav Pandit via Virtualization
2021-07-17  7:42 ` [PATCH 2/4] virtio: Keep vring_del_virtqueue() mirror of VQ create Parav Pandit via Virtualization
2021-07-17  7:42 ` [PATCH 3/4] virtio: Protect vqs list access Parav Pandit via Virtualization
2021-07-17 20:41   ` Michael S. Tsirkin
2021-07-19  5:37     ` Parav Pandit via Virtualization
2021-07-17  7:42 ` [PATCH 4/4] virtio_pci: Support surprise removal of virtio pci device Parav Pandit via Virtualization
2021-07-17 20:46   ` Michael S. Tsirkin
2021-07-19  5:44     ` Parav Pandit via Virtualization [this message]
2021-07-19 12:07       ` Michael S. Tsirkin
2021-07-19 14:15         ` Parav Pandit via Virtualization
2021-07-19  9:40     ` Cornelia Huck

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=PH0PR12MB54813A3CA2397ACE87A1DAF6DCE19@PH0PR12MB5481.namprd12.prod.outlook.com \
    --to=virtualization@lists.linux-foundation.org \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    /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.