Message ID | 20181007072308.10936-3-shamir.rabinovitch@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | figure uverbs/kernel ib_pd w/o using ib_pd uobject | expand |
On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote: > This function can replace the need for tests based on 'pd->uobject' > in the IB core code and will be used in next patches. > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> > include/rdma/ib_verbs.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > index 9897d2329f2c..136f2ffc4b0b 100644 > +++ b/include/rdma/ib_verbs.h > @@ -1550,6 +1550,11 @@ struct ib_pd { > struct rdma_restrack_entry res; > }; > > +static inline bool rdma_is_user_pd(struct ib_pd *pd) > +{ > + return !rdma_is_kernel_res(&pd->res); > +} Shouldn't this just be pd->res.user? Why are are we using two different ways to track user or not? Jason
On Sun, Oct 07, 2018 at 01:19:49PM -0600, Jason Gunthorpe wrote: > On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote: > > This function can replace the need for tests based on 'pd->uobject' > > in the IB core code and will be used in next patches. > > > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> > > include/rdma/ib_verbs.h | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > > index 9897d2329f2c..136f2ffc4b0b 100644 > > +++ b/include/rdma/ib_verbs.h > > @@ -1550,6 +1550,11 @@ struct ib_pd { > > struct rdma_restrack_entry res; > > }; > > > > +static inline bool rdma_is_user_pd(struct ib_pd *pd) > > +{ > > + return !rdma_is_kernel_res(&pd->res); > > +} > > Shouldn't this just be pd->res.user? > > Why are are we using two different ways to track user or not? > > Jason I'd rather not know the internal structure to resource tracker objects and use the API as Leon suggested in another email. Thanks
On Mon, Oct 08, 2018 at 10:43:26AM +0300, Shamir Rabinovitch wrote: > On Sun, Oct 07, 2018 at 01:19:49PM -0600, Jason Gunthorpe wrote: > > On Sun, Oct 07, 2018 at 10:23:07AM +0300, Shamir Rabinovitch wrote: > > > This function can replace the need for tests based on 'pd->uobject' > > > in the IB core code and will be used in next patches. > > > > > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> > > > include/rdma/ib_verbs.h | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > > > index 9897d2329f2c..136f2ffc4b0b 100644 > > > +++ b/include/rdma/ib_verbs.h > > > @@ -1550,6 +1550,11 @@ struct ib_pd { > > > struct rdma_restrack_entry res; > > > }; > > > > > > +static inline bool rdma_is_user_pd(struct ib_pd *pd) > > > +{ > > > + return !rdma_is_kernel_res(&pd->res); > > > +} > > > > Shouldn't this just be pd->res.user? > > > > Why are are we using two different ways to track user or not? > > > > Jason > > I'd rather not know the internal structure to resource tracker objects > and use the API as Leon suggested in another email. Either don't add res.user or change rdma_is_kernel_res() to use it. Don't have two different tests for user-ness Jason
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 9897d2329f2c..136f2ffc4b0b 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1550,6 +1550,11 @@ struct ib_pd { struct rdma_restrack_entry res; }; +static inline bool rdma_is_user_pd(struct ib_pd *pd) +{ + return !rdma_is_kernel_res(&pd->res); +} + struct ib_xrcd { struct ib_device *device; atomic_t usecnt; /* count all exposed resources */
This function can replace the need for tests based on 'pd->uobject' in the IB core code and will be used in next patches. Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> --- include/rdma/ib_verbs.h | 5 +++++ 1 file changed, 5 insertions(+)