? 2022/1/22 ??4:27, Eugenio P?rez ??:> @@ -272,6 +590,28 @@ void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue
*svq, int svq_kick_fd)
> void vhost_svq_stop(VhostShadowVirtqueue *svq)
> {
> event_notifier_set_handler(&svq->svq_kick, NULL);
> + g_autofree VirtQueueElement *next_avail_elem = NULL;
> +
> + if (!svq->vq) {
> + return;
> + }
> +
> + /* Send all pending used descriptors to guest */
> + vhost_svq_flush(svq, false);
Do we need to wait for all the pending descriptors to be completed here?
Thanks
> +
> + for (unsigned i = 0; i < svq->vring.num; ++i) {
> + g_autofree VirtQueueElement *elem = NULL;
> + elem = g_steal_pointer(&svq->ring_id_maps[i]);
> + if (elem) {
> + virtqueue_detach_element(svq->vq, elem, elem->len);
> + }
> + }
> +
> + next_avail_elem = g_steal_pointer(&svq->next_guest_avail_elem);
> + if (next_avail_elem) {
> + virtqueue_detach_element(svq->vq, next_avail_elem,
> + next_avail_elem->len);
> + }
> }