From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
linux-rdma@vger.kernel.org,
Selvin Xavier <selvin.xavier@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
patches@lists.linux.dev
Subject: Re: [PATCH v2 02/13] RDMA/core: Add rdma_udata_to_dev()
Date: Mon, 2 Mar 2026 15:36:29 -0400 [thread overview]
Message-ID: <20260302193629.GY5933@nvidia.com> (raw)
In-Reply-To: <20260302193056.GT12611@unreal>
On Mon, Mar 02, 2026 at 09:30:56PM +0200, Leon Romanovsky wrote:
> > +struct ib_device *rdma_udata_to_dev(struct ib_udata *udata)
> > +{
> > + struct uverbs_attr_bundle *bundle =
> > + rdma_udata_to_uverbs_attr_bundle(udata);
> > +
> > + lockdep_assert_held(&bundle->ufile->device->disassociate_srcu);
> > +
> > + if (bundle->context)
> > + return bundle->context->device;
> > +
> > + /*
> > + * If the context hasn't been created yet use the ufile's dev, but it
> > + * might be NULL if we are racing with disassociate.
> > + */
> > + return srcu_dereference(bundle->ufile->device->ib_dev,
> > + &bundle->ufile->device->disassociate_srcu);
> > +}
> > +EXPORT_SYMBOL(rdma_udata_to_dev);
>
> Thanks for this function, looks great, however I wonder about use of it
> in debug prints. What about changing:
>
> + ibdev_dbg(
> + rdma_udata_to_dev(udata),
> ...
>
> to be something
> + udata_dbg(
> + udata,
> ....
>
> Together with keeping this rdma_udata_to_dev() function.
I thought about that, and looked at it, but the entire flow to build
the dbg prints goes through alot of common infrastructure and it
rapidly became a big pain to put the udata through like that.
All drivers should be able to get the dev from their own information
so shouldn't be using the udata version at all.
Thus I'd prefer this since it probably won't be more than these couple
callers from the core code.
Arguably discouraging drivers from using it is a positive.
Jason
next prev parent reply other threads:[~2026-03-02 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 1:11 [PATCH v2 00/13] Provide udata helpers and use them in bnxt_re Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 01/13] RDMA: Use copy_struct_from_user() instead of open coding Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 02/13] RDMA/core: Add rdma_udata_to_dev() Jason Gunthorpe
2026-03-02 19:30 ` Leon Romanovsky
2026-03-02 19:36 ` Jason Gunthorpe [this message]
2026-02-27 1:11 ` [PATCH v2 03/13] RDMA: Add ib_copy_validate_udata_in() Jason Gunthorpe
2026-02-27 7:50 ` kernel test robot
2026-02-28 10:24 ` kernel test robot
2026-02-27 1:11 ` [PATCH v2 04/13] RDMA: Add ib_copy_validate_udata_in_cm() Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 05/13] RDMA: Add ib_respond_udata() Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 06/13] RDMA: Add ib_is_udata_in_empty() Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 07/13] RDMA: Provide documentation about the uABI compatibility rules Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 08/13] RDMA/bnxt_re: Add compatibility checks to the uapi path Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 09/13] RDMA/bnxt_re: Add compatibility checks to the uapi path for no data Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 10/13] RDMA/bnxt_re: Add missing comp_mask validation Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 11/13] RDMA/bnxt_re: Use ib_respond_udata() Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 12/13] RDMA/bnxt_re: Use ib_respond_empty_udata() Jason Gunthorpe
2026-02-27 1:11 ` [PATCH v2 13/13] RDMA/bnxt_re: Add BNXT_RE_UCNTX_CMASK_UAPI_COMPAT_SUPPORTED Jason Gunthorpe
2026-03-02 19:24 ` [PATCH v2 00/13] Provide udata helpers and use them in bnxt_re Leon Romanovsky
2026-03-02 19:33 ` Jason Gunthorpe
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=20260302193629.GY5933@nvidia.com \
--to=jgg@nvidia.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=selvin.xavier@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox