From: Jason Gunthorpe <jgg@ziepe.ca>
To: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
andrew.gospodarek@broadcom.com, selvin.xavier@broadcom.com,
kalesh-anakkur.purayil@broadcom.com
Subject: Re: [PATCH rdma-next v2 4/4] RDMA/bnxt_re: Direct Verbs: Support CQ and QP verbs
Date: Mon, 17 Nov 2025 13:33:52 -0400 [thread overview]
Message-ID: <20251117173352.GC17968@ziepe.ca> (raw)
In-Reply-To: <20251104072320.210596-5-sriharsha.basavapatna@broadcom.com>
On Tue, Nov 04, 2025 at 12:53:20PM +0530, Sriharsha Basavapatna wrote:
> The following Direct Verb (DV) methods have been implemented in
> this patch.
>
> CQ Direct Verbs:
> ----------------
> - BNXT_RE_METHOD_DV_CREATE_CQ:
> Create a CQ of requested size (cqe). The application must have
> already registered this memory with the driver using DV_UMEM_REG.
> The CQ umem-handle and umem-offset are passed to the driver. The
> driver now maps/pins the CQ user memory and registers it with the
> hardware. The driver returns a CQ-handle to the application.
>
> - BNXT_RE_METHOD_DV_DESTROY_CQ:
> Destroy the DV_CQ specified by the CQ-handle; unmap the user memory.
>
> QP Direct Verbs:
> ----------------
> - BNXT_RE_METHOD_DV_CREATE_QP:
> Create a QP using specified params (struct bnxt_re_dv_create_qp_req).
> The application must have already registered SQ/RQ memory with the
> driver using DV_UMEM_REG. The SQ/RQ umem-handle and umem-offset are
> passed to the driver. The driver now maps/pins the SQ/RQ user memory
> and registers it with the hardware. The driver returns a QP-handle to
> the application.
>
> - BNXT_RE_METHOD_DV_DESTROY_QP:
> Destroy the DV_QP specified by the QP-handle; unmap SQ/RQ user memory.
>
> - BNXT_RE_METHOD_DV_MODIFY_QP:
> Modify QP attributes for the DV_QP specified by the QP-handle;
> wrapper functions have been implemented to resolve dmac/smac using
> rdma_resolve_ip().
>
> - BNXT_RE_METHOD_DV_QUERY_QP:
> Return QP attributes for the DV_QP specified by the QP-handle.
I think this is generally not how things should work..
If you want to create enhanced QP/CQ objects then you should use the
existing create QP/CQ ioctls and enhance them with a driver specific
uverb spec, not special ioctls like this.
Certainly new stuff should be broadly avoiding the 'struct
bnxt_re_dv_create_qp_req' kind of design pattern in favour of the new
ioctl system's finer grained specs.
If you want to just create some kind of object by raw FW call then you
need something like mlx5's devx to push raw FW calls (eg create QP)
and wire them up securely.
> Some applications might want to allocate memory for all resources of a
> given type (CQ/QP) in one big chunk and then register that entire memory
> once using DV_UMEM_REG. At the time of creating each individual
> resource, the application would pass a specific offset/length in the
> umem registered memory.
>
> - The DV_UMEM_REG handler (previous patch) only creates a dv_umem object
> and saves user memory parameters, but doesn't really map/pin this
> memory.
That doesn't sound sensible, what is the point of that?
The umem in mlx5 is all about pinning the memory and sending to the
firwmare immediately. If you are not doing that, then you shouldn't
havea "umem" type object at all.
There is no reason, indeed it is a pretty bad idea, to have the kernel
hold onto some userspace pointer and NOT pin it within the same system
call.
> - The mapping would be done at the time of creating individual objects.
> - This actual mapping of specific umem offsets is implemented by the
> function bnxt_re_dv_umem_get(). This function validates the
> umem-offset and size parameters passed during CQ/QP creation. If the
> request is valid, it maps the specified offset/length within the umem
> registered memory.
We don't support "remote" pinning. This code is wrong:
+ dv_umem->addr = obj->addr + umem_offset;
[..]
+ umem = ib_umem_get(&rdev->ibdev, (unsigned long)dv_umem->addr,
+ dv_umem->size, dv_umem->access);
Since "addr" is only valid for pinning within the single system call that
specifies it. You cannot pass it over to another, later, systemcall.
I have no idea why you would want to do a design like this, if you
want deferred pinning then pass the addr/etc directly later.
Jason
next prev parent reply other threads:[~2025-11-17 17:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 7:23 [PATCH rdma-next v2 0/4] RDMA/bnxt_re: Support direct verbs Sriharsha Basavapatna
2025-11-04 7:23 ` [PATCH rdma-next v2 1/4] RDMA/bnxt_re: Move the UAPI methods to a dedicated file Sriharsha Basavapatna
2025-11-09 9:12 ` Leon Romanovsky
2025-11-10 14:43 ` Sriharsha Basavapatna
2025-11-04 7:23 ` [PATCH rdma-next v2 2/4] RDMA/bnxt_re: Refactor bnxt_qplib_create_qp() function Sriharsha Basavapatna
2025-11-09 9:21 ` Leon Romanovsky
2025-11-10 14:49 ` Sriharsha Basavapatna
2025-11-11 10:14 ` Leon Romanovsky
2025-11-04 7:23 ` [PATCH rdma-next v2 3/4] RDMA/bnxt_re: Direct Verbs: Support DBR and UMEM verbs Sriharsha Basavapatna
2025-11-04 7:23 ` [PATCH rdma-next v2 4/4] RDMA/bnxt_re: Direct Verbs: Support CQ and QP verbs Sriharsha Basavapatna
2025-11-09 9:49 ` Leon Romanovsky
2025-11-10 14:58 ` Sriharsha Basavapatna
2025-11-17 17:33 ` Jason Gunthorpe [this message]
2025-11-19 16:14 ` Sriharsha Basavapatna
2025-11-19 19:09 ` 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=20251117173352.GC17968@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=andrew.gospodarek@broadcom.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--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