From patchwork Mon Feb 22 14:15:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 12098771 X-Patchwork-Delegate: jgg@ziepe.ca 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.7 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 A5E2BC433E0 for ; Mon, 22 Feb 2021 14:19:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49B3564E20 for ; Mon, 22 Feb 2021 14:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbhBVOSw (ORCPT ); Mon, 22 Feb 2021 09:18:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbhBVOQh (ORCPT ); Mon, 22 Feb 2021 09:16:37 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72142C06174A for ; Mon, 22 Feb 2021 06:15:54 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id j6so2519230eja.12 for ; Mon, 22 Feb 2021 06:15:54 -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=XH73av95zFq3ZGWS+TtRnD2+tLkV/fN69mwbUHICneY=; b=T9gY6WjxkxYrdB9DOFqDEeRU76NStSMRcPKXqtWIqy4Un/wGb80OTl+jCb7ukaPaIh T8am3rOHYjIxNlGpl21eJeaqpzjrJsD17xGcCrrIFzIwXtZZzJOHCFKQ7Q6NaMq+cGW9 sC6RnLq8MBs6ExM8ZGi09Gv2RJg6mkJxmSKn5JyD/rGZ8TdNqshauh5krv6TrLmPwIFY k9wSRIsMs+B4VLPYrseyljjAi76Jz73a8DhH25O2OMQahLUpsAomK3g9oDfKJi/aOwJ4 pw/L/qYhbDmAMH9DWrg2yO8uF8sJiZX9JLplHJO/jHfj0SrPe3P28I7n/qgWBa7xIWY7 do/w== 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=XH73av95zFq3ZGWS+TtRnD2+tLkV/fN69mwbUHICneY=; b=OaaW/iARA8muFfqYMw3DObR00mBnWVAuYllBEyscXZeGl3Qyv1I4/OYeiHAGgz8mYC OzLUcWWJLlc8Y4yAq+a+IW5IjiljKqZhsu6UcJ7PxeVXRn6T0QsG9WQtGPK5ZzICDlRM vV881pRnyWFbj6/tRkQgsYlTecitlyCOaPl2d0CQH+I46zjyOEO/T7VP+xE5cW1mspDe tuo2rTGmtNaZGMA7COHEPem5nEouC1kQXm0iSoU1YoOYPHwyCxhl3pzguiFfsJbyQL0M Q2qOBD1QEU1a0oJpLvRuSp/Y/1TeAxhTrX2Hx5nNmpJ2WNn2xeNg2oIbD/nWtFnfZmNW 4k/Q== X-Gm-Message-State: AOAM533cLf2Um4z8pVQABhC9W7XZBeIggygUNvLPZbDpdd2hltf+xHX9 GBgcoezEp2lltA40zrf9xBXrCr7E5CKOIQ== X-Google-Smtp-Source: ABdhPJxlZ8QBgAmq2pTSkwaOdjBHO9SmzoT/URmN8C2X6JuJ4KKi30hHsaQVlYPPpKAcrvKJFNz1Zw== X-Received: by 2002:a17:906:4e8f:: with SMTP id v15mr11208494eju.357.1614003352963; Mon, 22 Feb 2021 06:15:52 -0800 (PST) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:496a:ec00:9029:bb23:33bd:ec62]) by smtp.gmail.com with ESMTPSA id m19sm11615606eds.8.2021.02.22.06.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 06:15:52 -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, Leon Romanovsky Subject: [PATCHv2 for-next 1/2] RDMA/rtrs: Use new shared CQ mechanism Date: Mon, 22 Feb 2021 15:15:50 +0100 Message-Id: <20210222141551.54345-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 | 9 +++++---- 4 files changed, 16 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..64f2fd63e9c5 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,7 +274,7 @@ 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; return err; } @@ -290,7 +291,7 @@ 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; } } From patchwork Mon Feb 22 14:15:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 12098773 X-Patchwork-Delegate: jgg@ziepe.ca 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.7 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 BF042C433E6 for ; Mon, 22 Feb 2021 14:19:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B82164DB1 for ; Mon, 22 Feb 2021 14:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhBVOTA (ORCPT ); Mon, 22 Feb 2021 09:19:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbhBVOQh (ORCPT ); Mon, 22 Feb 2021 09:16:37 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBE44C06178A for ; Mon, 22 Feb 2021 06:15:56 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id do6so29645092ejc.3 for ; Mon, 22 Feb 2021 06:15:56 -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=HU191KwzVnrMuRT5oyZ+GSJPQ8LIy68Z17dK5sSyrdQ=; b=KFaKnhJ0tlvTgX5grj2VFGAm1HfCop+Y4pv1sbjnLQ+fI9QHSwHAB+NUsuD7RXZEL9 6+ncTBkXaGffhGRvQkHZP3Ug55SUJyJJPml01/Pd1U9QLnP8YzkPEgyk0PHnsvuv/g8Q m+92ym/Lss2Y0Rq0u07ULmCjwWg8lB9VOYvpZONb3Whh1cgYIx1zrtGJcL2F3qka3GWn r/UI6XVKrV1Cw3Zl/qOZyOQiPa6QHWW+XpBZbaZqkSBgr2xY4DcZbEQmfiLivYScV3ZS D/G+iz8P0oo0KKxmjeE4LEALIdLp0gwg1wAGWkmZCRvC1pD/WsLekoOCC/Z60lG6bkRF J7tw== 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=HU191KwzVnrMuRT5oyZ+GSJPQ8LIy68Z17dK5sSyrdQ=; b=QsEgSgYt8/LDOmktrgI3uCyIjcUyZCqFDYxRCAeHrPqSAw1tc2MNfsSrplbBFBbNnm t8ErGLENFZOqcxIgh2P5RJRSIiE9LBbeBHFRA1CC2qWzqdWVxwRskZ0J0knhX9BLlF+s gtWvmulRgThNLlfiT8/FJ2zZNI3hIxs4KUcKQiVFcyazDaGjtzDClSQlv/z7N8EreYfv E/ZW03fX6iUeMjTEHd1IEHtzogVsHl8FMzJBOA99Fm4akLryjdjfN1gHJP5lW2k+ow0H RoL9Wlx1N8079BoEqIcA6SK+0lSu6zCbo8/WjGcxP5nhw+JBn1TZGUaubuTR1ILp7bW/ h6yQ== X-Gm-Message-State: AOAM530+9cuZFvh7uSJgtJX2hxYJbBcmbyXeU8eg0D4EiZGpm8+VamDh +EgyJSsqMpL2PW/SNGeI/eJ5m9q0MdJQgQ== X-Google-Smtp-Source: ABdhPJz+7Mi0eplLn8L/ERzScV5AkCFc08cwG6s/IRQzqOC3fEuOhppa+OZeQeSd3Deujne2F0Ecpg== X-Received: by 2002:a17:907:d8a:: with SMTP id go10mr20851819ejc.403.1614003353949; Mon, 22 Feb 2021 06:15:53 -0800 (PST) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:496a:ec00:9029:bb23:33bd:ec62]) by smtp.gmail.com with ESMTPSA id m19sm11615606eds.8.2021.02.22.06.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 06:15:53 -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, Leon Romanovsky Subject: [PATCHv2 for-next 2/2] RDMA/rtrs-clt: Use rdma_event_msg in log Date: Mon, 22 Feb 2021 15:15:51 +0100 Message-Id: <20210222141551.54345-2-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210222141551.54345-1-jinpu.wang@cloud.ionos.com> References: <20210222141551.54345-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; }