Subject: Re: [PATCH rdma-next 2/5] RDMA/core: Don't depend device ODP capabilities on kconfig option

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 20 Dec 2018 23:22:53 +0000

On Thu, Dec 20, 2018 at 07:50:20PM +0200, Leon Romanovsky wrote:
> > > > > -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
> > > > >  	if (MLX5_CAP_GEN(mdev, pg))
> > > > >  		props->device_cap_flags |= IB_DEVICE_ON_DEMAND_PAGING;
> > > > >  	props->odp_caps = dev->odp_caps;
> > > > > -#endif
> > > >
> > > > But shouldn't this be protected? If the driver has compiled out ODP it
> > > > shouldn't set the cap flag...
> > >
> > > I see those capabilities as device properties and not as kernel ones.
> > >
> > > Current situation looks bad for me, when I have same device which
> > > reports differently information depends on some compilation flag.
> >
> > It is not device capabilities, it is a kernel API capability if the
> > API is not available the bit should not be set.
> 
> Is it better? Should I resend the series?

Hrm.. I think I'm inclined to keep the the if() in the same place as
the ifdefs. We can revise it later.

I noticed other busted up stuff:
 - IB_DEVICE_ON_DEMAND_PAGING is apparently UAPI but not in a uapi
   header (grr)
 - ucontext shouldn't have a driver callback, that should be moved to
   ops (ie to mlx5_ib_dev_odp_ops)
 - IB_DEVICE_ON_DEMAND_PAGING should be set in core code based
   on ops.invalidate_range being present, drivers shouldn't set it..

Jason