From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F550C433EF for ; Wed, 11 May 2022 03:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239618AbiEKDoX (ORCPT ); Tue, 10 May 2022 23:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiEKDoN (ORCPT ); Tue, 10 May 2022 23:44:13 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8499B183; Tue, 10 May 2022 20:44:11 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R651e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=chengyou@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VCu1bA1_1652240648; Received: from 30.43.105.194(mailfrom:chengyou@linux.alibaba.com fp:SMTPD_---0VCu1bA1_1652240648) by smtp.aliyun-inc.com(127.0.0.1); Wed, 11 May 2022 11:44:09 +0800 Message-ID: Date: Wed, 11 May 2022 11:44:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v2 2/2] RDMA/rxe: Generate error completion for error requester state Content-Language: en-US To: Li Zhijian , Zhu Yanjun , Jason Gunthorpe , linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20220511023030.229212-1-lizhijian@fujitsu.com> <20220511023030.229212-3-lizhijian@fujitsu.com> From: Cheng Xu In-Reply-To: <20220511023030.229212-3-lizhijian@fujitsu.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/11/22 10:30 AM, Li Zhijian wrote: > SoftRoCE always returns success when user space is posting a new wqe where > it usually just enqueues a wqe. > > Once the requester state becomes QP_STATE_ERROR, we should generate error > completion for all subsequent wqe. So the user is able to poll the > completion event to check if the former wqe is handled correctly. > > Here we check QP_STATE_ERROR after req_next_wqe() so that the completion > can associate with its wqe. > > Signed-off-by: Li Zhijian > --- > 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..ed6a486c4343 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 (qp->req.state == QP_STATE_ERROR) { > + /* > + * Generate an error completion so that user space is able to > + * poll this completion. > + */ > + goto err; > + } > + Should this still use unlikely(...) ? Because the original judgement has a unlikely surrounded. Cheng Xu > if (wqe->mask & WR_LOCAL_OP_MASK) { > ret = rxe_do_local_ops(qp, wqe); > if (unlikely(ret))