Skip to contentSkip to conversation

virtio_vdpa: Support surprise removal of virtio vdpa device

PATCH In review dongsheng li 2 participants 2 messages Jan 11, 2022 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 virtio_vdpa: Support surprise removal of virtio vdpa device

When virtio vdpa device removed, the abnormal damage of the device cannot be perceived normally, which will cause problems similar to:

Commit 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
Hence, add the ability to abort the command on surprise removal

---
 drivers/virtio/virtio_vdpa.c | 1 +
 1 file changed, 1 insertion(+)
drivers/virtio/virtio_vdpa.c +1 -0
index f85f860bc10b..a5cebad09320 100644
@@ -396,6 +396,7 @@ static void virtio_vdpa_remove(struct vdpa_device *vdpa)
 {
 	struct virtio_vdpa_device *vd_dev = vdpa_get_drvdata(vdpa);
 
+	virtio_break_device(&vd_dev->vdev);
 	unregister_virtio_device(&vd_dev->vdev);
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · dongsheng li

When virtio vdpa device removed, the abnormal damage of the device cannot be perceived normally, which will cause problems similar to:

Commit 43bb40c5b926 ("virtio_pci: Support surprise removal of virtio pci device")
Hence, add the ability to abort the command on surprise removal

If you don't mkae changes you can carry forward acks.

drivers/virtio/virtio_vdpa.c static void virtio_vdpa_remove(struct vdpa_device *vdpa) · line 399

Quoted 13 lines
---
 drivers/virtio/virtio_vdpa.c | 1 +
 1 file changed, 1 insertion(+)
drivers/virtio/virtio_vdpa.c +1 -0
index f85f860bc10b..a5cebad09320 100644
@@ -396,6 +396,7 @@ static void virtio_vdpa_remove(struct vdpa_device *vdpa)
 {
 	struct virtio_vdpa_device *vd_dev = vdpa_get_drvdata(vdpa);
 
+	virtio_break_device(&vd_dev->vdev);

My comment on graceful removal stands. E.g. a storage device will want to flush out writes if possible not drop them.

Quoted 5 lines
drivers/virtio/virtio_vdpa.c +0 -0
 	unregister_virtio_device(&vd_dev->vdev);
 }
 
Signature · 1 line
2.17.1