RE: [PATCH rdma-next 7/7] RDMA/core: Allow detaching gid attribute netdevice for RoCE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Jason Gunthorpe <jgg@xxxxxxxx>
> Sent: Wednesday, April 10, 2019 9:19 AM
> To: Parav Pandit <parav@xxxxxxxxxxxx>
> Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>; Doug Ledford
> <dledford@xxxxxxxxxx>; RDMA mailing list <linux-rdma@xxxxxxxxxxxxxxx>;
> Huy Nguyen <huyn@xxxxxxxxxxxx>; Martin Wilck <mwilck@xxxxxxxx>
> Subject: Re: [PATCH rdma-next 7/7] RDMA/core: Allow detaching gid
> attribute netdevice for RoCE
> 
> On Wed, Apr 10, 2019 at 02:13:03PM +0000, Parav Pandit wrote:
> 
> > > Parav,
> > >
> > > Boot with rcu_dereference produces the following warning.
> > >
> > > [    7.921247] mlx5_core 0000:00:0c.0: firmware version: 3.10.9999
> > > [    7.921730] mlx5_core 0000:00:0c.0: 0.000 Gb/s available PCIe
> bandwidth
> > > (Unknown speed x255 link)
> > > [    8.299897] mlx5_ib: Mellanox Connect-IB Infiniband driver v5.0-0
> > > [    8.307859]
> > > [    8.307989] =============================
> > > [    8.308084] WARNING: suspicious RCU usage
> > > [    8.308193] 5.1.0-rc2+ #278 Not tainted
> > > [    8.308302] -----------------------------
> > > [    8.308446] drivers/infiniband/core/cache.c:302 suspicious
> > > rcu_dereference_check() usage!
> > >
> > > >
> > Yes. So lets do
> >
> > rcu_dereference_protected(attr->ndev, 1);
> >
> > with below updated comment?
> >
> > +	/* rcu_dereference is not needed because GID attr being passed as
> input during
> > +	 *  GID addition cannot change. It is used only to avoid smatch
> complain.
> > +	 */
> 
> Why cannot it change?
> 
Because it is on the stack of the caller:

update_gid_ip()
    update_gid()
        ib_cache_gid_add()
              __ib_cache_gid_add()
                      add_modify_gid()

> You don't need to talk about smatch, the use of rcu_dereference_protected
> is self-explanatory.
> 
> Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux