DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: call destroy_device always in vhost_destroy_device_notify
@ 2021-09-03  7:56 Li Feng
  2021-09-03  8:02 ` [dpdk-dev] [PATCH v2] " Li Feng
  0 siblings, 1 reply; 9+ messages in thread
From: Li Feng @ 2021-09-03  7:56 UTC (permalink / raw)
  To: Maxime Coquelin, Chenbo Xia; +Cc: dev, Li Feng

Vhost-user client must send the mem table, kick fd, call fd on all vas,
then the device will be VIRTIO_DEV_RUNNING.

If the vhost-user communication is initialized partly, e.g.
- When initializing the vhost-user, try to restart the vhost-user
    backend;
- Seabios only initialized the vhost-scsi req vq.
The device is not with flags VIRTIO_DEV_RUNNING..

Root Cause:
The vhost session has been created, and added the scsi/blk requestq
poller into reactor, but when destroying the device, the requestq is not
unregistered.

Reproduce the crash on spdk vhost-user backend:
1. Create a VM;
2. Mount a ISO to a VM, start the VM, don't install the OS;
3. Restart the spdk_tgt;

Another discusstion is in seabiso:
https://patchew.org/Seabios/20210831122339.2591585-1-fengli@smartx.com/

Signed-off-by: Li Feng <fengli@smartx.com>
---
 lib/vhost/vhost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 355ff37651..191ba82c41 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -710,8 +710,8 @@ vhost_destroy_device_notify(struct virtio_net *dev)
 		if (vdpa_dev)
 			vdpa_dev->ops->dev_close(dev->vid);
 		dev->flags &= ~VIRTIO_DEV_RUNNING;
-		dev->notify_ops->destroy_device(dev->vid);
 	}
+	dev->notify_ops->destroy_device(dev->vid);
 }
 
 /*
-- 
2.31.1


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

end of thread, other threads:[~2021-11-05  4:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  7:56 [dpdk-dev] [PATCH] vhost: call destroy_device always in vhost_destroy_device_notify Li Feng
2021-09-03  8:02 ` [dpdk-dev] [PATCH v2] " Li Feng
2021-10-14 12:00   ` Maxime Coquelin
2021-10-14 12:12     ` Li Feng
2021-10-14 12:28       ` Maxime Coquelin
2021-10-14 12:49         ` Li Feng
2021-11-05  3:18           ` Li Feng
2021-11-05  4:21             ` Liu, Changpeng
2021-11-05  4:38               ` Li Feng

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