Acked-by: Raphael Norwitz <[email protected]>

On Wed, Aug 13, 2025 at 12:54 PM Vladimir Sementsov-Ogievskiy
<[email protected]> wrote:
>
> No reason to rollback setting up busyloop timeout on failure.
> We don't do such rollback for other things we setup in backend.
> Also, look at vhost_net_init() in hw/net/vhost_net.c: we may fail
> after successfully called vhost_dev_init(), and in this case we'll
> just call vhost_dev_cleanup(), which doesn't rollback busyloop
> timeout.
>
> So, let's keep it simple.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
> ---
>  hw/virtio/vhost.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index f6ee59425f..a3620c82d8 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1602,7 +1602,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
>                                                       busyloop_timeout);
>              if (r < 0) {
>                  error_setg_errno(errp, -r, "Failed to set busyloop timeout");
> -                goto fail_busyloop;
> +                goto fail;
>              }
>          }
>      }
> @@ -1642,7 +1642,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
>      if (hdev->migration_blocker != NULL) {
>          r = migrate_add_blocker_normal(&hdev->migration_blocker, errp);
>          if (r < 0) {
> -            goto fail_busyloop;
> +            goto fail;
>          }
>      }
>
> @@ -1674,17 +1674,11 @@ int vhost_dev_init(struct vhost_dev *hdev, void 
> *opaque,
>                     " than current number of used (%d) and reserved (%d)"
>                     " memory slots for memory devices.", limit, used, 
> reserved);
>          r = -EINVAL;
> -        goto fail_busyloop;
> +        goto fail;
>      }
>
>      return 0;
>
> -fail_busyloop:
> -    if (busyloop_timeout) {
> -        while (--i >= 0) {
> -            vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i, 
> 0);
> -        }
> -    }
>  fail:
>      hdev->nvqs = n_initialized_vqs;
>      vhost_dev_cleanup(hdev);
> --
> 2.48.1
>
>

Reply via email to