From patchwork Fri Aug 18 08:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 13357463 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 559FAC71136 for ; Fri, 18 Aug 2023 08:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355634AbjHRIXs (ORCPT ); Fri, 18 Aug 2023 04:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358563AbjHRIXd (ORCPT ); Fri, 18 Aug 2023 04:23:33 -0400 Received: from out-49.mta0.migadu.com (out-49.mta0.migadu.com [91.218.175.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E192E2684 for ; Fri, 18 Aug 2023 01:23:31 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692347010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jUeWjMC+Lt4smGefr0Lcat/Rgc4mAkUbEeVW6uOHdVY=; b=DKd8wzcnQVsDgLZ9kHnL+oktKM4TVEbKJOseVRT+wNF5UpTxMC3y8JxNXqOSoViBM2zCxM JD43PgEFid9gr/Ythfdcno+xk7ptctApjFD3Oj4WTflFiJNnAT5M8ZslJ7czWKFh9x4GXh 1mIT4kq5YogWtOAio9x5q31iWi8MdCQ= From: Guoqing Jiang To: bmt@zurich.ibm.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org Subject: [PATCH 1/3] RDMA/siw: Balance the reference of cep->kref in the error path Date: Fri, 18 Aug 2023 16:23:16 +0800 Message-Id: <20230818082318.17489-2-guoqing.jiang@linux.dev> In-Reply-To: <20230818082318.17489-1-guoqing.jiang@linux.dev> References: <20230818082318.17489-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org The siw_connect can go to err in below after cep is allocated successfully: 1. If siw_cm_alloc_work returns failure. In this case socket is not assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc. We need to call siw_cep_put twice since cep->kref is increased once after it was initialized. 2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get and when associate socket with cep after it was initialized. So we need to call siw_cep_put three times (one in siw_socket_disassoc). 3. siw_send_mpareqrep returns error, this scenario is similar as 2. So we need to remove one siw_cep_put in the error path. Signed-off-by: Guoqing Jiang --- drivers/infiniband/sw/siw/siw_cm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c index da530c0404da..a2605178f4ed 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -1501,7 +1501,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->cm_id = NULL; id->rem_ref(id); - siw_cep_put(cep); qp->cep = NULL; siw_cep_put(cep); From patchwork Fri Aug 18 08:23:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 13357461 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 447BAC001DE for ; Fri, 18 Aug 2023 08:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358555AbjHRIXs (ORCPT ); Fri, 18 Aug 2023 04:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358565AbjHRIXe (ORCPT ); Fri, 18 Aug 2023 04:23:34 -0400 Received: from out-6.mta0.migadu.com (out-6.mta0.migadu.com [IPv6:2001:41d0:1004:224b::6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458BF123 for ; Fri, 18 Aug 2023 01:23:32 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692347011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5M4QXE5ozUxDPBFnbphCS0MPQSlJU0iFr+8QwMweGyU=; b=HDsb0ny8Ox3uS0yhY/Im96B4Ow3MwtplvcjLKLM4M9TFkK6ItwPgER3toX0pZ7C5btt0a5 RFGQw21vlLSkzlPjofIbXKM99uHzmk/ez37LbsDuXAwr4jUc4rEbk4zhnxmrsyzrVtd7qr mCvzbL3w6Snias93VIpwnfaP7BE6+TQ= From: Guoqing Jiang To: bmt@zurich.ibm.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org Subject: [PATCH 2/3] RDMA/siw: Correct wrong debug message Date: Fri, 18 Aug 2023 16:23:17 +0800 Message-Id: <20230818082318.17489-3-guoqing.jiang@linux.dev> In-Reply-To: <20230818082318.17489-1-guoqing.jiang@linux.dev> References: <20230818082318.17489-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org We need to print num_sle first then pbl->max_buf per the condition. Also replace mem->pbl with pbl while at it. Signed-off-by: Guoqing Jiang --- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c index fadfa70853f3..fdbef3254e30 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.c +++ b/drivers/infiniband/sw/siw/siw_verbs.c @@ -1494,7 +1494,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle, if (pbl->max_buf < num_sle) { siw_dbg_mem(mem, "too many SGE's: %d > %d\n", - mem->pbl->max_buf, num_sle); + num_sle, pbl->max_buf); return -ENOMEM; } for_each_sg(sl, slp, num_sle, i) { From patchwork Fri Aug 18 08:23:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 13357460 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 34753C678DC for ; Fri, 18 Aug 2023 08:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358559AbjHRIXt (ORCPT ); Fri, 18 Aug 2023 04:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358566AbjHRIXf (ORCPT ); Fri, 18 Aug 2023 04:23:35 -0400 Received: from out-31.mta0.migadu.com (out-31.mta0.migadu.com [IPv6:2001:41d0:1004:224b::1f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D191FCE for ; Fri, 18 Aug 2023 01:23:34 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692347013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rRki0neaLhGc5OKgebMQ5Pv0WmLXmG+LIJlZ1oBAIeY=; b=Xt+hJ8+v3cLD4MJrGptDPfmuoDU2Nk0Z0YKjWJR0eXp58UyzTXOtOGj5dpju2gtZ1RR+wQ 8Xya3KzBAAhzzL+0WjJtv/CZ6vf6a7oT4AImCcBsJKutiBSoc5tUTpHzf3yAu+whoJOlvg 2tMdppLWUsfEq+XMY4LOGHWQ9foQ5s8= From: Guoqing Jiang To: bmt@zurich.ibm.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org Subject: [PATCH 3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq Date: Fri, 18 Aug 2023 16:23:18 +0800 Message-Id: <20230818082318.17489-4-guoqing.jiang@linux.dev> In-Reply-To: <20230818082318.17489-1-guoqing.jiang@linux.dev> References: <20230818082318.17489-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org We can call the function to get fifo list. Signed-off-by: Guoqing Jiang --- drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c index 3ff339eceec3..11b208a2d12a 100644 --- a/drivers/infiniband/sw/siw/siw_qp_tx.c +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c @@ -1267,17 +1267,7 @@ int siw_run_sq(void *data) break; active = llist_del_all(&tx_task->active); - /* - * llist_del_all returns a list with newest entry first. - * Re-order list for fairness among QP's. - */ - while (active) { - struct llist_node *tmp = active; - - active = llist_next(active); - tmp->next = fifo_list; - fifo_list = tmp; - } + fifo_list = llist_reverse_order(active); while (fifo_list) { qp = container_of(fifo_list, struct siw_qp, tx_list); fifo_list = llist_next(fifo_list);