Alok-Prasad/RD…
Commits on Aug 21, 2021
-
RDMA/qedr: qedr crash while running rdma-tool.
This patch fixes crash caused by querying qp. This is due the fact that when no traffic is running, rdma_create_qp hasn't created any qp hence qed->qp is null. Below call trace is generated while using iproute2 utility "rdma res show -dd qp" on rdma interface. ========================================================================== [ 302.569794] BUG: kernel NULL pointer dereference, address: 0000000000000034 .. [ 302.570378] Hardware name: Dell Inc. PowerEdge R720/0M1GCR, BIOS 1.2.6 05/10/2012 [ 302.570500] RIP: 0010:qed_rdma_query_qp+0x33/0x1a0 [qed] [ 302.570861] RSP: 0018:ffffba560a08f580 EFLAGS: 00010206 [ 302.570979] RAX: 0000000200000000 RBX: ffffba560a08f5b8 RCX: 0000000000000000 [ 302.571100] RDX: ffffba560a08f5b8 RSI: 0000000000000000 RDI: ffff9807ee458090 [ 302.571221] RBP: ffffba560a08f5a0 R08: 0000000000000000 R09: ffff9807890e7048 [ 302.571342] R10: ffffba560a08f658 R11: 0000000000000000 R12: 0000000000000000 [ 302.571462] R13: ffff9807ee458090 R14: ffff9807f0afb000 R15: ffffba560a08f7ec [ 302.571583] FS: 00007fbbf8bfe740(0000) GS:ffff980aafa00000(0000) knlGS:0000000000000000 [ 302.571729] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 302.571847] CR2: 0000000000000034 CR3: 00000001720ba001 CR4: 00000000000606f0 [ 302.571968] Call Trace: [ 302.572083] qedr_query_qp+0x82/0x360 [qedr] [ 302.572211] ib_query_qp+0x34/0x40 [ib_core] [ 302.572361] ? ib_query_qp+0x34/0x40 [ib_core] [ 302.572503] fill_res_qp_entry_query.isra.26+0x47/0x1d0 [ib_core] [ 302.572670] ? __nla_put+0x20/0x30 [ 302.572788] ? nla_put+0x33/0x40 [ 302.572901] fill_res_qp_entry+0xe3/0x120 [ib_core] [ 302.573058] res_get_common_dumpit+0x3f8/0x5d0 [ib_core] [ 302.573213] ? fill_res_cm_id_entry+0x1f0/0x1f0 [ib_core] [ 302.573377] nldev_res_get_qp_dumpit+0x1a/0x20 [ib_core] [ 302.573529] netlink_dump+0x156/0x2f0 [ 302.573648] __netlink_dump_start+0x1ab/0x260 [ 302.573765] rdma_nl_rcv+0x1de/0x330 [ib_core] [ 302.573918] ? nldev_res_get_cm_id_dumpit+0x20/0x20 [ib_core] [ 302.574074] netlink_unicast+0x1b8/0x270 [ 302.574191] netlink_sendmsg+0x33e/0x470 [ 302.574307] sock_sendmsg+0x63/0x70 [ 302.574421] __sys_sendto+0x13f/0x180 [ 302.574536] ? setup_sgl.isra.12+0x70/0xc0 [ 302.574655] __x64_sys_sendto+0x28/0x30 [ 302.574769] do_syscall_64+0x3a/0xb0 [ 302.574884] entry_SYSCALL_64_after_hwframe+0x44/0xae ========================================================================== Signed-off-by: Ariel Elior <aelior@marvell.com> Signed-off-by: Shai Malin <smalin@marvell.com> Signed-off-by: Alok Prasad <palok@marvell.com>
Commits on Aug 19, 2021
-
RDMA/hns: Dump detailed driver-specific UCTX
Dump DCA mem pool status in UCTX restrack. Sample output: $ rdma res show ctx dev hns_0 -dd dev hns_0 ctxn 7 pid 1410 comm python3 drv_dca-total 65536 drv_dca-free 40960 dev hns_0 ctxn 8 pid 1410 comm python3 drv_dca-total 0 drv_dca-free 0 Link: https://lore.kernel.org/r/1627525163-1683-13-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/nldev: Add detailed CTX information support
Implement the RDMA nldev netlink interface for dumping detailed CTX information. Link: https://lore.kernel.org/r/1627525163-1683-12-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Sync DCA status by the shared memory
Alloc a DCA num to indicate the DCA status position in the shared memory, if the num is valid, the user DCA can get the DCA status by testing the bit in the shared memory for each QP, otherwise the user DCA needs to invoke the verbs 'HNS_IB_METHOD_DCA_MEM_ATTACH' to check the DCA status. Link: https://lore.kernel.org/r/1627525163-1683-11-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Add a shared memory to sync DCA status
The user DCA needs to check the QP attaching state before filling wqe buffer by the resp from uverbs 'HNS_IB_METHOD_DCA_MEM_ATTACH', but this will result in too much time being wasted on system calls, so add a shared table between user driver and kernel driver to sync DCA status. Link: https://lore.kernel.org/r/1627525163-1683-10-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Add method to query WQE buffer's address
If a uQP works in DCA mode, the userspace driver need to get the buffer's address in DCA memory pool by calling the 'HNS_IB_METHOD_DCA_MEM_QUERY' method after the QP was attached by calling the 'HNS_IB_METHOD_DCA_MEM_ATTACH' method. This method will return the DCA mem object's key and the offset to let the userspace driver get the WQE's virtual address in DCA memory pool. Link: https://lore.kernel.org/r/1627525163-1683-9-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Add method to detach WQE buffer
If a uQP works in DCA mode, the userspace driver needs to drop the WQE buffer by calling the 'HNS_IB_METHOD_DCA_MEM_DETACH' method when the QP's CI is equal to PI, that means, the hns ROCEE will not access the WQE's buffer at this time, and the userspace driver can free this WQE's buffer. This method will start an worker queue to recycle the WQE buffer in kernel space, if the WQE buffer is indeed not being accessed by hns ROCEE, the worker will change the pages' state as free in DCA memory pool. Link: https://lore.kernel.org/r/1627525163-1683-8-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Setup the configuration of WQE addressing to QPC
Add a new command to update the configuration of WQE buffer addressing to QPC in DCA mode. Link: https://lore.kernel.org/r/1627525163-1683-7-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Add method for attaching WQE buffer
If a uQP works as DCA mode, the userspace driver needs to config the WQE buffer by calling the 'HNS_IB_METHOD_DCA_MEM_ATTACH' method before filling the WQE. This method will allocate a group of pages from DCA memory pool and write the configuration of addressing to QPC. Link: https://lore.kernel.org/r/1627525163-1683-6-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Refactor QP modify flow
Warp the qp modify checking logic as a funciton to make the code more readable. Link: https://lore.kernel.org/r/1627525163-1683-5-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Configure DCA mode for the userspace QP
If the userspace driver assign a NULL to the field of 'buf_addr' in 'struct hns_roce_ib_create_qp' when creating QP, this means the kernel driver need setup the QP as DCA mode. So add a QP capability bit in response to indicate the userspace driver that the DCA mode has been enabled. Link: https://lore.kernel.org/r/1627525163-1683-4-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Add method for shrinking DCA memory pool
If no QP is using a DCA mem object, the userspace driver can destroy it. So add a new method 'HNS_IB_METHOD_DCA_MEM_SHRINK' to allow the userspace dirver to remove an object from DCA memory pool. If a DCA mem object has been shrunk, the userspace driver can destroy it by 'HNS_IB_METHOD_DCA_MEM_DEREG' method and free the buffer which is allocated in userspace. Link: https://lore.kernel.org/r/1627525163-1683-3-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Introduce DCA for RC QP
The hip09 introduces the DCA(Dynamic context attachment) feature which supports many RC QPs to share the WQE buffer in a memory pool, this will reduce the memory consumption when there are too many QPs are inactive. If a QP enables DCA feature, the WQE's buffer will not be allocated when creating. But when the users start to post WRs, the hns driver will allocate a buffer from the memory pool and then fill WQEs which tagged with this QP's number. The hns ROCEE will stop accessing the WQE buffer when the user polled all of the CQEs for a DCA QP, then the driver will recycle this WQE's buffer to the memory pool. This patch adds a group of methods to support the user space register buffers to a memory pool which belongs to the user context. The hns kernel driver will update the pages state in this pool when the user calling the post/poll methods and the user driver can get the QP's WQE buffer address by the key and offset which queried from kernel. Link: https://lore.kernel.org/r/1627525163-1683-2-git-send-email-liangwenpeng@huawei.com Signed-off-by: Xi Wang <wangxi11@huawei.com> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core/sa_query: Remove unused function
ib_sa_service_rec_query() was introduced in kernel v2.6.13 by commit cbae32c ("[PATCH] IB: Add Service Record support to SA client") in 2005. It was not used then and have never been used since. Removing it and related functions/structs. Link: https://lore.kernel.org/r/1628702736-12651-1-git-send-email-haakon.bugge@oracle.com Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/qedr: Move variables reset to qedr_set_common_qp_params()
Qedr code is tightly coupled with existing both INIT transitions. Here, during first INIT transition all variables are reset and the RESET state is checked in post_recv() before any posting. Commit dc70f7c ("RDMA/cma: Remove unnecessary INIT->INIT transition") exposed this bug. So moving variables reset to qedr_set_common_qp_params() and also avoid RESET state check for post_recv(). Link: https://lore.kernel.org/r/20210811051650.14914-1-pkushwaha@marvell.com Signed-off-by: Michal Kalderon <mkalderon@marvell.com> Signed-off-by: Ariel Elior <aelior@marvell.com> Signed-off-by: Shai Malin <smalin@marvell.com> Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hfi1: Stop using seq_get_buf in _driver_stats_seq_show
Just use seq_write to copy the stats into the seq_file buffer instead of poking holes into the seq_file abstraction. Link: https://lore.kernel.org/r/20210810151711.1795374-1-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com> Tested-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/rtrs: Remove a useless kfree()
'sess->rbufs' is known to be NULL here, so there is no point in kfree'ing it. Fixes: 6a98d71 ("RDMA/rtrs: client: main functionality") Link: https://lore.kernel.org/r/9a57c9f837fa2c6f0070578a1bc4840688f62962.1628185335.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Md Haris Iqbal <haris.iqbal@ionos.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Fix return in hns_roce_rereg_user_mr()
If re-registering an MR in hns_roce_rereg_user_mr(), we should return NULL instead of passing 0 to ERR_PTR for clarity. Fixes: 4e9fc1d ("RDMA/hns: Optimize the MR registration process") Link: https://lore.kernel.org/r/20210804125939.20516-1-yuehaibing@huawei.com Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Commits on Aug 3, 2021
-
RDMA/core: Create clean QP creations interface for uverbs
Unify create QP creation interface to make clean approach to create XRC_TGT and regular QPs. Link: https://lore.kernel.org/r/5cd50e7d8ad9112545a1a61dea62799a5cb3224a.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core: Properly increment and decrement QP usecnts
The QP usecnts were incremented through QP attributes structure while decreased through QP itself. Rely on the ib_creat_qp_user() code that initialized all QP parameters prior returning to the user and increment exactly like destroy does. Link: https://lore.kernel.org/r/25d256a3bb1fc480b77d7fe439817b993de48610.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core: Configure selinux QP during creation
All QP creation flows called ib_create_qp_security(), but differently. This caused to the need to provide exclusion conditions for the XRC_TGT, because such QP already had selinux configuration call. In order to fix it, move ib_create_qp_security() to the general QP creation routine. Link: https://lore.kernel.org/r/4d7cd6f5828aca37fb62283e6b126b73ab86b18c.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core: Reorganize create QP low-level functions
The low-level create QP function grew to be larger than any sensible inline function should be. The inline attribute is not really needed for that function and can be implemented as exported symbol. Link: https://lore.kernel.org/r/2c08709d86f876c3dfb77684357b2a939e570ca4.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core: Remove protection from wrong in-kernel API usage
The ib_create_named_qp() is kernel verb that is not used for user supplied attributes. In such case, it is ULP responsibility to provide valid QP attributes. In-kernel API shouldn't check it, exactly like other functions that don't check device capabilities. Link: https://lore.kernel.org/r/b9b9e981d1af148b750750196e686199dbbf61f8.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/core: Delete duplicated and unreachable code
The ib_create_named_qp() is kernel verb and no kernel users exist that use XRC_INI QP. Hence such QP path is not reachable. In addition, delete duplicated assignments of QP attributes from the initialization structure. Link: https://lore.kernel.org/r/1b4c0d1def5f8f6d26839e14d19da950cc4a0b05.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/mlx5: Delete not-available udata check
XRC_TGT QPs are created through kernel verbs and don't have udata at all. Fixes: 6eefa83 ("RDMA/mlx5: Protect from kernel crash if XRC_TGT doesn't have udata") Fixes: e383085 ("RDMA/mlx5: Set ECE options during QP create") Link: https://lore.kernel.org/r/b68228597e730675020aa5162745390a2d39d3a2.1628014762.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/mlx5: Drop in-driver verbs object creations
There is no real value in bypassing IB/core APIs for creating standard objects with standard types. The open-coded variant didn't have any restrack task management calls and caused to such objects to be not present when running rdmatoool. Link: https://lore.kernel.org/r/f745590e5fb7d56f90fdb25f64ee3983ba17e1e4.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA: Globally allocate and release QP memory
Convert QP object to follow IB/core general allocation scheme. That change allows us to make sure that restrack properly kref the memory. Link: https://lore.kernel.org/r/48e767124758aeecc433360ddd85eaa6325b34d9.1627040189.git.leonro@nvidia.com Reviewed-by: Gal Pressman <galpress@amazon.com> #efa Tested-by: Gal Pressman <galpress@amazon.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> #rdma and core Tested-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Tested-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/rdmavt: Decouple QP and SGE lists allocations
The rdmavt QP has fields that are both needed for the control and data path. Such mixed declaration caused to the very specific allocation flow with kzalloc_node and SGE list embedded into the struct rvt_qp. This patch separates QP creation to two: regular memory allocation for the control path and specific code for the SGE list, while the access to the later is performed through derefenced pointer. Such pointer and its context are expected to be in the cache, so performance difference is expected to be negligible, if any exists. Link: https://lore.kernel.org/r/f66c1e20ccefba0db3c69c58ca9c897f062b4d1c.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/mlx5: Rework custom driver QP type creation
Starting from commit 2b1f747 ("RDMA/core: Allow drivers to disable restrack DB") the restrack is able to handle non-standard QP types either. That change allows us to rewrite custom QP calls to their IB/core counterparts, so we will use general QP creation flow even for the driver QP types. Link: https://lore.kernel.org/r/51682ab82298748941f38bd23ee3bf77ef1cab7b.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/mlx5: Delete device resource mutex that didn't protect anything
The dev->devr.mutex was intended to protect GSI QP pointer change in the struct mlx5_ib_port_resources when it is accessed from the pkey_change_work. However that pointer isn't changed during the runtime and once IB/core adds MAD, it stays stable. Link: https://lore.kernel.org/r/6e338c561033df20d92e1371fc6a7a0d93aad945.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/mlx5: Cancel pkey work before destroying device resources
In the driver release flow, we are ensuring that notifier is disabled and no new works can be added to pkey_change_handler. It means that we can cancel that handler before destroying resources to make sure that our unwind routine is symmetrical to the allocation one. Link: https://lore.kernel.org/r/f2b1ea1bad952e4e7a48a6f731de9e0344986b29.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/efa: Remove double QP type assignment
The QP type is set by the IB/core and shouldn't be set in the driver. Fixes: 40909f6 ("RDMA/efa: Add EFA verbs implementation") Link: https://lore.kernel.org/r/838c40134c1590167b888ca06ad51071139ff2ae.1627040189.git.leonro@nvidia.com Acked-by: Gal Pressman <galpress@amazon.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Don't overwrite supplied QP attributes
QP attributes that were supplied by IB/core already have all parameters set when they are passed to the driver. The drivers are not supposed to change anything in struct ib_qp_init_attr. Fixes: 66d86e5 ("RDMA/hns: Add UD support for HIP09") Link: https://lore.kernel.org/r/5987138875e8ade9aa339d4db6e1bd9694ed4591.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-
RDMA/hns: Don't skip IB creation flow for regular RC QP
The call to internal QP creation function skips QP creation checks and misses the addition of such device QPs to the restrack DB. As a preparation to general allocation scheme, convert hns to use proper API. Link: https://lore.kernel.org/r/7b236c15f7d5abb368958297ac6962d8459cb824.1627040189.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Commits on Jul 30, 2021
-
RDMA/qedr: Improve error logs for rdma_alloc_tid error return
Use -EINVAL return type to identify whether error is returned because of "Out of MR resources" or any other error types. Link: https://lore.kernel.org/r/20210729151732.30995-2-pkushwaha@marvell.com Signed-off-by: Shai Malin <smalin@marvell.com> Signed-off-by: Ariel Elior <aelior@marvell.com> Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>