linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Zongyong <wuzongyong@linux.alibaba.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, tiwei.bie@intel.com,
	wei.yang1@linux.alibaba.com
Subject: Re: [PATCH] vhost_vdpa: unset vq irq before freeing irq
Date: Wed, 15 Sep 2021 15:52:32 +0800	[thread overview]
Message-ID: <20210915075232.GA18977@L-PF27918B-1352.localdomain> (raw)
In-Reply-To: <20210915032510-mutt-send-email-mst@kernel.org>

On Wed, Sep 15, 2021 at 03:26:41AM -0400, Michael S. Tsirkin wrote:
> On Wed, Sep 15, 2021 at 02:39:32PM +0800, Wu Zongyong wrote:
> > Currently we unset vq irq after freeing irq and that will result in
> > error messages:
> > 
> >   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@linux.alibaba.com>
> > ---
> >  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 we do this before reset like this then the device might assert the
> irq, might it not?
> 
This would not be a problem.
AFAIK, vhost_vdpa_unsetup_vq_irq just disables the irq offloading, and the irq
will be handled if there comes an irq.
> >  	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

  reply	other threads:[~2021-09-15  7:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  6:39 [PATCH] vhost_vdpa: unset vq irq before freeing irq Wu Zongyong
2021-09-15  7:26 ` Michael S. Tsirkin
2021-09-15  7:52   ` Wu Zongyong [this message]
2021-09-15 11:07     ` Michael S. Tsirkin
2021-09-15  8:34 ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210915075232.GA18977@L-PF27918B-1352.localdomain \
    --to=wuzongyong@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.yang1@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).