]> www.infradead.org Git - linux.git/commitdiff
RDMA/erdma: Support create_ah/destroy_ah in non-sleepable contexts
authorBoshi Yu <boshiyu@linux.alibaba.com>
Thu, 26 Dec 2024 08:41:11 +0000 (16:41 +0800)
committerLeon Romanovsky <leon@kernel.org>
Mon, 30 Dec 2024 18:42:52 +0000 (13:42 -0500)
The RDMA CM module might invoke erdma_create_ah() or erdma_destroy_ah()
in a non-sleepable context. Both of these functions will call the
erdma_post_cmd_wait(), which can potentially sleep and occasionally lead
to a hard lockup. Therefore, post the create_ah and destroy_ah commands in
polling mode if the RDMA_CREATE_AH_SLEEPABLE and RDMA_DESTROY_AH_SLEEPABLE
flags are not set, respectively.

Reviewed-by: Cheng Xu <chengyou@linux.alibaba.com>
Signed-off-by: Boshi Yu <boshiyu@linux.alibaba.com>
Link: https://patch.msgid.link/20241226084141.74823-5-boshiyu@linux.alibaba.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/erdma/erdma_verbs.c

index 0e8a13577fdcebc42bcc40806009616eb0a2a388..af36a8d2df2285c682ab3cd88802379a01376c44 100644 (file)
@@ -2219,7 +2219,7 @@ int erdma_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
        erdma_set_av_cfg(&req.av_cfg, &ah->av);
 
        ret = erdma_post_cmd_wait(&dev->cmdq, &req, sizeof(req), NULL, NULL,
-                                 true);
+                                 init_attr->flags & RDMA_CREATE_AH_SLEEPABLE);
        if (ret) {
                erdma_free_idx(&dev->res_cb[ERDMA_RES_TYPE_AH], ah->ahn);
                return ret;
@@ -2243,7 +2243,7 @@ int erdma_destroy_ah(struct ib_ah *ibah, u32 flags)
        req.ahn = ah->ahn;
 
        ret = erdma_post_cmd_wait(&dev->cmdq, &req, sizeof(req), NULL, NULL,
-                                 true);
+                                 flags & RDMA_DESTROY_AH_SLEEPABLE);
        if (ret)
                return ret;