Re: [PATCH] vhost_vdpa: unset vq irq before freeing irq

From: Jason Wang
Date: Wed Sep 15 2021 - 04:34:51 EST


On Wed, Sep 15, 2021 at 2:39 PM Wu Zongyong
<wuzongyong@xxxxxxxxxxxxxxxxx> wrote:
>
> Currently we unset vq irq after freeing irq and that will result in
> error messages:

Nit: I think for 'we', it actually means the parent driver can free
the irq during reset, set_status(0). vp_vdpa is one example for this.

>
> pi_update_irte: failed to update PI IRTE
> irq bypass consumer (token 000000005a07a12b) unregistration fails: -22
>
> This patch solves this.
>
> Signed-off-by: Wu Zongyong <wuzongyong@xxxxxxxxxxxxxxxxx>

Other than this.

Acked-by: Jason Wang <jasowang@xxxxxxxxxx>

> ---
> drivers/vhost/vdpa.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index f41d081777f5..15bae2290bf9 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -173,6 +173,10 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
> return -EINVAL;
>
> + if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> + for (i = 0; i < nvqs; i++)
> + vhost_vdpa_unsetup_vq_irq(v, i);
> +
> if (status == 0) {
> ret = ops->reset(vdpa);
> if (ret)
> @@ -184,10 +188,6 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_setup_vq_irq(v, i);
>
> - if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> - for (i = 0; i < nvqs; i++)
> - vhost_vdpa_unsetup_vq_irq(v, i);
> -
> return 0;
> }
>
> --
> 2.31.1
>