Re: [PATCH rdma-next 2/6] RDMA/mlx5: Use restrack allocation PD scheme

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

 



On Mon, Jan 21, 2019 at 02:23:46AM +0000, Jason Gunthorpe wrote:
> On Sat, Jan 19, 2019 at 10:00:25AM +0200, Leon Romanovsky wrote:
> > On Fri, Jan 18, 2019 at 09:59:31PM +0000, Jason Gunthorpe wrote:
> > > On Thu, Jan 17, 2019 at 08:04:45PM +0200, Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > > >
> > > > Adapt mlx5 to share restrack ID instead of local variable.
> > > >
> > > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > > >  drivers/infiniband/hw/mlx5/main.c    | 22 +++++++++++++++-------
> > > >  drivers/infiniband/hw/mlx5/mlx5_ib.h |  1 -
> > > >  drivers/infiniband/hw/mlx5/mr.c      | 16 ++++++++--------
> > > >  drivers/infiniband/hw/mlx5/qp.c      | 22 +++++++++++++---------
> > > >  drivers/infiniband/hw/mlx5/srq.c     |  2 +-
> > > >  5 files changed, 37 insertions(+), 26 deletions(-)
> > > >
> > > > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > > > index b32b5c7f1cfd..9db041465266 100644
> > > > +++ b/drivers/infiniband/hw/mlx5/main.c
> > > > @@ -2262,11 +2262,14 @@ static struct ib_pd *mlx5_ib_alloc_pd(struct ib_device *ibdev,
> > > >  	u32 out[MLX5_ST_SZ_DW(alloc_pd_out)] = {};
> > > >  	u32 in[MLX5_ST_SZ_DW(alloc_pd_in)]   = {};
> > > >  	u16 uid = 0;
> > > > +	u32 pdn;
> > > >
> > > >  	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
> > > >  	if (!pd)
> > > >  		return ERR_PTR(-ENOMEM);
> > > >
> > > > +	pd->ibpd.device = ibdev;
> > >
> > > This needs to be re-ordered now? Don't like..
> >
> > I need "device" to know where to store restrack objects.
> > Because we don't have "priv" for those ib_* objects, we can't
> > preallocate them before drivers (we don't know the allocation
> > size). What about if we introduce new functions in IB/core for
> > all objects to allocate structure and set device?
>
> I would prefer if the core could still do the restrack_add just using
> the device provided ID number.. Is that not possible? I didn't look
> closely yet

I don't see easy solution for that.

>
> > Something like this:
> > void *alloc_object(struct ib_device *dev, size_t s, uint64_t offset_to_device_pointer_in_driver)
> > {
> > 	void *a;
> >
> > 	a = kzalloc(s, GFP_KERNEL);
> > 	if (!a)
> > 		return ERR_PTR(-ENOMEM);
> > 	*(a + offset_to_device_pointer_in_driver) = dev;
> > 	return a;
> > }
>
> Yuk, if we are messing with this we should include the allocation
> sizes in the ops structure and have the core provide an allocated
> pointer. Would remove lots of driver code, but is a huge amount of
> work..

Converting all drivers to use rdma_restrack_add is not school trip either.

Thanks

>
> Jason

Attachment: signature.asc
Description: PGP signature


[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