stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE:  [PATCH] Revert "virtio_pci: Support surprise removal of virtio pci device"
@ 2025-08-22 10:27 Li,Rongqing
  2025-08-22 12:24 ` Parav Pandit
  0 siblings, 1 reply; 38+ messages in thread
From: Li,Rongqing @ 2025-08-22 10:27 UTC (permalink / raw)
  To: Parav Pandit, mst@redhat.com, virtualization@lists.linux.dev,
	jasowang@redhat.com
  Cc: stefanha@redhat.com, pbonzini@redhat.com,
	xuanzhuo@linux.alibaba.com, stable@vger.kernel.org,
	mgurtovoy@nvidia.com

> This reverts commit 43bb40c5b926 ("virtio_pci: Support surprise removal of
> virtio pci device").
> 
> Virtio drivers and PCI devices have never fully supported true surprise (aka hot
> unplug) removal. Drivers historically continued processing and waiting for
> pending I/O and even continued synchronous device reset during surprise
> removal. Devices have also continued completing I/Os, doing DMA and allowing
> device reset after surprise removal to support such drivers.
> 
> Supporting it correctly would require a new device capability and driver
> negotiation in the virtio specification to safely stop I/O and free queue memory.
> Failure to do so either breaks all the existing drivers with call trace listed in the
> commit or crashes the host on continuing the DMA. Hence, until such
> specification and devices are invented, restore the previous behavior of treating
> surprise removal as graceful removal to avoid regressions and maintain system
> stability same as before the commit 43bb40c5b926 ("virtio_pci: Support surprise
> removal of virtio pci device").
> 
> As explained above, previous analysis of solving this only in driver was
> incomplete and non-reliable at [1] and at [2]; Hence reverting commit
> 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device") is still
> the best stand to restore failures of virtio net and block devices.
> 
> [1]
> https://lore.kernel.org/virtualization/CY8PR12MB719506CC5613EB100BC6C638
> DCBD2@CY8PR12MB7195.namprd12.prod.outlook.com/#t
> [2]
> https://lore.kernel.org/virtualization/20250602024358.57114-1-parav@nvidia.c
> om/
> 
> Fixes: 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
> Cc: stable@vger.kernel.org
> Reported-by: lirongqing@baidu.com
> Closes:
> https://lore.kernel.org/virtualization/c45dd68698cd47238c55fb73ca9b4741@b
> aidu.com/
> Signed-off-by: Parav Pandit <parav@nvidia.com>



Tested-by: Li RongQing <lirongqing@baidu.com>

Thanks

-Li


> ---
>  drivers/virtio/virtio_pci_common.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci_common.c
> b/drivers/virtio/virtio_pci_common.c
> index d6d79af44569..dba5eb2eaff9 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -747,13 +747,6 @@ 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.26.2


^ permalink raw reply	[flat|nested] 38+ messages in thread
* [PATCH] Revert "virtio_pci: Support surprise removal of virtio pci device"
@ 2025-08-22  9:17 Parav Pandit
  2025-08-22 10:21 ` Michael S. Tsirkin
  0 siblings, 1 reply; 38+ messages in thread
From: Parav Pandit @ 2025-08-22  9:17 UTC (permalink / raw)
  To: mst, virtualization, jasowang
  Cc: stefanha, pbonzini, xuanzhuo, stable, mgurtovoy, Parav Pandit,
	lirongqing

This reverts commit 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device").

Virtio drivers and PCI devices have never fully supported true
surprise (aka hot unplug) removal. Drivers historically continued
processing and waiting for pending I/O and even continued synchronous
device reset during surprise removal. Devices have also continued
completing I/Os, doing DMA and allowing device reset after surprise
removal to support such drivers.

Supporting it correctly would require a new device capability and
driver negotiation in the virtio specification to safely stop
I/O and free queue memory. Failure to do so either breaks all the
existing drivers with call trace listed in the commit or crashes the
host on continuing the DMA. Hence, until such specification and devices
are invented, restore the previous behavior of treating surprise
removal as graceful removal to avoid regressions and maintain system
stability same as before the
commit 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device").

As explained above, previous analysis of solving this only in driver
was incomplete and non-reliable at [1] and at [2]; Hence reverting commit
43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
is still the best stand to restore failures of virtio net and
block devices.

[1] https://lore.kernel.org/virtualization/CY8PR12MB719506CC5613EB100BC6C638DCBD2@CY8PR12MB7195.namprd12.prod.outlook.com/#t
[2] https://lore.kernel.org/virtualization/20250602024358.57114-1-parav@nvidia.com/

Fixes: 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
Cc: stable@vger.kernel.org
Reported-by: lirongqing@baidu.com
Closes: https://lore.kernel.org/virtualization/c45dd68698cd47238c55fb73ca9b4741@baidu.com/
Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 drivers/virtio/virtio_pci_common.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index d6d79af44569..dba5eb2eaff9 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -747,13 +747,6 @@ 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.26.2


^ permalink raw reply related	[flat|nested] 38+ messages in thread
* [PATCH] Revert "virtio_pci: Support surprise removal of virtio pci device"
@ 2025-04-08 14:59 Parav Pandit
  2025-04-08 20:15 ` Michael S. Tsirkin
  0 siblings, 1 reply; 38+ messages in thread
From: Parav Pandit @ 2025-04-08 14:59 UTC (permalink / raw)
  To: mst, virtualization, jasowang
  Cc: stefanha, pbonzini, xuanzhuo, Parav Pandit, stable, lirongqing,
	Max Gurtovoy

This reverts commit 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device").

The cited commit introduced a fix that marks the device as broken
during surprise removal. However, this approach causes uncompleted
I/O requests on virtio-blk device. The presence of uncompleted I/O
requests prevents the successful removal of virtio-blk devices.

This fix allows devices that simulate a surprise removal but actually
remove gracefully to continue working as before.

For surprise removals, a better solution will be preferred in the future.

Fixes: 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
Cc: stable@vger.kernel.org
Reported-by: lirongqing@baidu.com
Closes: https://lore.kernel.org/virtualization/c45dd68698cd47238c55fb73ca9b4741@baidu.com/
Reviewed-by: Max Gurtovoy<mgurtovoy@nvidia.com>
Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 drivers/virtio/virtio_pci_common.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index d6d79af44569..dba5eb2eaff9 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -747,13 +747,6 @@ 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.26.2


^ permalink raw reply related	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2025-08-28 13:37 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 10:27 [PATCH] Revert "virtio_pci: Support surprise removal of virtio pci device" Li,Rongqing
2025-08-22 12:24 ` Parav Pandit
2025-08-22 13:04   ` Michael S. Tsirkin
2025-08-22 13:53     ` Parav Pandit
2025-08-22 14:02       ` Michael S. Tsirkin
2025-08-24  2:36         ` Parav Pandit
2025-08-24 14:29           ` Michael S. Tsirkin
2025-08-26 18:52             ` Parav Pandit
2025-08-27 10:21               ` Michael S. Tsirkin
2025-08-27 10:49                 ` Michael S. Tsirkin
2025-08-28  6:23                   ` Parav Pandit
2025-08-28  6:34                     ` Michael S. Tsirkin
2025-08-28  6:59                       ` Parav Pandit
2025-08-28  9:23                         ` Michael S. Tsirkin
2025-08-28 10:41                           ` Parav Pandit
  -- strict thread matches above, loose matches on Subject: below --
2025-08-22  9:17 Parav Pandit
2025-08-22 10:21 ` Michael S. Tsirkin
2025-08-22 12:22   ` Parav Pandit
2025-08-22 13:03     ` Michael S. Tsirkin
2025-08-22 13:49       ` Parav Pandit
2025-08-22 13:59         ` Michael S. Tsirkin
2025-08-24  2:36           ` Parav Pandit
2025-08-24 14:33             ` Michael S. Tsirkin
2025-08-26 18:52               ` Parav Pandit
2025-08-27 10:19                 ` Michael S. Tsirkin
2025-08-27 11:33                   ` Cornelia Huck
2025-08-28  6:24                     ` Parav Pandit
2025-08-28 12:16                       ` Cornelia Huck
2025-08-28 12:19                         ` Michael S. Tsirkin
2025-08-28 12:22                           ` Cornelia Huck
2025-08-28 12:33                             ` Parav Pandit
2025-08-28 13:00                               ` Michael S. Tsirkin
2025-08-28 13:37                                 ` Parav Pandit
2025-04-08 14:59 Parav Pandit
2025-04-08 20:15 ` Michael S. Tsirkin
2025-04-09 13:50   ` Parav Pandit
2025-04-09 16:02     ` Michael S. Tsirkin
2025-04-16  3:01       ` Parav Pandit

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).