lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 15 Sep 2021 07:07:20 -0400
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Wu Zongyong <wuzongyong@...ux.alibaba.com>
Cc:     jasowang@...hat.com, virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, tiwei.bie@...el.com,
        wei.yang1@...ux.alibaba.com
Subject: Re: [PATCH] vhost_vdpa: unset vq irq before freeing irq

On Wed, Sep 15, 2021 at 03:52:32PM +0800, Wu Zongyong wrote:
> 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@...ux.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.

Oh, right. ACK.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ