From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Cc: jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 rdma-rc] RDMA/restrack: don't use uaccess_kernel()
Date: Fri, 16 Feb 2018 19:35:03 +0200 [thread overview]
Message-ID: <20180216173502.GS2197@mtr-leonro.local> (raw)
In-Reply-To: <20180216165919.997D72BB6D-ff04S8wfc4plDsoTORJclLwze2ij/50Q0E9HWUfgJXw@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]
On Wed, Feb 14, 2018 at 06:43:36PM -0800, Steve Wise wrote:
> uaccess_kernel() isn't sufficient to determine if an rdma resource is
> user-mode or not. For example, resources allocated in the add_one()
> function of an ib_client get falsely labeled as user mode, when they
> are kernel mode allocations. EG: mad qps.
>
> The result is that these qps are skipped over during a nldev query
> because of an erroneous namespace mismatch.
>
> So now we determine if the resource is user-mode by looking at the object
> struct's uobject or similar pointer to know if it was allocated for user
> mode applications.
>
> Fixes: 02d8883f520e ("RDMA/restrack: Add general infrastructure to track RDMA resources")
> Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
>
> ---
>
> Changes since v1:
>
> changed _create_qp() to take the qp ib_uobject ptr so it is availble to
> rdma_restrack_add()
>
> ---
> drivers/infiniband/core/core_priv.h | 4 +++-
> drivers/infiniband/core/restrack.c | 35 +++++++++++++++++++++++++++++++++--
> drivers/infiniband/core/uverbs_cmd.c | 4 ++--
> drivers/infiniband/core/verbs.c | 3 +--
> 4 files changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
> index c4560d8..39b8332 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -305,7 +305,8 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map,
> static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
> struct ib_pd *pd,
> struct ib_qp_init_attr *attr,
> - struct ib_udata *udata)
> + struct ib_udata *udata,
> + struct ib_uobject *uobj)
I'm fine with this solution either, but believe that v1 was cleaner way
to address this issue, because udata tells us already that we are
creating user/kernel QP and QP has already PD associated with it.
Also I tried to move to _ib_create_qp() as less as possible initialization
logic.
Thanks,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2018-02-16 17:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 2:43 [PATCH v2 rdma-rc] RDMA/restrack: don't use uaccess_kernel() Steve Wise
[not found] ` <20180216165919.997D72BB6D-ff04S8wfc4plDsoTORJclLwze2ij/50Q0E9HWUfgJXw@public.gmane.org>
2018-02-16 17:25 ` Jason Gunthorpe
[not found] ` <20180216172537.GA10123-uk2M96/98Pc@public.gmane.org>
2018-02-16 19:23 ` Steve Wise
2018-02-16 20:00 ` Jason Gunthorpe
2018-02-16 17:35 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180216173502.GS2197@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.