From patchwork Mon May 16 01:53:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 12850202 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 E71A2C4332F for ; Mon, 16 May 2022 01:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239133AbiEPBq6 (ORCPT ); Sun, 15 May 2022 21:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239117AbiEPBq4 (ORCPT ); Sun, 15 May 2022 21:46:56 -0400 Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 97604389D; Sun, 15 May 2022 18:46:53 -0700 (PDT) IronPort-Data: A9a23:uBVEa6tABzRGI97eN2E8s4slTOfnVMJcMUV32f8akzHdYEJGY0x3zDcZXGuPOfuKYGr1L9t1Poix/ExVvZ7UydZnTgc9/n1gHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x/RGQ6YnSHuCmULScY3goLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1JtI6wSAUoN6vklvkfUgVDDmd1OqguFLrveCLj65HLkxOcG5fr67A0ZK0sBqUT+utxDnBJ6NQcKTYQflaKg+O8ybiyDOJrg6wLPcDtPp4Z/GNg0BndDPA7UdbPTruizd9R1TQ3gIZEAPnRauIeczNkaBmGaBpKUn8TCZQjjKKri2P5fjlwtl2Yv+w07nLVwQg316LiWPLRe9qXVYBPkkORjnzJ8n6/ARwAMtGbjz2f/RqEhODAtTH6VZofUraxnsOGKnX7Knc7UUVQDAXk56LizBPWZj6WEGRMkgJGkET43BbDogHBYiCF IronPort-HdrOrdr: A9a23:Sq0e66APbnz//iHlHemQ55DYdb4zR+YMi2TDtnoBLSC9F/b0qynAppomPGDP4gr5NEtApTniAtjkfZq/z+8X3WB5B97LMzUO01HYTr2Kg7GD/xTQXwX69sN4kZxrarVCDrTLZmRSvILX5xaZHr8brOW6zA== X-IronPort-AV: E=Sophos;i="5.88,333,1635177600"; d="scan'208";a="124250462" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 May 2022 09:46:50 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 5AF6B4D68A23; Mon, 16 May 2022 09:46:45 +0800 (CST) Received: from G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 16 May 2022 09:46:43 +0800 Received: from localhost.localdomain (10.167.225.141) by G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Mon, 16 May 2022 09:46:46 +0800 From: Li Zhijian To: Yanjun Zhu , Jason Gunthorpe , "Haakon Bugge" , Cheng Xu , CC: , Li Zhijian Subject: [PATCH v3 1/2] RDMA/rxe: Update wqe_index for each wqe error completion Date: Mon, 16 May 2022 09:53:28 +0800 Message-ID: <20220516015329.445474-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220516015329.445474-1-lizhijian@fujitsu.com> References: <20220516015329.445474-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 5AF6B4D68A23.AE324 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lizhijian@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Previously, if user space keeps sending abnormal wqe, queue.prod will keep increasing while queue.index doesn't. Once queue.index==queue.prod in next round, req_next_wqe() will treat queue as empty. In such case, no new completion would be generated. Update wqe_index for each wqe completion so that req_next_wqe() can get next wqe properly. Signed-off-by: Li Zhijian --- drivers/infiniband/sw/rxe/rxe_req.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index a0d5e57f73c1..8bdd0b6b578f 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -773,6 +773,8 @@ int rxe_requester(void *arg) if (ah) rxe_put(ah); err: + /* update wqe_index for each wqe completion */ + qp->req.wqe_index = queue_next_index(qp->sq.queue, qp->req.wqe_index); wqe->state = wqe_state_error; __rxe_do_task(&qp->comp.task); From patchwork Mon May 16 01:53:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 12850201 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 D530EC433EF for ; Mon, 16 May 2022 01:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239125AbiEPBq5 (ORCPT ); Sun, 15 May 2022 21:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239111AbiEPBq4 (ORCPT ); Sun, 15 May 2022 21:46:56 -0400 Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 32886389E; Sun, 15 May 2022 18:46:54 -0700 (PDT) IronPort-Data: A9a23:M+o5x6/wV6F32GYsfiaPDrUDFHyTJUtcMsCJ2f8bfWQNrUp3hD0CmzdLWGjUafjca2LyKY12OYi3/BsC7ZLdx4I2GldlrnsFo1Bi85ScXYvDRqvT04J+FuWaFQQ/qZx2huDodKjYdVeB4Ef9WlTdhSMkj/vQHOKlULes1h1ZHmeIdg9w0HqPpMZp2uaEsfDha++8kYuaT//3YTdJ6BYoWo4g0J9vnTs01BjEVJz0iXRlDRxDlAe2e3D4l/vzL4npR5fzatE88uJX24/+IL+FEmPxp3/BC/uulPD1b08LXqXPewOJjxK6WYD72l4b+HN0if19aZLwam8O49mNt9Rw2tVMt525Ty8nI6/NhP8AFRJfFkmSOIUfouOdfCDj75f7I0ruNiGEL+9VJEo2MIsX6+FqKWVP8+EIbjkJbxqKjevwy7W+IsF9j8IhMc+tLoMCknVhyyzJS/orX/jrQ6zD5themj0tic9DNfHEbsEdZHxkaxGoSxlOPEoHTZEzhuGlglHhfDBC7lGYv6w65y7U1gMZ+LzsNsfFP8aGQMx9gEmVvCTF8n7/DxVcM8aQoRKH/X2ElO7ChS69U4t6KVES3paGm3XKnipKVkJQDgD9/JGEZoeFc4o3AyQpFuAG98DeLHCWc+Q= IronPort-HdrOrdr: A9a23:7YLr76ph+apSaKbcm3opM9IaV5oXeYIsimQD101hICG9E/bo8/xG+c536faaslgssQ4b8+xoVJPgfZq+z+8R3WByB8bAYOCOggLBQ72KhrGSoQEIdRefysdtkY9kc4VbTOb7FEVGi6/BizWQIpINx8am/cmT6dvj8w== X-IronPort-AV: E=Sophos;i="5.88,333,1635177600"; d="scan'208";a="124250463" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 May 2022 09:46:50 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id DFD334D68A24; Mon, 16 May 2022 09:46:45 +0800 (CST) Received: from G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 16 May 2022 09:46:47 +0800 Received: from localhost.localdomain (10.167.225.141) by G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Mon, 16 May 2022 09:46:47 +0800 From: Li Zhijian To: Yanjun Zhu , Jason Gunthorpe , "Haakon Bugge" , Cheng Xu , CC: , Li Zhijian Subject: [PATCH v3 2/2] RDMA/rxe: Generate error completion for error requester QP state Date: Mon, 16 May 2022 09:53:29 +0800 Message-ID: <20220516015329.445474-3-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220516015329.445474-1-lizhijian@fujitsu.com> References: <20220516015329.445474-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: DFD334D68A24.AF984 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lizhijian@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org As per IBTA specification, all subsequent WQEs while QP is in error state should be completed with a flush error. Here we check QP_STATE_ERROR after req_next_wqe() so that rxe_completer() has chance to be called where it will set CQ state to FLUSH ERROR and the completion can associate with its WQE. Signed-off-by: Li Zhijian --- V3: unlikely() optimization # Cheng Xu update commit log # Haakon Bugge --- drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 8bdd0b6b578f..c1f1c19f26b2 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -624,7 +624,7 @@ int rxe_requester(void *arg) rxe_get(qp); next_wqe: - if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) + if (unlikely(!qp->valid)) goto exit; if (unlikely(qp->req.state == QP_STATE_RESET)) { @@ -646,6 +646,14 @@ int rxe_requester(void *arg) if (unlikely(!wqe)) goto exit; + if (unlikely(qp->req.state == QP_STATE_ERROR)) { + /* + * Generate an error completion so that user space is able to + * poll this completion. + */ + goto err; + } + if (wqe->mask & WR_LOCAL_OP_MASK) { ret = rxe_do_local_ops(qp, wqe); if (unlikely(ret))