From patchwork Mon Nov 20 15:41:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59CA1C5AD4C for ; Mon, 20 Nov 2023 15:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232186AbjKTPl4 (ORCPT ); Mon, 20 Nov 2023 10:41:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233638AbjKTPlz (ORCPT ); Mon, 20 Nov 2023 10:41:55 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5720EB4 for ; Mon, 20 Nov 2023 07:41:51 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-32deb2809daso3012606f8f.3 for ; Mon, 20 Nov 2023 07:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494909; x=1701099709; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T+OOsE2xAPZkvAFo9npeNem8c9f44n2F1KRwXZMGoT0=; b=H8tDXZK0/EfSm4Yw817MHlDNwP7HuORKr4+dBo9wOXZ/pBYe/spsYPDLg26Ic3JKmN ehajbsKA4+4bNyY6i+SLFhIuHgJjO+5K/VRv98Qp39SrAd18qCV1lqKB0VELrOtSoOt8 eXL3qQ6vJGzzLIalM7nxZfG2d78+0IOafccSvLVOyXxRXGMn1ZsE1Ee1DOiZ9mnEBZ10 QLfOpErzJZOUc3j8h8fYNFadLrVzuwcz8WAKOfj9qhkXPvCbnFQPXaRXtT1ZMoRNerS6 6WMSgzBNeQKBxUdxGdsEOL3OyexC2c4xaAHllOoMTYr2bzag64I4VaYVy6x710/vkzYz ZJYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494909; x=1701099709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T+OOsE2xAPZkvAFo9npeNem8c9f44n2F1KRwXZMGoT0=; b=JB8fza/uNNC5ej2x76OOcvm1g7OHjnJHsPlhDZQaPIQh3nxsnBtLQot1ev6/CERB1M a5BWggsXI44d/shf8QTey0UqKkmFcGNXByr6KqwqA+TA8PtryzxfymFuKzjQX+yaZcdU csLptBpuTqYMgmf1tH6nULi9Zuqg5P5PJef7fPt1WKV5pd1QEhg3Smh5lERuqFL3UtCa 6Fi/u7GGqg1mh90IBzhyhDiHMrZWMRSLO5fOLH+vrkr04xPJkX5smbbCOtUPF7OQiDSc L4Nof2TpI7byXk6NT0EauMNxaFpYB9qSZPHe7MpzHqrf18HbBmH83jsG32PiAcIWa/kf Z00Q== X-Gm-Message-State: AOJu0YxPzjINz3F1JJWOk0iTnnVoNjmz+b6nEUlKIUvaBzVF+JTNRmL3 LGudugV6LZPuQsDOwfZvyfAt+wVanMByAGg3da8= X-Google-Smtp-Source: AGHT+IFS0/ju48xbPYhbO/ZgodEM9nvgSCp4YhagBWFb2H1ClH2CzN2cg7WKN6BXddohtpocxI8odQ== X-Received: by 2002:a05:6000:186d:b0:32f:80cf:c3cd with SMTP id d13-20020a056000186d00b0032f80cfc3cdmr6640699wri.4.1700494909533; Mon, 20 Nov 2023 07:41:49 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:49 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Florian-Ewald Mueller , Grzegorz Prajsner Subject: [PATCH v2 for-next 1/9] RDMA/rtrs-srv: Do not unconditionally enable irq Date: Mon, 20 Nov 2023 16:41:38 +0100 Message-Id: <20231120154146.920486-2-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang When IO is completed, rtrs can be called in softirq context, unconditionally enabling irq could cause panic. To be on safe side, use spin_lock_irqsave and spin_unlock_irqrestore instread. Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") Signed-off-by: Jack Wang Signed-off-by: Florian-Ewald Mueller Signed-off-by: Md Haris Iqbal Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 75e56604e462..ab4200041fd3 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -65,8 +65,9 @@ static bool rtrs_srv_change_state(struct rtrs_srv_path *srv_path, { enum rtrs_srv_state old_state; bool changed = false; + unsigned long flags; - spin_lock_irq(&srv_path->state_lock); + spin_lock_irqsave(&srv_path->state_lock, flags); old_state = srv_path->state; switch (new_state) { case RTRS_SRV_CONNECTED: @@ -87,7 +88,7 @@ static bool rtrs_srv_change_state(struct rtrs_srv_path *srv_path, } if (changed) srv_path->state = new_state; - spin_unlock_irq(&srv_path->state_lock); + spin_unlock_irqrestore(&srv_path->state_lock, flags); return changed; } From patchwork Mon Nov 20 15:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF2C6C197A0 for ; Mon, 20 Nov 2023 15:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233624AbjKTPl4 (ORCPT ); Mon, 20 Nov 2023 10:41:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbjKTPlz (ORCPT ); Mon, 20 Nov 2023 10:41:55 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B794DC8 for ; Mon, 20 Nov 2023 07:41:51 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-332cb136335so460192f8f.0 for ; Mon, 20 Nov 2023 07:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494910; x=1701099710; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BxRGiPmVuAngoWRt/X13RMIN/CXy2q8KaB8SoYPQuMs=; b=BIwY8e+oIR8BgOpdJ+VfnZq9uCbBCa2A6MgZNXYPglIjmXv9aZVWtnpVFqXIB5fM18 Q700/1xf5hvl/6/lSgQtSccTsbW6rr2+zEFGbIONH4t4KDHS3+DpSp8zSaK4+46+n3DU RnBEpZpu2JGIjhh0aBkiMCghHKdxPb/1eKnioo+qxFjHBzYskFzfBRk+cdDj8vdAZc2Q 8Q/16OPkmshxXcw0tPHUYrDuY188ZdroQUGr3l6/eO2WuUx0qjX3bDP8E7DCDL6kafnS aOTSujfOxMcRVe/gHitdwOnstsdl6IP7LIoi1VqzW9hPorHgFk28nL/0t5aHiy7dPK3j dDKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494910; x=1701099710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BxRGiPmVuAngoWRt/X13RMIN/CXy2q8KaB8SoYPQuMs=; b=Z3U+a1VnLxp+6IfEFL3o0kjSHGqWOR7GLYNexhE03EzLkUb3/CqEa2/nAdPtfKawjQ OQQwPKn0ymP3Ci6dNXpZ2JkIwHt921+3xwfX1UeK8Jajk4kfJXXQ9kIoI0DGM2dqcYrN qqcY7eSAvN8bkUfNkaKzF81ezffRlz4y/nPC59Ke7CWidPHOt4xshKMKTjPRAYYcNEEK rAqsXFN+LapHqN01+HhTXDsvEasnhZFgZ5rqwLgYKoTCpUwAKHFnIgA9xIxvrSJZsx92 wnyUbLM/pCj6voVriI+jxaww4NTrERCHl+Z3OSYhypbpnjPhNe4MdCzwtt7rFSV7D2Zy Ps8w== X-Gm-Message-State: AOJu0Yx13OUtHKRxRLixk2fBikLLPWKboTAVsa5XMboHy3qU7qr4o6Hy Q4VpYoHU+dSJyAW8ukDrpxwMWXFXXRxyhWPxmo0= X-Google-Smtp-Source: AGHT+IEqjmrW9TSMw6hLFpu2aZwFSeuAruAtTPCzcKTJTyZkYDjOi+FlsjPA7U6vUkfJwoD5qlzcJA== X-Received: by 2002:a5d:5f89:0:b0:32d:b06c:80b2 with SMTP id dr9-20020a5d5f89000000b0032db06c80b2mr6075379wrb.0.1700494910230; Mon, 20 Nov 2023 07:41:50 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:49 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Grzegorz Prajsner Subject: [PATCH v2 for-next 2/9] RDMA/rtrs-clt: Start hb after path_up Date: Mon, 20 Nov 2023 16:41:39 +0100 Message-Id: <20231120154146.920486-3-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang If we start hb too early, it will confuse server side to close the session. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Signed-off-by: Jack Wang Reviewed-by: Md Haris Iqbal Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 984a4a1db3c8..83ebd9be760e 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2352,8 +2352,6 @@ static int init_conns(struct rtrs_clt_path *clt_path) if (err) goto destroy; - rtrs_start_hb(&clt_path->s); - return 0; destroy: @@ -2627,6 +2625,7 @@ static int init_path(struct rtrs_clt_path *clt_path) goto out; } rtrs_clt_path_up(clt_path); + rtrs_start_hb(&clt_path->s); out: mutex_unlock(&clt_path->init_mutex); From patchwork Mon Nov 20 15:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 187B1C5AE5B for ; Mon, 20 Nov 2023 15:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233638AbjKTPl5 (ORCPT ); Mon, 20 Nov 2023 10:41:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbjKTPlz (ORCPT ); Mon, 20 Nov 2023 10:41:55 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6899A9F for ; Mon, 20 Nov 2023 07:41:52 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-407c3adef8eso20193175e9.2 for ; Mon, 20 Nov 2023 07:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494911; x=1701099711; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kman/xJLhAuMy1tRZL/AJpioG6x/J/gCqlqLwwKfHac=; b=cXu7qcyvxc/5no1zkhLlzljxCHfbm7vYODoPJwkiCJndSlLq1fhyDMpqSGOc6h7Qfy ruUOjrTPDgwqcG1ayWoBa0gvhjDJK2wf5Xohjp3fGLCF0WstK7hKKPaxo4TI8Ketmqhn X+sKv8VLMU4iDm/zrB6TAz5oqUszrQhSIlQE/y8WURUFa9eA7kcIDqUO35rDDbOQKTw2 GluC1U3oZ7RXn1x42HEE0k+Surr3XMY9hsNxrsNJSztkVW6ORsVdyUr7eWW+l/4Y+yIh AAtuRS83Ot9Ufz5KQnbMPMsPs9VzdNqYofo/fSnO/j4/gVdQjnf8gQBLHK9a9rTp4AfC k4oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494911; x=1701099711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kman/xJLhAuMy1tRZL/AJpioG6x/J/gCqlqLwwKfHac=; b=TT1OL+rANqfX3zVnTpj/eauXYbdG1D5VJCCsj5Cgl+OOKO58joxUsPwXbrjATfC6/e lGpe/EANX4wwCEW2VPRttpAJ9w2ocU6iEjWNRleFGBQWL4fEOKGik0TUfEwAQsqrFOxY akC7VaHMyYzvkM6CHGlqB+AhEmr3hKe5KDMxzDuipUP21aI/sx9+t1ezViILqEYZ9R0Y D7mmbLGJNOp7SIeKSSM02LfjmGOijt1lWS2GjdzmX5VGU7i0G+g0UWfPlO3FetVK/MO5 lrSkPSqFnYvoPr1Ro825b5L+tJcWckYwWg7iZmY9YPudTAjmWhdIrgXld5EHYdtebANq HeOQ== X-Gm-Message-State: AOJu0Yxfj0zB+vHddiAGQXavMIhq0VhGT78Pja6BbVFWvbxwfNpCL1uq Z3yg6VtFOYpuFBX9wZnTr8takFfgZkbK9habKi0= X-Google-Smtp-Source: AGHT+IGS6a587outT8UWxXdlxQp0vB8516WPMvMt5pHJ/Lqa15e/kXbGr5ofgqprLTfKwePF4v+A+g== X-Received: by 2002:a05:6000:156c:b0:32d:9fc9:d14a with SMTP id 12-20020a056000156c00b0032d9fc9d14amr8388396wrz.12.1700494910889; Mon, 20 Nov 2023 07:41:50 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:50 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Grzegorz Prajsner Subject: [PATCH v2 for-next 3/9] RDMA/rtrs-srv: Check return values while processing info request Date: Mon, 20 Nov 2023 16:41:40 +0100 Message-Id: <20231120154146.920486-4-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org While processing info request, it could so happen that the srv_path goes to CLOSING state, cause of any of the error events from RDMA. That state change should be picked up while trying to change the state in process_info_req, by checking the return value. In case the state change call in process_info_req fails, we fail the processing. We should also check the return value for rtrs_srv_path_up, since it sends a link event to the client above, and the client can fail for any reason. Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") Signed-off-by: Md Haris Iqbal Signed-off-by: Jack Wang Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index ab4200041fd3..4be0e5b132d4 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -710,20 +710,23 @@ static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) WARN_ON(wc->opcode != IB_WC_SEND); } -static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path) +static int rtrs_srv_path_up(struct rtrs_srv_path *srv_path) { struct rtrs_srv_sess *srv = srv_path->srv; struct rtrs_srv_ctx *ctx = srv->ctx; - int up; + int up, ret = 0; mutex_lock(&srv->paths_ev_mutex); up = ++srv->paths_up; if (up == 1) - ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL); + ret = ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL); mutex_unlock(&srv->paths_ev_mutex); /* Mark session as established */ - srv_path->established = true; + if (!ret) + srv_path->established = true; + + return ret; } static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path) @@ -852,7 +855,12 @@ static int process_info_req(struct rtrs_srv_con *con, goto iu_free; kobject_get(&srv_path->kobj); get_device(&srv_path->srv->dev); - rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED); + err = rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED); + if (!err) { + rtrs_err(s, "rtrs_srv_change_state(), err: %d\n", err); + goto iu_free; + } + rtrs_srv_start_hb(srv_path); /* @@ -861,7 +869,11 @@ static int process_info_req(struct rtrs_srv_con *con, * all connections are successfully established. Thus, simply notify * listener with a proper event if we are the first path. */ - rtrs_srv_path_up(srv_path); + err = rtrs_srv_path_up(srv_path); + if (err) { + rtrs_err(s, "rtrs_srv_path_up(), err: %d\n", err); + goto iu_free; + } ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, tx_iu->dma_addr, From patchwork Mon Nov 20 15:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20FE9C197A0 for ; Mon, 20 Nov 2023 15:41:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233848AbjKTPl6 (ORCPT ); Mon, 20 Nov 2023 10:41:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232985AbjKTPl5 (ORCPT ); Mon, 20 Nov 2023 10:41:57 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFBBB4 for ; Mon, 20 Nov 2023 07:41:53 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5094cb3a036so6495322e87.2 for ; Mon, 20 Nov 2023 07:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494911; x=1701099711; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pob3bv1VxUk0GJtV3zmJp1DRnvaHALhI3QlwDuZX2QE=; b=h+yzvXeVX/yE+u3LRVaxxPvP5zeUVppuTi4bcHjSsux95N3DTshJStzfbx+hrilZSZ 8AlBZMuBTYGcQmMS9kbWliytrDoMj6ILEgXG5WCpnoSnzLdGIwt05/r7SCEc4p6n8YoC n3tNQ3syt7pB9erRYcglpcGu5as2q5wGMGpzUxLhx7phuS+m4Slf0qsNybJ1QAoUFroV fQa2HH7I5CtQgS3zDYYesA38MgOx/dOpwt2fHFS+dV+2vHd/mPO9rG9/Y5x+vcJUNL6/ bJgNA1Vok7N7zTCyEJSU43eSaUjaOIv8z7T6q0OTIf2UoNcTjyf2kJiOeAsslazyJ0Pm giAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494911; x=1701099711; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pob3bv1VxUk0GJtV3zmJp1DRnvaHALhI3QlwDuZX2QE=; b=IpuYc1lUiyETcj40J8Y7taKmuqAjospRm5DqNPyUGJdDOnmma6zO8oTsccqxGLNPxZ qfFW20HEWlm4wer/FNEtcVIs5JzGogV9iG/y7fXEP/vvywAgMFppJ6KZSOK9QrikvqEl A1qU12TQ/WRlbmFKH5nlJ9liUa2gwL8TrjDjd98adlZw8zKLxDxf8oQgM/420J/RROcx N8hwbegMVDu/CiJC9QqI4dI/z6l3I8ZezDyI8UDyb2eLruNsdPXt6KUlcqZyQdBoS99G 9drjet683fxS56+1/S38KFraTtB5YTZ2UKPMW20O4b/jrFlThxYCd6LzW9Wks6jY12I+ 8tWQ== X-Gm-Message-State: AOJu0Yz+Nsi9lNcPKaXu2Plw8AayUkrnnWmlJR7RHzfqagWA/bVSPDFy ZRUugRfPEiMIpCeBk/fhc+945YTDX8xd0UbxOdI= X-Google-Smtp-Source: AGHT+IHGs259yFSfO1rZg+3oxDooCagY41FTswRXR24BS/PfKwEi7S/n6nZrpxXfzVhwFUv1ljog1Q== X-Received: by 2002:a19:5216:0:b0:509:4916:8b6f with SMTP id m22-20020a195216000000b0050949168b6fmr5388243lfb.37.1700494911618; Mon, 20 Nov 2023 07:41:51 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:51 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Grzegorz Prajsner Subject: [PATCH v2 for-next 4/9] RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true Date: Mon, 20 Nov 2023 16:41:41 +0100 Message-Id: <20231120154146.920486-5-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Since srv_mr->iu is allocated and used only when always_invalidate is true, free it only when always_invalidate is true. Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") Signed-off-by: Md Haris Iqbal Signed-off-by: Jack Wang Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 4be0e5b132d4..925b71481c62 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -551,7 +551,10 @@ static void unmap_cont_bufs(struct rtrs_srv_path *srv_path) struct rtrs_srv_mr *srv_mr; srv_mr = &srv_path->mrs[i]; - rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); + + if (always_invalidate) + rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); + ib_dereg_mr(srv_mr->mr); ib_dma_unmap_sg(srv_path->s.dev->ib_dev, srv_mr->sgt.sgl, srv_mr->sgt.nents, DMA_BIDIRECTIONAL); From patchwork Mon Nov 20 15:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BBCCC2BB3F for ; Mon, 20 Nov 2023 15:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233928AbjKTPl7 (ORCPT ); Mon, 20 Nov 2023 10:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233758AbjKTPl5 (ORCPT ); Mon, 20 Nov 2023 10:41:57 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D502E9F for ; Mon, 20 Nov 2023 07:41:53 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40842752c6eso17350075e9.1 for ; Mon, 20 Nov 2023 07:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494912; x=1701099712; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k631je87x0ywnHSe3oqxeCpwviu14/Fn3Uc7rjWzxlY=; b=IfQDf9kBZrxnyUALKdQ+aL6BFTxdfwJXeUBXPzICYoJnBmi/MhNvObrZdQIVmyysoj NFwnG95uKEgZ2ui/2JDCaDn+MLs/E8Dg5/+8Ozg5auzWBqCKl/JB4pknVujdoE8fm5jT zvNtxd9xUMGp9zo8Ih/A1XrOMThrzyj8dTx8HuW8Q9TKq6H/lb9SHvOG3vXylS4guJCH jgbTmfes3MSqbkFLNEPlPG00oSGayOgc2Asl4/CSlC9WahbjNHGP5TSISF0Fmr7HDm4Y I3ELG8rWityXFwi11cIG2k3EK6y4gsUNb2CJe6rzYmqG6LuiRal3mhspH8NwuTN8gglq bOWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494912; x=1701099712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k631je87x0ywnHSe3oqxeCpwviu14/Fn3Uc7rjWzxlY=; b=js4q8+EoYAVYSmbZB+C5sL6geDH7YoPtiLUUv/cFMnfoLjAmqgaVJonnuPLQd/j8Y/ yBjNBuAx+SJyd18xlk6Eyo0eA0ZmFwWDRfqAi9nLuNyTCNgq+LB7AUktBeo8ows7t3QV 8LDBdjtZujMLR6CqnDCVQY7WTkOsLoz8jakbhGkBFUSHrRTgnzOu3KBzAudQVv67wW7G 1ANYG4OgY+xqIpPaA1IfbZQODxBFKqDry+PQndQdGDa77OzMSsojNa7qq2H0imw1iVdO iBQTKTKr1IeOfD9Pmi4bEvQCKy1umFxvQ/XS+CTSyWU9UYVELfm4XpzTkNktdU+Fetsv 5oyw== X-Gm-Message-State: AOJu0YwhhAFFBbNOOfYPwfkufyDjTuIZ7J4ZXJfmG83YwDOUH/oTpyWq 9cG/o5k+6ZDTImVQ9ZjDMS6sSH/FyUL/SLkf1bc= X-Google-Smtp-Source: AGHT+IEW+vhh457LEMUsasUI091vwtshAu2xdsQKt8fLn3rxX4vqOia2R2CoL9lutrozloU5i/ZIAg== X-Received: by 2002:a5d:498f:0:b0:32f:7901:c462 with SMTP id r15-20020a5d498f000000b0032f7901c462mr4860850wrq.3.1700494912378; Mon, 20 Nov 2023 07:41:52 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:52 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Santosh Kumar Pradhan , Grzegorz Prajsner Subject: [PATCH v2 for-next 5/9] RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight Date: Mon, 20 Nov 2023 16:41:42 +0100 Message-Id: <20231120154146.920486-6-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Destroying path files may lead to the freeing of rdma_stats. This creates the following race. An IO is in-flight, or has just passed the session state check in process_read/process_write. The close_work gets triggered and the function rtrs_srv_close_work() starts and does destroy path which frees the rdma_stats. After this the function process_read/process_write resumes and tries to update the stats through the function rtrs_srv_update_rdma_stats This commit solves the problem by moving the destroy path function to a later point. This point makes sure any inflights are completed. This is done by qp drain, and waiting for all in-flights through ops_id. Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality") Signed-off-by: Md Haris Iqbal Signed-off-by: Santosh Kumar Pradhan Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 925b71481c62..1d33efb8fb03 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -1532,7 +1532,6 @@ static void rtrs_srv_close_work(struct work_struct *work) srv_path = container_of(work, typeof(*srv_path), close_work); - rtrs_srv_destroy_path_files(srv_path); rtrs_srv_stop_hb(srv_path); for (i = 0; i < srv_path->s.con_num; i++) { @@ -1552,6 +1551,8 @@ static void rtrs_srv_close_work(struct work_struct *work) /* Wait for all completion */ wait_for_completion(&srv_path->complete_done); + rtrs_srv_destroy_path_files(srv_path); + /* Notify upper layer if we are the last path */ rtrs_srv_path_down(srv_path); From patchwork Mon Nov 20 15:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B76DFC5AE5B for ; Mon, 20 Nov 2023 15:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234004AbjKTPl7 (ORCPT ); Mon, 20 Nov 2023 10:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233878AbjKTPl6 (ORCPT ); Mon, 20 Nov 2023 10:41:58 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F95A7 for ; Mon, 20 Nov 2023 07:41:54 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso2949624f8f.2 for ; Mon, 20 Nov 2023 07:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494913; x=1701099713; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WXPmJMkioa/Lt/uDsbu9HL2/rHo4GFujuqmlR3mwNy4=; b=PZt1Lm7yj+UHfD8kC9zfHok6DL//n63AyRPGPtuvHDtEojLiPB9ntBMKHzNpOV30Lm Om0jtePZsYZ61xZcpBDf5C4voCN2/1BfXfqwUDZTLXKCahgJuj+D1nvhXefpF7aUniQf FBdQj9ZGy/jottrIavaBNwqsd/L7JQLh2EfhAm70vM34wOgtboBWyKHGiXw07G6KeE43 nVgemP7vcuwJw+SZEEt4/y0sGZYxcdPzFULBy1JYw+lVn/UA8WLWTDsf+HMIaS8rVCV2 oikpwSxvuuNi4ZReD1YPYW/RwTwlK1m1inkPc/BlBh/IXvAV/QVnzzzr1eQxSx6RJa0X AfeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494913; x=1701099713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WXPmJMkioa/Lt/uDsbu9HL2/rHo4GFujuqmlR3mwNy4=; b=FvK0Z0K7lCtqVH91iIEPR4uOJD/YFqoMS7xxprWY/AmC/24DplJa7BGJzQMJNuAwgE lx9WeLG7ZU/ve1tPFS2lIN307CjOwV9ST6UnD5GdQdmwzBn/YCxse8zrW2A/oqJteyX1 i89fD83Y3nduo+WS3zUYEumIAZjss3oPKteNhbEf+QrAdkI0ol+L0aMrJ0K2P8rEw84O EQLQ0jMHXss5nXSy1683QDVysXYirgpWgjErgkmxpxzHpEv+WT9neM6QgNHYqNLeThEN LifEIiIePHsrKCj2IYOI08SFSltJxs7TSV66+JJG2bMuedZ45fMtpJLF4/k1Pb7f49MF GbXQ== X-Gm-Message-State: AOJu0YwShhUw78SGf1/HZs3EDTPuQmF5tHaCf3ys7MrFjQ1wZSTpJaAS w75zaHOBcjVRChFSKEVyQy7YqR3F9OYYKmLuanw= X-Google-Smtp-Source: AGHT+IFXeM9mnu7GKrPNUF6ejSVC/2MH3vb0DWilDGuIbfuvH8PwICuQDtDsi6ckWsltund8Qc+tsg== X-Received: by 2002:a05:6000:1001:b0:331:34c1:7a0 with SMTP id a1-20020a056000100100b0033134c107a0mr4904311wrx.57.1700494912991; Mon, 20 Nov 2023 07:41:52 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:52 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Grzegorz Prajsner Subject: [PATCH v2 for-next 6/9] RDMA/rtrs-clt: Fix the max_send_wr setting Date: Mon, 20 Nov 2023 16:41:43 +0100 Message-Id: <20231120154146.920486-7-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang For each write request, we need Request, Response Memory Registration, Local Invalidate. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Signed-off-by: Jack Wang Reviewed-by: Md Haris Iqbal Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 83ebd9be760e..df10d29c3fe9 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1699,7 +1699,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) clt_path->s.dev_ref++; max_send_wr = min_t(int, wr_limit, /* QD * (REQ + RSP + FR REGS or INVS) + drain */ - clt_path->queue_depth * 3 + 1); + clt_path->queue_depth * 4 + 1); max_recv_wr = min_t(int, wr_limit, clt_path->queue_depth * 3 + 1); max_send_sge = 2; From patchwork Mon Nov 20 15:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E860C197A0 for ; Mon, 20 Nov 2023 15:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233480AbjKTPmA (ORCPT ); Mon, 20 Nov 2023 10:42:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233712AbjKTPl7 (ORCPT ); Mon, 20 Nov 2023 10:41:59 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24691B4 for ; Mon, 20 Nov 2023 07:41:55 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32d9d8284abso3019033f8f.3 for ; Mon, 20 Nov 2023 07:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494913; x=1701099713; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3izQq9XBdcyZonK9bU/62x0R62gqYmTfTwWEQOim/08=; b=OFRHVgm1e8IQavk6ogVcZuf3/U/xgFzweEeendkJK9nL7i15MBGRcDPdiEZUM+Ke29 7Nv+150c+Imi/tWxYn+qgQP6VWJaZyCIHqrpTQ3EO4OioqXsdQ1aHX7bOfA9/Kl5sgy8 gAiMT5F21S3ZMg7+VxCiLfWStdMKdQqEcMDtMijSomG9Xdk3OsaCJOD4UB0vGhe4HA85 RW0GYA4OKMnZA4hN2ssga8GZowXW4Ng/3RUN4zUnGLqVDz0aK1xYtzYRXJXK0GI58Mh0 2+tjsadEGbc77CFLgJceemlKFx8Or3gfXPePDo2NbEoNgwjrXKxQVdsnjjJW5dePu+Zv cH2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494913; x=1701099713; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3izQq9XBdcyZonK9bU/62x0R62gqYmTfTwWEQOim/08=; b=H4yQ8FMdc8jVmoAFxWNmoanmv1kx0ngOBOCDcLce1xmqlMSRMOJ1UJQp71easLcOs8 fLaI5laTtcl+QHSIKPwchG9+s69gk35/tGy43qHwfKqQWPHr9KTMUn+K584pSnT+UPtl 6D41WXms5OYcSAls5Rt2+uTMZ7D8pO7gOnk/kmL99VjcUQ6yKSYd9CwI04yhCcRCBH88 yOZ+x/p+JZBx5dhs0nhqcFyXFHQPVmYrP6QQXpidlggW51PQSDkHr3XHVtAhYoxLZHE+ NXHKt58w+UJiAwu4jv7Uijyf+QuBVEVyVJfF1DXoHmnStP8WBCmX3LMfkbvV685riVvL 8+PA== X-Gm-Message-State: AOJu0Yzp8/pXUisTcUJt6YEASQfNK/HW3vsvvAMKwc74qHLEd7kiG6a8 IZA6+5ttjR1piERXLbI787KENuHURcqjQhgG+To= X-Google-Smtp-Source: AGHT+IGKDpNdG7hq6UJ+WDHZhI1IYOH4b/Li15FKjXgyf6cm9txQPPbaV7yGg7/KZ8BU6XE1rakw7A== X-Received: by 2002:a5d:64c6:0:b0:32d:b2cf:8ccd with SMTP id f6-20020a5d64c6000000b0032db2cf8ccdmr6718690wri.47.1700494913629; Mon, 20 Nov 2023 07:41:53 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:53 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Grzegorz Prajsner Subject: [PATCH v2 for-next 7/9] RDMA/rtrs-clt: Remove the warnings for req in_use check Date: Mon, 20 Nov 2023 16:41:44 +0100 Message-Id: <20231120154146.920486-8-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Jack Wang As we chain the WR during write request: memory registration, rdma write, local invalidate, if only the last WR fail to send due to send queue overrun, the server can send back the reply, while client mark the req->in_use to false in case of error in rtrs_clt_req when error out from rtrs_post_rdma_write_sg. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Signed-off-by: Jack Wang Reviewed-by: Md Haris Iqbal Signed-off-by: Grzegorz Prajsner --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index df10d29c3fe9..8c5054d18402 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -384,7 +384,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *req, int errno, struct rtrs_clt_path *clt_path; int err; - if (WARN_ON(!req->in_use)) + if (!req->in_use) return; if (WARN_ON(!req->con)) return; From patchwork Mon Nov 20 15:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F35EBC5AE5C for ; Mon, 20 Nov 2023 15:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233712AbjKTPmB (ORCPT ); Mon, 20 Nov 2023 10:42:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbjKTPl7 (ORCPT ); Mon, 20 Nov 2023 10:41:59 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC1F9F for ; Mon, 20 Nov 2023 07:41:55 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-332c82400a5so682639f8f.0 for ; Mon, 20 Nov 2023 07:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494914; x=1701099714; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KSBtncvVFIAjcOQx6vcGK234wY6nleJLXfqV+dBrwBU=; b=a0RfQbkht0B0YxJD6z/m6swwAHCrdXBuiTF50W5xJceAY4S5dStpvR/ZzfK5lt88gk 9YvGg4794lMrrZkhuYEY58LNOmfhcTnUt/mSage2FeFIbBwxjlQyvtzJ9TPNilWOTxqo Ly6Q1pjqN692fDxSUGGUj/VDgghUHdDojBggG1NVphctvj7EhJvS3uVuOK2pIHhlTdlx pnkd+JGZxb9iGeRhjmCnqOsawTvAupUMvXrJVi15/eWAiiWUYYs4CpLf4ao5m9UqlHZe FoB15r2J8B84hu0cV66lvI+/heIDDbzrB34ZfiJ9yCISKuWUbsLxo8gUdYkB1eMvLyYG JDYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494914; x=1701099714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KSBtncvVFIAjcOQx6vcGK234wY6nleJLXfqV+dBrwBU=; b=T5dckTDTToBWzpsr2se1dw7r0feK8c8jUnzwyzO+sf+HnA9aZDSIhTHw/OvyMikTat TkO3+SJvqemAaNW8t92NKoh5j6xmf+ZaXB6yVoiRx9pgPMwleGbb86Tw/LaFwf4pDowZ qdZevr+RHysC5UPqitDBnhZ/bCU5k9WED66X/pL54rj+8pR6zTFrkAA00A9a7PWOyWob oSzlONSdUs9SBSQoZeJlo0Hhh++UUuR/fKRWQWwDrY/RgAeTfpErHqY84xqBF63AiFr7 8uGnPyKwMxbGbKHTgOigwT601zkMwvbOgZwtvJThfCj3C56+/netIkiIkWQBRFJvJEBO NYCA== X-Gm-Message-State: AOJu0YyoeyuaFVXaSRlBUZ7EKoevfNblyquXJSLdJlw2PWjcPhs99x3r 5Z31dpWXtpKGK37YuoBlYApY10OD2w91OOl1afs= X-Google-Smtp-Source: AGHT+IFRBfzMl/3CzwSrSwfmmtMP4F/Xc657bjbeY6uwGYZD7PuTwRd0QBk47w9y++yjBuTh1Ni2kg== X-Received: by 2002:adf:fc4f:0:b0:32f:7cea:2ea1 with SMTP id e15-20020adffc4f000000b0032f7cea2ea1mr4862723wrs.18.1700494914331; Mon, 20 Nov 2023 07:41:54 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:54 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Supriti Singh , Grzegorz Prajsner Subject: [PATCH v2 for-next 8/9] RDMA/rtrs-clt: use %pe to print errors Date: Mon, 20 Nov 2023 16:41:45 +0100 Message-Id: <20231120154146.920486-9-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Supriti Singh While printing error, replace %ld by %pe. %pe prints a string whereas %ld would print an error code. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Signed-off-by: Supriti Singh Signed-off-by: Jack Wang Signed-off-by: Grzegorz Prajsner Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 8c5054d18402..493efbba2fe3 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1391,9 +1391,9 @@ static int alloc_path_reqs(struct rtrs_clt_path *clt_path) clt_path->max_pages_per_mr); if (IS_ERR(req->mr)) { err = PTR_ERR(req->mr); + pr_err("Failed to alloc clt_path->max_pages_per_mr %d: %pe\n", + clt_path->max_pages_per_mr, req->mr); req->mr = NULL; - pr_err("Failed to alloc clt_path->max_pages_per_mr %d\n", - clt_path->max_pages_per_mr); goto out; } @@ -2061,7 +2061,7 @@ static int create_cm(struct rtrs_clt_con *con) RDMA_PS_IB : RDMA_PS_TCP, IB_QPT_RC); if (IS_ERR(cm_id)) { err = PTR_ERR(cm_id); - rtrs_err(s, "Failed to create CM ID, err: %d\n", err); + rtrs_err(s, "Failed to create CM ID, err: %pe\n", cm_id); return err; } From patchwork Mon Nov 20 15:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haris Iqbal X-Patchwork-Id: 13461540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE063C2BB3F for ; Mon, 20 Nov 2023 15:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234080AbjKTPmC (ORCPT ); Mon, 20 Nov 2023 10:42:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234056AbjKTPmA (ORCPT ); Mon, 20 Nov 2023 10:42:00 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E748E8 for ; Mon, 20 Nov 2023 07:41:56 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32fb190bf9bso3367692f8f.1 for ; Mon, 20 Nov 2023 07:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1700494915; x=1701099715; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mqt4fMWcJnFqkRrUUz0aUqIPI3sm4QD1GNMIR/9PVwY=; b=WWRdsrtptwTokqyRRGbOE7WnfKxXwxq3ClH7vNfLi4UZ8gMMRouvCN1KD1nsdUImEn 4gPlQJhHvzLFFTFIg4vjSRlztUnHP82u35W/37vYrfAmAl1INEVwzDGx5q1MTmCO8nuT qzYbTvF2rBRA/sz7sRe1HkWlE7XMmHgJnyi/14a+qGAR0FhhoHvjtwH1Qah8GUIzwKKx UkJdimCRCLQLHeMBQafYt+S7YX0XOTKE5i3jU70Bz20C3WvCwSnK9VMdQmFE+vzvKEm1 1ThpzBrvyXVqwqJpl5y9BUiyClZzRPOgYg1wWPhaCpp3hs3nrjOwGLy1yKA+RL3ZG64x eDrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700494915; x=1701099715; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mqt4fMWcJnFqkRrUUz0aUqIPI3sm4QD1GNMIR/9PVwY=; b=blor22FmnctXJ7XIHUSjURQjAhd9vNYoD3eZXHBxvtlkmU9JGNB0SAOx3Cq2hvaP7w h0ZtQP33LCS8eLxfzPcOshH0h/jONvoKC9dQbMLTUNM6JT9T0jba8hiS6qIXaIi9uB5O TX5ptAIbnF2hyx/1uyO5TkFtR/rnrWWSub2sNe3pYMiFab4EObWqGqbbTeSehujbRgtY tYwDfSdvj6q1oz1/4ahcSVs/LWP/0Wx6mmW75gYTT6YndWoVJaYgs9AR/qUvLv3siaoV 1HP5e9ri+i9xxAZ7bQMokYna/cR0oE5H1CCJ7hol3NKGMM9pf2jgTLdLtmk1mGz4egAp aT4g== X-Gm-Message-State: AOJu0YxfN35LHJF5m3V0pt1A6WZtLD5gEnrET+U71/Ri+0B684Vk5SuO euaKFFzH8tRGGaCxAH5Xcz0MVWQsmfew82uaHb0= X-Google-Smtp-Source: AGHT+IGFCR8gtMaeeZtjJ8nPjDmkP9GDlGMciy31uYk0KYgANeGos+EOYoPDITwFslzxTLfwIYgrRA== X-Received: by 2002:a05:6000:1ac7:b0:332:c542:287c with SMTP id i7-20020a0560001ac700b00332c542287cmr3904235wry.4.1700494915000; Mon, 20 Nov 2023 07:41:55 -0800 (PST) Received: from lb01533.fkb.profitbricks.net (p200300f00f4ce2a470fb6777c650c5ae.dip0.t-ipconnect.de. [2003:f0:f4c:e2a4:70fb:6777:c650:c5ae]) by smtp.gmail.com with ESMTPSA id k6-20020a5d66c6000000b0031c52e81490sm11611461wrw.72.2023.11.20.07.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:41:54 -0800 (PST) From: Md Haris Iqbal To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com, jinpu.wang@ionos.com, Supriti Singh , Grzegorz Prajsner Subject: [PATCH v2 for-next 9/9] RDMA/rtrs: use %pe to print errors Date: Mon, 20 Nov 2023 16:41:46 +0100 Message-Id: <20231120154146.920486-10-haris.iqbal@ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com> References: <20231120154146.920486-1-haris.iqbal@ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Supriti Singh While printing error, replace %ld by %pe. %pe prints a string whereas %ld would print an error code. Fixes: c0894b3ea69d ("RDMA/rtrs: core: lib functions shared between client and server modules") Signed-off-by: Supriti Singh Signed-off-by: Jack Wang Signed-off-by: Grzegorz Prajsner Signed-off-by: Md Haris Iqbal --- drivers/infiniband/ulp/rtrs/rtrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c index d80edfffd2e4..4e17d546d4cc 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -242,8 +242,8 @@ static int create_cq(struct rtrs_con *con, int cq_vector, int nr_cqe, cq = ib_cq_pool_get(cm_id->device, nr_cqe, cq_vector, poll_ctx); if (IS_ERR(cq)) { - rtrs_err(con->path, "Creating completion queue failed, errno: %ld\n", - PTR_ERR(cq)); + rtrs_err(con->path, "Creating completion queue failed, errno: %pe\n", + cq); return PTR_ERR(cq); } con->cq = cq;