linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost-vdpa: clean irqs before reseting vdpa device
@ 2021-11-15  3:16 Wu Zongyong
  2021-11-15  4:08 ` Jason Wang
  2021-11-15 10:56 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Wu Zongyong @ 2021-11-15  3:16 UTC (permalink / raw)
  To: jasowang, virtualization, linux-kernel, mst, wuzongyong; +Cc: wei.yang1

Vdpa devices should be reset after unseting irqs of virtqueues, or we
will get errors when killing qemu process:

>> pi_update_irte: failed to update PI IRTE
>> irq bypass consumer (token 0000000065102a43) unregistration fails: -22

Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 01c59ce7e250..29cced1cd277 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1014,12 +1014,12 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep)
 
 	mutex_lock(&d->mutex);
 	filep->private_data = NULL;
+	vhost_vdpa_clean_irq(v);
 	vhost_vdpa_reset(v);
 	vhost_dev_stop(&v->vdev);
 	vhost_vdpa_iotlb_free(v);
 	vhost_vdpa_free_domain(v);
 	vhost_vdpa_config_put(v);
-	vhost_vdpa_clean_irq(v);
 	vhost_dev_cleanup(&v->vdev);
 	kfree(v->vdev.vqs);
 	mutex_unlock(&d->mutex);
-- 
2.31.1


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

* Re: [PATCH] vhost-vdpa: clean irqs before reseting vdpa device
  2021-11-15  3:16 [PATCH] vhost-vdpa: clean irqs before reseting vdpa device Wu Zongyong
@ 2021-11-15  4:08 ` Jason Wang
  2021-11-15 10:56 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2021-11-15  4:08 UTC (permalink / raw)
  To: Wu Zongyong; +Cc: virtualization, linux-kernel, mst, wei.yang1

On Mon, Nov 15, 2021 at 11:17 AM Wu Zongyong
<wuzongyong@linux.alibaba.com> wrote:
>
> Vdpa devices should be reset after unseting irqs of virtqueues, or we
> will get errors when killing qemu process:
>
> >> pi_update_irte: failed to update PI IRTE
> >> irq bypass consumer (token 0000000065102a43) unregistration fails: -22
>
> Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/vhost/vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 01c59ce7e250..29cced1cd277 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -1014,12 +1014,12 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep)
>
>         mutex_lock(&d->mutex);
>         filep->private_data = NULL;
> +       vhost_vdpa_clean_irq(v);
>         vhost_vdpa_reset(v);
>         vhost_dev_stop(&v->vdev);
>         vhost_vdpa_iotlb_free(v);
>         vhost_vdpa_free_domain(v);
>         vhost_vdpa_config_put(v);
> -       vhost_vdpa_clean_irq(v);
>         vhost_dev_cleanup(&v->vdev);
>         kfree(v->vdev.vqs);
>         mutex_unlock(&d->mutex);
> --
> 2.31.1
>


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

* Re: [PATCH] vhost-vdpa: clean irqs before reseting vdpa device
  2021-11-15  3:16 [PATCH] vhost-vdpa: clean irqs before reseting vdpa device Wu Zongyong
  2021-11-15  4:08 ` Jason Wang
@ 2021-11-15 10:56 ` Michael S. Tsirkin
  2021-11-16 13:29   ` Wu Zongyong
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2021-11-15 10:56 UTC (permalink / raw)
  To: Wu Zongyong; +Cc: jasowang, virtualization, linux-kernel, wei.yang1

On Mon, Nov 15, 2021 at 11:16:42AM +0800, Wu Zongyong wrote:
> Vdpa devices should be reset after unseting irqs of virtqueues, or we
> will get errors when killing qemu process:
> 
> >> pi_update_irte: failed to update PI IRTE
> >> irq bypass consumer (token 0000000065102a43) unregistration fails: -22
> 
> Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>


A Fixes flag might be appropriate here.  2cf1ba9a4d15c ?

Also, remind me of commit 97f854be203883b61d24f230445bd533bbdf770c
vhost_vdpa: unset vq irq before freeing irq - what's the difference
in scenarios?


> ---
>  drivers/vhost/vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 01c59ce7e250..29cced1cd277 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -1014,12 +1014,12 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep)
>  
>  	mutex_lock(&d->mutex);
>  	filep->private_data = NULL;
> +	vhost_vdpa_clean_irq(v);
>  	vhost_vdpa_reset(v);
>  	vhost_dev_stop(&v->vdev);
>  	vhost_vdpa_iotlb_free(v);
>  	vhost_vdpa_free_domain(v);
>  	vhost_vdpa_config_put(v);
> -	vhost_vdpa_clean_irq(v);
>  	vhost_dev_cleanup(&v->vdev);
>  	kfree(v->vdev.vqs);
>  	mutex_unlock(&d->mutex);
> -- 
> 2.31.1


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

* Re: [PATCH] vhost-vdpa: clean irqs before reseting vdpa device
  2021-11-15 10:56 ` Michael S. Tsirkin
@ 2021-11-16 13:29   ` Wu Zongyong
  0 siblings, 0 replies; 4+ messages in thread
From: Wu Zongyong @ 2021-11-16 13:29 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: jasowang, virtualization, linux-kernel, wei.yang1

On Mon, Nov 15, 2021 at 05:56:17AM -0500, Michael S. Tsirkin wrote:
> On Mon, Nov 15, 2021 at 11:16:42AM +0800, Wu Zongyong wrote:
> > Vdpa devices should be reset after unseting irqs of virtqueues, or we
> > will get errors when killing qemu process:
> > 
> > >> pi_update_irte: failed to update PI IRTE
> > >> irq bypass consumer (token 0000000065102a43) unregistration fails: -22
> > 
> > Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
> 
> 
> A Fixes flag might be appropriate here.  2cf1ba9a4d15c ?

Yes.

> 
> Also, remind me of commit 97f854be203883b61d24f230445bd533bbdf770c
> vhost_vdpa: unset vq irq before freeing irq - what's the difference
> in scenarios?

The issue fixed by the two patches is the same actually.
The commit you mentioned above takes effect when users unset the status
bit VIRTIO_CONFIG_S_DRIVER_OK. And this patch takes effect when the file
descriptor of vhost vdpa device is closed without unseting the status
bit VIRTIO_CONFIG_S_DRIVER_OK, for example, we send SIGKILL to qemu
process.
> 
> 
> > ---
> >  drivers/vhost/vdpa.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> > index 01c59ce7e250..29cced1cd277 100644
> > --- a/drivers/vhost/vdpa.c
> > +++ b/drivers/vhost/vdpa.c
> > @@ -1014,12 +1014,12 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep)
> >  
> >  	mutex_lock(&d->mutex);
> >  	filep->private_data = NULL;
> > +	vhost_vdpa_clean_irq(v);
> >  	vhost_vdpa_reset(v);
> >  	vhost_dev_stop(&v->vdev);
> >  	vhost_vdpa_iotlb_free(v);
> >  	vhost_vdpa_free_domain(v);
> >  	vhost_vdpa_config_put(v);
> > -	vhost_vdpa_clean_irq(v);
> >  	vhost_dev_cleanup(&v->vdev);
> >  	kfree(v->vdev.vqs);
> >  	mutex_unlock(&d->mutex);
> > -- 
> > 2.31.1

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

end of thread, other threads:[~2021-11-16 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  3:16 [PATCH] vhost-vdpa: clean irqs before reseting vdpa device Wu Zongyong
2021-11-15  4:08 ` Jason Wang
2021-11-15 10:56 ` Michael S. Tsirkin
2021-11-16 13:29   ` Wu Zongyong

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