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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200907114351.GC121033@mtl-vdi-166.wap.labs.mlnx>
Date:   Mon, 7 Sep 2020 14:43:51 +0300
From:   Eli Cohen <elic@...dia.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>
CC:     Jason Wang <jasowang@...hat.com>, Cindy Lu <lulu@...hat.com>,
        <virtualization@...ts.linux-foundation.org>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] vdpa/mlx5: Setup driver only if VIRTIO_CONFIG_S_DRIVER_OK

On Mon, Sep 07, 2020 at 07:34:00AM -0400, Michael S. Tsirkin wrote:
> On Mon, Sep 07, 2020 at 10:51:36AM +0300, Eli Cohen wrote:
> > If the memory map changes before the driver status is
> > VIRTIO_CONFIG_S_DRIVER_OK, don't attempt to create resources because it
> > may fail. For example, if the VQ is not ready there is no point in
> > creating resources.
> > 
> > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
> > Signed-off-by: Eli Cohen <elic@...dia.com>
> 
> 
> Could you add a bit more data about the problem to the log?
> To be more exact, what exactly happens right now?
>

Sure I can.

set_map() is used by mlx5 vdpa to create a memory region based on the
address map passed by the iotlb argument. If I get successive calls, I
will destroy the current memory region and build another one based on
the new address mapping. I also need to setup the hardware resources
since they depend on the memory region.

If these calls happen before DRIVER_OK, It means it that driver VQs may
also not been setup and I may not create them yet. In this case I want
to avoid setting up the other resources and defer this till I get DRIVER
OK.

Let me know if that answers your question so I can post another patch.

> > ---
> >  drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > index 9df69d5efe8c..c89cd48a0aab 100644
> > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > @@ -1645,6 +1645,9 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_net *ndev, struct vhost_iotlb *
> >  	if (err)
> >  		goto err_mr;
> >  
> > +	if (!(ndev->mvdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
> > +		return 0;
> > +
> >  	restore_channels_info(ndev);
> >  	err = setup_driver(ndev);
> >  	if (err)
> > -- 
> > 2.26.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ