provider/irdma: Implement CoCo buffer APIs - #1766
Conversation
8e618f9 to
fbd917c
Compare
|
Hi, Thanks for getting a jump on this. We should probably work out some of the uAPI details since irdma is a bit unusual in that regard. As you are aware, irdma handles user-allocated QP/CQ/SRQ ring buffers differently from other drivers (from what I can tell). For irdma, QP/CQ/SRQ creation is a two step process where the ring buffers are allocated and registered as special memory regions (indicated via flags in udata) using the normal reg_mr command prior to issuing the actual ibv_cmd_create_qp/cq/srq call. The driver maintains an internal registry to correlate these special MRs with their child ring object when the object is created. So, I think we have a few options:
Option 1 is the easiest and probably carries less risk, but I am not sure if the maintainers would prefer option 2 since it's a more standard way. As a side note, we will probably need to fix a few irdma kernel driver issues before adding new features:
|
|
SG to clarify and align on uAPIs. Good call. The simpler the better - Therefore, I also prefer option 1. Option 2 appear a reasonable step forward to converge with standard ways. Though, non-trivial work to support IOCTl ABIs appears needed. Simply modifying the legacy write syscall ABI structs appears a plausible middle ground. A recent patch for fixing a vulnerability on user triggered NULL deref appears specific to the two step process and a counter argument against the two step process (I think your side is also spot on). Though I don't think the two step process is bad. Converging with standard ways is probably the strongest argument, if the alignment is option 2. For VA dmabuf, it sounds interesting. I'd be curious to learn more. My limited understanding is that kernel side needs a dmabuf fd to cast it to dmabuf structure. Maybe there is no need to cast it at all in kernel with the mmapped approach. |
|
I am prepping ioctl support for irdma driver. Will refresh this shortly. Regards, |
1cbd2e8 to
7ca67f6
Compare
|
Hello, kernel Regards, |
Allocation of system_cc_dmabuf is only carried out if CoCo DMA bounce feature in device, and cc unprotected attribute are both present. Proper cleanup is added to cleanup path. Signed-off-by: David Hu <xuehaohu@google.com>
Add an `irdma_buf` wrapping ibv_buf following existing pattern, and enables irdma specific contexts and state handling. Signed-off-by: David Hu <xuehaohu@google.com>
Cleanup path is also properly updated to be dmabuf aware. This still only handles legacy write() cmd, with just incremental defense against dma-buf backed mr for cq. The else branch for ioctl is in follow up commit. Signed-off-by: David Hu <xuehaohu@google.com>
Cleanup path is also updated accordingly. Clean up of buf is consolidated into `irdma_destroy_vmapped_qp()`. Signed-off-by: David Hu <xuehaohu@google.com>
Cleanup path is also updated accordingly Signed-off-by: David Hu <xuehaohu@google.com>
irdma provider will be the first consumer. Signed-off-by: David Hu <xuehaohu@google.com>
irdma driver specific ioctl attributes implemented by irdma driver, mostly just matching legacy write cmd req structs. Signed-off-by: David Hu <xuehaohu@google.com>
Needed for qp and srq creation ex2 cmds, as fallback mechanisms Signed-off-by: David Hu <xuehaohu@google.com>
This is needed for modern ex2 qp create command. Modern ex2 qp create command is needed for pass in driver attrs. Signed-off-by: David Hu <xuehaohu@google.com>
Signed-off-by: David Hu <xuehaohu@google.com>
Signed-off-by: David Hu <xuehaohu@google.com>
This switches from `ibv_cmd_create_qp` to modern `ibv_cmd_create_qp_ex2` so that driver attrs can be passed in. Signed-off-by: David Hu <xuehaohu@google.com>
In case of dmabuf backed SRQ, there is not a separate dmabuf fd for shadow area. Instead, the shadow shares a same dmabuf fd as SRQ buf, but with an offset as the size of the SRQ buf size. Modern ex interfaces are used so that driver specific attributes can be passed to ioctl. Signed-off-by: David Hu <xuehaohu@google.com>
7ca67f6 to
d29e8ad
Compare
Implement CoCo DMA Bounce buffer APIs defined in #1748
verbs_qpin order to be able to use*{qp, cq, srq}_ex{2}cmdsirdma-abi.hupdated to include irdma driver specific ioctl attributes.ibv_cmd_create_srq_ex2to libibverbs to support irdma srq creation via ioctl.irdmadriver support ( Review in Progress )cc: @jakemoroni @jpirko