From patchwork Fri Feb 19 11:50:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 12095137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B3F1C433DB for ; Fri, 19 Feb 2021 11:51:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C096960C3D for ; Fri, 19 Feb 2021 11:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbhBSLvD (ORCPT ); Fri, 19 Feb 2021 06:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhBSLvC (ORCPT ); Fri, 19 Feb 2021 06:51:02 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A854BC061574 for ; Fri, 19 Feb 2021 03:50:21 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id n1so9441001edv.2 for ; Fri, 19 Feb 2021 03:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Eg59KUYe+bJ+I9KESrrmcnq1YNvThExgcUsMQCD8RzA=; b=Hg0Shs1arYppVSX6c/wGJg9xvCljMBmeuHb8Dogfp8bLIMnk73efqLHpnNK/dNsoR8 ZEO3yqSJdDcFj3O7tNFkRFlLaeZ8sU8XlcY/eylcncUFJn1V592wKmw56zpAhEhcVcMC fgro+X6cRIn7ACSkA63hod1m7OEL2kNyqesnsYl8u8ol9fu+Lcx1C4T8jNOQZxwR/ePH 5vnpqkjQroY+itF2egWgNKf8ba7gupliju2Houd6YlBw49C3n0pdFBok1zzZ/WFaeOD7 FfHQ9LU8XaXTGIbqvSMaOzsqHBv5VP0Qo7qZqQ7pxweqV3Skd3f8Xu7N+MzJG83IXfw/ peRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Eg59KUYe+bJ+I9KESrrmcnq1YNvThExgcUsMQCD8RzA=; b=mD0hNctDJ9lpZvVsD+A23uTGx7mG5tU4L+hl2MFVZUOQZ/er6O4KGdWVBhajWcnwGX QlWooPV6JkosUye8OxezWdvuAn9kOsCKhBxM0KpCW2OotZ9+vhnxl7RqFpaEM/CqTMRe wrXSja2zCuG8eY+bx8RoQQKVWDBaWIXBOm4b3LOUCUzVR38s4MU+T830YZbk235GgWsv POZ1p7FJ4PqmA3BtaRpxbLacDmNb8lNLtYVYQToVbu0Hm6nwK91yQYZZ0dUhKSmkJbKQ M+pYWwd3ClT2mDjLaiFxv3fFjj1ydLGG2OjcGjB9A+Qt5p8uVimO3z6vOHgU2WCNSdMP VtWw== X-Gm-Message-State: AOAM532rcjadS823GcKc8yaDZoiTIW5UQnr1QohbDbbCukApZ3jjF78T 7AUPqYJbHrGlmu8xTcXXhkALuhy25w2Oog== X-Google-Smtp-Source: ABdhPJzJF7yuX485kr1TMd8m9rOiRWr09PpMdgx/oOoo+jKhTwy2yYb3BEUiCZZfOKOyeqIyh9FpgA== X-Received: by 2002:aa7:d8da:: with SMTP id k26mr8823011eds.364.1613735420180; Fri, 19 Feb 2021 03:50:20 -0800 (PST) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:496a:1b00:d976:bb6f:c5ab:7b14]) by smtp.gmail.com with ESMTPSA id ia25sm2544099ejc.44.2021.02.19.03.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 03:50:19 -0800 (PST) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com Subject: [PATCH 1/2] RDMA/rtrs: Use new shared CQ mechanism Date: Fri, 19 Feb 2021 12:50:18 +0100 Message-Id: <20210219115019.38981-1-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Has the driver use shared CQs providing ~10%-20% improvement during test. Instead of opening a CQ for each QP per connection, a CQ for each QP will be provided by the RDMA core driver that will be shared between the QPs on that core reducing interrupt overhead. Signed-off-by: Jack Wang Reviewed-by: Leon Romanovsky --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 10 +++++----- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 1 + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 10 +++++----- drivers/infiniband/ulp/rtrs/rtrs.c | 11 +++++++---- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 0a08b4b742a3..4e9cf06cc17a 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -325,7 +325,7 @@ static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) static void rtrs_clt_fast_reg_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_clt_con *con = cq->cq_context; + struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context); if (unlikely(wc->status != IB_WC_SUCCESS)) { rtrs_err(con->c.sess, "Failed IB_WR_REG_MR: %s\n", @@ -345,7 +345,7 @@ static void rtrs_clt_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_io_req *req = container_of(wc->wr_cqe, typeof(*req), inv_cqe); - struct rtrs_clt_con *con = cq->cq_context; + struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context); if (unlikely(wc->status != IB_WC_SUCCESS)) { rtrs_err(con->c.sess, "Failed IB_WR_LOCAL_INV: %s\n", @@ -586,7 +586,7 @@ static int rtrs_post_recv_empty_x2(struct rtrs_con *con, struct ib_cqe *cqe) static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_clt_con *con = cq->cq_context; + struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context); struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); u32 imm_type, imm_payload; bool w_inval = false; @@ -2241,7 +2241,7 @@ static int init_conns(struct rtrs_clt_sess *sess) static void rtrs_clt_info_req_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_clt_con *con = cq->cq_context; + struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context); struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); struct rtrs_iu *iu; @@ -2323,7 +2323,7 @@ static int process_info_rsp(struct rtrs_clt_sess *sess, static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_clt_con *con = cq->cq_context; + struct rtrs_clt_con *con = to_clt_con(wc->qp->qp_context); struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); struct rtrs_msg_info_rsp *msg; enum rtrs_clt_state state; diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h index 8caad0a2322b..1b31bda9ca78 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -91,6 +91,7 @@ struct rtrs_con { struct ib_cq *cq; struct rdma_cm_id *cm_id; unsigned int cid; + u16 cq_size; }; struct rtrs_sess { diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index d071809e3ed2..37ba121564a2 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -199,7 +199,7 @@ static void rtrs_srv_wait_ops_ids(struct rtrs_srv_sess *sess) static void rtrs_srv_reg_mr_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_srv_con *con = cq->cq_context; + struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context); struct rtrs_sess *s = con->c.sess; struct rtrs_srv_sess *sess = to_srv_sess(s); @@ -720,7 +720,7 @@ static void rtrs_srv_stop_hb(struct rtrs_srv_sess *sess) static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_srv_con *con = cq->cq_context; + struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context); struct rtrs_sess *s = con->c.sess; struct rtrs_srv_sess *sess = to_srv_sess(s); struct rtrs_iu *iu; @@ -862,7 +862,7 @@ static int process_info_req(struct rtrs_srv_con *con, static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_srv_con *con = cq->cq_context; + struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context); struct rtrs_sess *s = con->c.sess; struct rtrs_srv_sess *sess = to_srv_sess(s); struct rtrs_msg_info_req *msg; @@ -1110,7 +1110,7 @@ static void rtrs_srv_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_mr *mr = container_of(wc->wr_cqe, typeof(*mr), inv_cqe); - struct rtrs_srv_con *con = cq->cq_context; + struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context); struct rtrs_sess *s = con->c.sess; struct rtrs_srv_sess *sess = to_srv_sess(s); struct rtrs_srv *srv = sess->srv; @@ -1167,7 +1167,7 @@ static void rtrs_rdma_process_wr_wait_list(struct rtrs_srv_con *con) static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc) { - struct rtrs_srv_con *con = cq->cq_context; + struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context); struct rtrs_sess *s = con->c.sess; struct rtrs_srv_sess *sess = to_srv_sess(s); struct rtrs_srv *srv = sess->srv; diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c index d13aff0aa816..d5ec78280937 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -218,14 +218,15 @@ static int create_cq(struct rtrs_con *con, int cq_vector, u16 cq_size, struct rdma_cm_id *cm_id = con->cm_id; struct ib_cq *cq; - cq = ib_alloc_cq(cm_id->device, con, cq_size, - cq_vector, poll_ctx); + cq = ib_cq_pool_get(cm_id->device, cq_size, + cq_vector, poll_ctx); if (IS_ERR(cq)) { rtrs_err(con->sess, "Creating completion queue failed, errno: %ld\n", PTR_ERR(cq)); return PTR_ERR(cq); } con->cq = cq; + con->cq_size = cq_size; return 0; } @@ -273,8 +274,9 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con, err = create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, max_send_sge); if (err) { - ib_free_cq(con->cq); + ib_cq_pool_put(con->cq, con->cq_size); con->cq = NULL; + con->cq_size = 0; return err; } con->sess = sess; @@ -290,8 +292,9 @@ void rtrs_cq_qp_destroy(struct rtrs_con *con) con->qp = NULL; } if (con->cq) { - ib_free_cq(con->cq); + ib_cq_pool_put(con->cq, con->cq_size); con->cq = NULL; + con->cq_size = 0; } } EXPORT_SYMBOL_GPL(rtrs_cq_qp_destroy); From patchwork Fri Feb 19 11:50:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 12095139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DE99C433E0 for ; Fri, 19 Feb 2021 11:51:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C4AD64EB3 for ; Fri, 19 Feb 2021 11:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbhBSLvE (ORCPT ); Fri, 19 Feb 2021 06:51:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhBSLvC (ORCPT ); Fri, 19 Feb 2021 06:51:02 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252E3C061756 for ; Fri, 19 Feb 2021 03:50:22 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id v22so9336047edx.13 for ; Fri, 19 Feb 2021 03:50:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tXMFOzhf6BiRDoEIQw0Iyje74L4hk0/kocBi/SN8CkM=; b=eRKcfJQ16/vOpNDoRa4GOqX48M6/rp+FAv/xfQmjLoxmtf7nq1ehBthZLGJGfuDuxS y3jjgSxIK1E4wGJFTV98+rZ/ITcIOPksrfynEQy53rCFxbBGGkTRMAlpDOzWWQ/QiicA qMVn3GfZz5INHIP9Q1xb+Ew37/vbRJlGwgjXWPVD+x/aE2Go55iYQWlZJK4OAek4Rijc I5TE6K8jskGkOabIHNJG/zlKtK4PXK/qT6zwvUEvA8TZfmEu3fcZhYalWNm6ZjqOBmpE q1qVINZTpGEY0xhJ3nHxk/HCMM3z1VChCtxc3f8Jq9vA/FEXqIwmi0HhfU1wh13vYw0d dekQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tXMFOzhf6BiRDoEIQw0Iyje74L4hk0/kocBi/SN8CkM=; b=h4L6KQwWMyidoB3NwdSRNS0GRnEPtCyyRh3bl1re1+JO31XN6lI9RSrZ1bVZlErWmH JBqN8BiXCU6W4MWBGmnk68LV6V98ZJxWbanIOWlobtGEzj8kQvWhX0Ri5ENya44HXNXu JHQD67Lqs5UfWWpv9sFQqqJacBicM6I+/6M2SjEOZbpZjf5fAyvtRv19crQsKLqZ8S7k 4gnq4F9muDy1AIjFRHLkyiEfH2uBLV8HEVuHd9WoawedoqkH/2/fmc3m+H/glLGrlk+P oLtFgjIS6+UzIRnfay3hJPMJuPF4oiOzkoAVnEWZxXe4SMhwYEAultYVgclhEdF0zoOB ydxA== X-Gm-Message-State: AOAM530XrEM/ph37r90wnu4Vij2qWl9FjnhXMQI41F2ysYtsOm2d+7+6 C/cvxcj1k/k0L3ZePum3hijOSZN2DExmKw== X-Google-Smtp-Source: ABdhPJzwyVRswuHmg4hQs7XlmY7ZKfb2wGKNObNo8vbIpqv1601gJDaC+qSF9dgieVABjszifo4cPw== X-Received: by 2002:aa7:d315:: with SMTP id p21mr7220161edq.300.1613735420749; Fri, 19 Feb 2021 03:50:20 -0800 (PST) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:496a:1b00:d976:bb6f:c5ab:7b14]) by smtp.gmail.com with ESMTPSA id ia25sm2544099ejc.44.2021.02.19.03.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 03:50:20 -0800 (PST) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com Subject: [PATCH 2/2] RDMA/rtrs-clt: Use rdma_event_msg in log Date: Fri, 19 Feb 2021 12:50:19 +0100 Message-Id: <20210219115019.38981-2-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210219115019.38981-1-jinpu.wang@cloud.ionos.com> References: <20210219115019.38981-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org It's easier to understand string instead of enum. Signed-off-by: Jack Wang Reviewed-by: Leon Romanovsky --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 4e9cf06cc17a..f95955fc2992 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1853,12 +1853,14 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id, case RDMA_CM_EVENT_UNREACHABLE: case RDMA_CM_EVENT_ADDR_CHANGE: case RDMA_CM_EVENT_TIMEWAIT_EXIT: - rtrs_wrn(s, "CM error event %d\n", ev->event); + rtrs_wrn(s, "CM error (CM event: %s, err: %d)\n", + rdma_event_msg(ev->event), ev->status); cm_err = -ECONNRESET; break; case RDMA_CM_EVENT_ADDR_ERROR: case RDMA_CM_EVENT_ROUTE_ERROR: - rtrs_wrn(s, "CM error event %d\n", ev->event); + rtrs_wrn(s, "CM error (CM event: %s, err: %d)\n", + rdma_event_msg(ev->event), ev->status); cm_err = -EHOSTUNREACH; break; case RDMA_CM_EVENT_DEVICE_REMOVAL: @@ -1868,7 +1870,8 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id, rtrs_clt_close_conns(sess, false); return 0; default: - rtrs_err(s, "Unexpected RDMA CM event (%d)\n", ev->event); + rtrs_err(s, "Unexpected RDMA CM error (CM event: %s, err: %d)\n", + rdma_event_msg(ev->event), ev->status); cm_err = -ECONNRESET; break; }