Message ID | 20221116081951.32750-10-lizhijian@fujitsu.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp22902wru; Wed, 16 Nov 2022 00:27:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf4npWQBzg61uAaBCawVVxyA7oktDxG31ruAk6CS+Wvsjtaqh1Ls7csChSmYZAG0nKRbHqOV X-Received: by 2002:a17:903:264c:b0:186:9fc8:6672 with SMTP id je12-20020a170903264c00b001869fc86672mr7790493plb.65.1668587266430; Wed, 16 Nov 2022 00:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668587266; cv=none; d=google.com; s=arc-20160816; b=OhbFDfrUASvygcRHPeAFOi+x+8LBvkukJZ9uxdtnjtYL8Ja+EfEbO1nqBw6zuxB7yX iSmYQMOltsCZ1y7ovqrF9t0Zl+bQR96Zz9ZM817VLhVw10BXCv0NPQv6ZdLoNpg2oU1b 9v+pXVHn3NR3WgaGI1dmUG/xSLJNuOcOYTBCB4ldG09Ikhj3LTwue5q1DP9EKg/JCbdi HF8xFYE5OX9bydH1wWw06ExtbVIUOL3v7RFpk71cL63V7rXLWrK+oMiF3pTZnJ8YF4uU noDHI4+oP4RsRPkv+KxEF59/eUqHMeIFs8iaa6NsT114xXjZZLT+f2X73cIeaaW05eCB ACSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rPDxGhKc1oXp2tUOXD2oh5qw2zKbagbdIUb+HaD1vsM=; b=J6Jbge/C/MF9CMeraOn06L9OO1l6jvY07E5+iEh7y5uNGiuL8QpiIgLuU7ZQoyNCUX 7WsiMMI0+trSpqKf5bEMYwPKcfJWh4RBF2QWKaXC8K+Az+y8G+tvJ73Yp4VMv+joWVTw Bnl8bVYZ3wC+YqQ2liYVEt1VZWT6jAaJMixzyWeRp1qtuwv2wAbQMd5v45OHE4tnf3MT I/oEWtlZ8C7Ma4vWeUx7aqr8yKJx3Bitay7unOauHCFk1Pqds+cdfeCHtmGN4UYT6p/s b6sE6R5Gf1PCqI/88xnNc2m3o0oFq+XwHv3/Ca5bCtPE8QiWUMYODP3j7m4rVMzbh+e7 ocbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a63790e000000b004707d555c1esi14674969pgc.554.2022.11.16.00.27.33; Wed, 16 Nov 2022 00:27:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbiKPIVM (ORCPT <rfc822;maxim.cournoyer@gmail.com> + 99 others); Wed, 16 Nov 2022 03:21:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238095AbiKPIUa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 03:20:30 -0500 Received: from esa1.hc1455-7.c3s2.iphmx.com (esa1.hc1455-7.c3s2.iphmx.com [207.54.90.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8111D2640; Wed, 16 Nov 2022 00:20:28 -0800 (PST) X-IronPort-AV: E=McAfee;i="6500,9779,10532"; a="96201651" X-IronPort-AV: E=Sophos;i="5.96,167,1665414000"; d="scan'208";a="96201651" Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa1.hc1455-7.c3s2.iphmx.com with ESMTP; 16 Nov 2022 17:20:26 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 662D9E081B; Wed, 16 Nov 2022 17:20:25 +0900 (JST) Received: from kws-ab2.gw.nic.fujitsu.com (kws-ab2.gw.nic.fujitsu.com [192.51.206.12]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id A4989D5C3C; Wed, 16 Nov 2022 17:20:24 +0900 (JST) Received: from FNSTPC.g08.fujitsu.local (unknown [10.167.226.45]) by kws-ab2.gw.nic.fujitsu.com (Postfix) with ESMTP id 87D3F2340D52; Wed, 16 Nov 2022 17:20:23 +0900 (JST) From: Li Zhijian <lizhijian@fujitsu.com> To: zyjzyj2000@gmail.com, jgg@ziepe.ca, leon@kernel.org, Bob Pearson <rpearsonhpe@gmail.com>, linux-rdma@vger.kernel.org Cc: Mark Bloch <mbloch@nvidia.com>, Tom Talpey <tom@talpey.com>, tomasz.gromadzki@intel.com, Dan Williams <dan.j.williams@intel.com>, Xiao Yang <yangx.jy@fujitsu.com>, y-goto@fujitsu.com, linux-kernel@vger.kernel.org, Li Zhijian <lizhijian@fujitsu.com> Subject: [for-next PATCH v6 09/10] RDMA/cm: Make QP FLUSHABLE Date: Wed, 16 Nov 2022 16:19:50 +0800 Message-Id: <20221116081951.32750-10-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116081951.32750-1-lizhijian@fujitsu.com> References: <20221116081951.32750-1-lizhijian@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1408-9.0.0.1002-27266.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1408-9.0.1002-27266.006 X-TMASE-Result: 10--0.921700-10.000000 X-TMASE-MatchedRID: 92xvE4Eud/+tVKSQoU2TwQrcxrzwsv5u1QQ6Jx/fflbAuQ0xDMaXkH4q tYI9sRE/KqrQ7lLcMnwur3Fjd+eQSljaDEobnfK28Jb881FGn9l9LQinZ4QefOYQ3zcXToXr+gt Hj7OwNO2OhzOa6g8KrXinYhvRB8kptqxdGensUT2Zj5MKbfT31F3WT1KhjSLChjHlUHUMYUVBrQ obDMfLt/4VhULZJHaF9y9INlBams5YIoo0pwKZmBXBt/mUREyAj/ZFF9Wfm7hNy7ppG0IjcFQqk 0j7vLVUewMSBDreIdk= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749640561377602886?= X-GMAIL-MSGID: =?utf-8?q?1749640561377602886?= |
Series |
RDMA/rxe: Add RDMA FLUSH operation
|
|
Commit Message
Zhijian Li (Fujitsu)
Nov. 16, 2022, 8:19 a.m. UTC
It enables flushable access flag for qp Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- V5: new patch, inspired by Bob --- drivers/infiniband/core/cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Wed, Nov 16, 2022 at 04:19:50PM +0800, Li Zhijian wrote: > It enables flushable access flag for qp > > Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> > Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> > --- > V5: new patch, inspired by Bob > --- > drivers/infiniband/core/cm.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > index 1f9938a2c475..58837aac980b 100644 > --- a/drivers/infiniband/core/cm.c > +++ b/drivers/infiniband/core/cm.c > @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, > qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; > if (cm_id_priv->responder_resources) > qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | > - IB_ACCESS_REMOTE_ATOMIC; > + IB_ACCESS_REMOTE_ATOMIC | > + IB_ACCESS_FLUSHABLE; What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? Do flush ops require a responder resource? Why should CM set it unconditionally? Explain in the commit message Jason
On 22/11/2022 22:52, Jason Gunthorpe wrote: > On Wed, Nov 16, 2022 at 04:19:50PM +0800, Li Zhijian wrote: >> It enables flushable access flag for qp >> >> Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> >> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> >> --- >> V5: new patch, inspired by Bob >> --- >> drivers/infiniband/core/cm.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c >> index 1f9938a2c475..58837aac980b 100644 >> --- a/drivers/infiniband/core/cm.c >> +++ b/drivers/infiniband/core/cm.c >> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, >> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; >> if (cm_id_priv->responder_resources) >> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | >> - IB_ACCESS_REMOTE_ATOMIC; >> + IB_ACCESS_REMOTE_ATOMIC | >> + IB_ACCESS_FLUSHABLE; > > What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? Previous, responder of RXE will check qp_access_flags in check_op_valid(): 256 static enum resp_states check_op_valid(struct rxe_qp *qp, 257 struct rxe_pkt_info *pkt) 258 { 259 switch (qp_type(qp)) { 260 case IB_QPT_RC: 261 if (((pkt->mask & RXE_READ_MASK) && 262 !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_READ)) || 263 ((pkt->mask & RXE_WRITE_MASK) && 264 !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_WRITE)) || 265 ((pkt->mask & RXE_ATOMIC_MASK) && 266 !(qp->attr.qp_access_flags & IB_ACCESS_REMOTE_ATOMIC))) { 267 return RESPST_ERR_UNSUPPORTED_OPCODE; 268 } based on this, additional IB_FLUSH_PERSISTENT and IB_ACCESS_FLUSH_GLOBAL were added in patch7 since V5 suggested by Bob. Because of this change, QP should become FLUSHABLE correspondingly. > > Do flush ops require a responder resource? Yes, i think so. See IBA spec, oA19-9: FLUSH shall consume a single responder... > > Why should CM set it unconditionally? > I had ever checked git history log of qp->qp_access_flags, they did as it's. So i also think qp_access_flags should accept all new IBA abilities unconditionally. What do you think of this @Jason Thanks Zhijian > Explain in the commit message > > Jason
On Wed, Nov 23, 2022 at 06:07:37AM +0000, lizhijian@fujitsu.com wrote: > > > On 22/11/2022 22:52, Jason Gunthorpe wrote: > > On Wed, Nov 16, 2022 at 04:19:50PM +0800, Li Zhijian wrote: > >> It enables flushable access flag for qp > >> > >> Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> > >> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> > >> --- > >> V5: new patch, inspired by Bob > >> --- > >> drivers/infiniband/core/cm.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > >> index 1f9938a2c475..58837aac980b 100644 > >> --- a/drivers/infiniband/core/cm.c > >> +++ b/drivers/infiniband/core/cm.c > >> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, > >> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; > >> if (cm_id_priv->responder_resources) > >> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | > >> - IB_ACCESS_REMOTE_ATOMIC; > >> + IB_ACCESS_REMOTE_ATOMIC | > >> + IB_ACCESS_FLUSHABLE; > > > > What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? > > Previous, responder of RXE will check qp_access_flags in check_op_valid(): > 256 static enum resp_states check_op_valid(struct rxe_qp *qp, > > 257 struct rxe_pkt_info *pkt) > > 258 { > > 259 switch (qp_type(qp)) { > > 260 case IB_QPT_RC: > > 261 if (((pkt->mask & RXE_READ_MASK) && > > 262 !(qp->attr.qp_access_flags & > IB_ACCESS_REMOTE_READ)) || > > > 263 ((pkt->mask & RXE_WRITE_MASK) && > > 264 !(qp->attr.qp_access_flags & > IB_ACCESS_REMOTE_WRITE)) || > 265 ((pkt->mask & RXE_ATOMIC_MASK) && > > 266 !(qp->attr.qp_access_flags & > IB_ACCESS_REMOTE_ATOMIC))) { > 267 return RESPST_ERR_UNSUPPORTED_OPCODE; > > 268 } > > based on this, additional IB_FLUSH_PERSISTENT and IB_ACCESS_FLUSH_GLOBAL > were added in patch7 since V5 suggested by Bob. > Because of this change, QP should become FLUSHABLE correspondingly. But nothing ever reads IB_ACCESS_FLUSHABLE, so why is it added? Jason
On 25/11/2022 01:39, Jason Gunthorpe wrote: > On Wed, Nov 23, 2022 at 06:07:37AM +0000, lizhijian@fujitsu.com wrote: >> >> >> On 22/11/2022 22:52, Jason Gunthorpe wrote: >>> On Wed, Nov 16, 2022 at 04:19:50PM +0800, Li Zhijian wrote: >>>> It enables flushable access flag for qp >>>> >>>> Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> >>>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> >>>> --- >>>> V5: new patch, inspired by Bob >>>> --- >>>> drivers/infiniband/core/cm.c | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c >>>> index 1f9938a2c475..58837aac980b 100644 >>>> --- a/drivers/infiniband/core/cm.c >>>> +++ b/drivers/infiniband/core/cm.c >>>> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, >>>> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; >>>> if (cm_id_priv->responder_resources) >>>> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | >>>> - IB_ACCESS_REMOTE_ATOMIC; >>>> + IB_ACCESS_REMOTE_ATOMIC | >>>> + IB_ACCESS_FLUSHABLE; >>> >>> What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? >> >> Previous, responder of RXE will check qp_access_flags in check_op_valid(): >> 256 static enum resp_states check_op_valid(struct rxe_qp *qp, >> >> 257 struct rxe_pkt_info *pkt) >> >> 258 { >> >> 259 switch (qp_type(qp)) { >> >> 260 case IB_QPT_RC: >> >> 261 if (((pkt->mask & RXE_READ_MASK) && >> >> 262 !(qp->attr.qp_access_flags & >> IB_ACCESS_REMOTE_READ)) || >> >> >> 263 ((pkt->mask & RXE_WRITE_MASK) && >> >> 264 !(qp->attr.qp_access_flags & >> IB_ACCESS_REMOTE_WRITE)) || >> 265 ((pkt->mask & RXE_ATOMIC_MASK) && >> >> 266 !(qp->attr.qp_access_flags & >> IB_ACCESS_REMOTE_ATOMIC))) { >> 267 return RESPST_ERR_UNSUPPORTED_OPCODE; >> >> 268 } >> >> based on this, additional IB_FLUSH_PERSISTENT and IB_ACCESS_FLUSH_GLOBAL >> were added in patch7 since V5 suggested by Bob. >> Because of this change, QP should become FLUSHABLE correspondingly. > > But nothing ever reads IB_ACCESS_FLUSHABLE, so why is it added? include/rdma/ib_verbs.h: + IB_ACCESS_FLUSH_GLOBAL = IB_UVERBS_ACCESS_FLUSH_GLOBAL, + IB_ACCESS_FLUSH_PERSISTENT = IB_UVERBS_ACCESS_FLUSH_PERSISTENT, + IB_ACCESS_FLUSHABLE = IB_ACCESS_FLUSH_GLOBAL | + IB_ACCESS_FLUSH_PERSISTENT, IB_ACCESS_FLUSHABLE is a wrapper of IB_ACCESS_FLUSH_GLOBAL | IB_ACCESS_FLUSH_PERSISTENT. With this wrapper, i will write one less line of code :) I'm fine to expand it in next version. > > Jason
On Fri, Nov 25, 2022 at 02:22:24AM +0000, lizhijian@fujitsu.com wrote: > > > On 25/11/2022 01:39, Jason Gunthorpe wrote: > > On Wed, Nov 23, 2022 at 06:07:37AM +0000, lizhijian@fujitsu.com wrote: > >> > >> > >> On 22/11/2022 22:52, Jason Gunthorpe wrote: > >>> On Wed, Nov 16, 2022 at 04:19:50PM +0800, Li Zhijian wrote: > >>>> It enables flushable access flag for qp > >>>> > >>>> Reviewed-by: Zhu Yanjun <zyjzyj2000@gmail.com> > >>>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> > >>>> --- > >>>> V5: new patch, inspired by Bob > >>>> --- > >>>> drivers/infiniband/core/cm.c | 3 ++- > >>>> 1 file changed, 2 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > >>>> index 1f9938a2c475..58837aac980b 100644 > >>>> --- a/drivers/infiniband/core/cm.c > >>>> +++ b/drivers/infiniband/core/cm.c > >>>> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, > >>>> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; > >>>> if (cm_id_priv->responder_resources) > >>>> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | > >>>> - IB_ACCESS_REMOTE_ATOMIC; > >>>> + IB_ACCESS_REMOTE_ATOMIC | > >>>> + IB_ACCESS_FLUSHABLE; > >>> > >>> What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? > >> > >> Previous, responder of RXE will check qp_access_flags in check_op_valid(): > >> 256 static enum resp_states check_op_valid(struct rxe_qp *qp, > >> > >> 257 struct rxe_pkt_info *pkt) > >> > >> 258 { > >> > >> 259 switch (qp_type(qp)) { > >> > >> 260 case IB_QPT_RC: > >> > >> 261 if (((pkt->mask & RXE_READ_MASK) && > >> > >> 262 !(qp->attr.qp_access_flags & > >> IB_ACCESS_REMOTE_READ)) || > >> > >> > >> 263 ((pkt->mask & RXE_WRITE_MASK) && > >> > >> 264 !(qp->attr.qp_access_flags & > >> IB_ACCESS_REMOTE_WRITE)) || > >> 265 ((pkt->mask & RXE_ATOMIC_MASK) && > >> > >> 266 !(qp->attr.qp_access_flags & > >> IB_ACCESS_REMOTE_ATOMIC))) { > >> 267 return RESPST_ERR_UNSUPPORTED_OPCODE; > >> > >> 268 } > >> > >> based on this, additional IB_FLUSH_PERSISTENT and IB_ACCESS_FLUSH_GLOBAL > >> were added in patch7 since V5 suggested by Bob. > >> Because of this change, QP should become FLUSHABLE correspondingly. > > > > But nothing ever reads IB_ACCESS_FLUSHABLE, so why is it added? > > include/rdma/ib_verbs.h: > + IB_ACCESS_FLUSH_GLOBAL = IB_UVERBS_ACCESS_FLUSH_GLOBAL, > + IB_ACCESS_FLUSH_PERSISTENT = IB_UVERBS_ACCESS_FLUSH_PERSISTENT, > + IB_ACCESS_FLUSHABLE = IB_ACCESS_FLUSH_GLOBAL | > + IB_ACCESS_FLUSH_PERSISTENT, > > IB_ACCESS_FLUSHABLE is a wrapper of IB_ACCESS_FLUSH_GLOBAL | > IB_ACCESS_FLUSH_PERSISTENT. With this wrapper, i will write one less > line of code :) > > I'm fine to expand it in next version. OIC, that is why it escaped grep But this is back to my original question - why is it OK to do this here in CMA? Shouldn't this cause other drivers to refuse to create the QP because they don't support the flag? Jason > > > > > Jason
On 25/11/2022 22:16, Jason Gunthorpe wrote: >>>>>> --- >>>>>> drivers/infiniband/core/cm.c | 3 ++- >>>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c >>>>>> index 1f9938a2c475..58837aac980b 100644 >>>>>> --- a/drivers/infiniband/core/cm.c >>>>>> +++ b/drivers/infiniband/core/cm.c >>>>>> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, >>>>>> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; >>>>>> if (cm_id_priv->responder_resources) >>>>>> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | >>>>>> - IB_ACCESS_REMOTE_ATOMIC; >>>>>> + IB_ACCESS_REMOTE_ATOMIC | >>>>>> + IB_ACCESS_FLUSHABLE; >>>>> What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? >> I'm fine to expand it in next version. > OIC, that is why it escaped grep > > But this is back to my original question - why is it OK to do this > here in CMA? Shouldn't this cause other drivers to refuse to create > the QP because they don't support the flag? > Jason, My flush example got wrong since V5 where responder side does qp_access_flags check. so i added this patch. I also agreed it's a good idea that we should only add this flush flag to the supported drivers. But i haven't figured out how to achieve it in current RDMA. After more digging into rdma-core, i found that this flag can be also set from usespace by calling ibv_modify_qp(). For server side(responder), ibv_modify_qp() must be called after rdma_accept(). rdma_accept() inside will modify qp_access_flags again(rdma_get_request is the first place to modify qp_access_flags). Back to the original question, IIUC, current rdma-core have no API to set qp_access_flags during qp creating. FLUSH operation in responder side will check both mr->access_flags and qp_access_flags. So unsupported device/driver are not able to do flush at all though qp_access_flags apply to all drivers. ------------------------------------------ (gdb) bt #0 __ibv_modify_qp_1_1 (qp=0x40fbf0, attr=0x7fffffffd920, attr_mask=57) at /home/lizhijian/rdma-core/libibverbs/verbs.c:715 #1 0x00007ffff7faa1db in ucma_init_conn_qp (id_priv=0x40f6d0, qp=0x40fbf0) at /home/lizhijian/rdma-core/librdmacm/cma.c:1380 #2 0x00007ffff7faada2 in rdma_create_qp_ex (id=0x40f6d0, attr=0x7fffffffda30) at /home/lizhijian/rdma-core/librdmacm/cma.c:1676 #3 0x00007ffff7faae94 in rdma_create_qp (id=0x40f6d0, pd=0x407710, qp_init_attr=0x7fffffffdae0) at /home/lizhijian/rdma-core/librdmacm/cma.c:1702 #4 0x00007ffff7fab5d3 in rdma_get_request (listen=0x40ede0, id=0x4051a8 <id>) at /home/lizhijian/rdma-core/librdmacm/cma.c:1883 #5 0x0000000000401af9 in run () at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:91 #6 0x00000000004021ea in main (argc=7, argv=0x7fffffffe228) at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:282 (gdb) bt #0 __ibv_modify_qp_1_1 (qp=0x40fbf0, attr=0x7fffffffd930, attr_mask=1216897) at /home/lizhijian/rdma-core/libibverbs/verbs.c:715 #1 0x00007ffff7fa9f16 in ucma_modify_qp_rtr (id=0x40f6d0, resp_res=128 '\200') at /home/lizhijian/rdma-core/librdmacm/cma.c:1304 #2 0x00007ffff7fab80a in rdma_accept (id=0x40f6d0, conn_param=0x0) at /home/lizhijian/rdma-core/librdmacm/cma.c:1932 #3 0x0000000000401c8a in run () at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:132 #4 0x00000000004021ea in main (argc=7, argv=0x7fffffffe228) at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:282 > Jason >
Jason Could you take a look at this update: - Make QP FLUSHABLE for supported device only - add more explanation commit 1a95f94125b59183d5fc643a917e0a2e7bb07981 Author: Li Zhijian <lizhijian@fujitsu.com> Date: Mon Sep 26 17:53:06 2022 +0800 RDMA/cm: Make QP FLUSHABLE for supported device Similar to RDMA and Atomic qp attributes enabled by default in CM, enable FLUSH attribute for supported device. That makes applications that are built with rdma_create_ep, rdma_accept APIs have FLUSH qp attribute natively so that user is able to request FLUSH operation simpler. Note that, a FLUSH operation requires FLUSH are supported by both device(HCA) and memory region(MR) and QP at the same time, so it's safe to enable FLUSH qp attribute by default here. FLUSH attribute can be disable by modify_qp() interface. Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- V6: enable flush for supported device only #Jason V5: new patch, inspired by Bob Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 1f9938a2c475..603c0aecc361 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PKEY_INDEX | IB_QP_PORT; qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; - if (cm_id_priv->responder_resources) + if (cm_id_priv->responder_resources) { + struct ib_device *ib_dev = cm_id_priv->id.device; + u64 support_flush = ib_dev->attrs.device_cap_flags & + (IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT); + u32 flushable = support_flush ? + (IB_ACCESS_FLUSH_GLOBAL | + IB_ACCESS_FLUSH_PERSISTENT) : 0; + qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | - IB_ACCESS_REMOTE_ATOMIC; + IB_ACCESS_REMOTE_ATOMIC | + flushable; + } qp_attr->pkey_index = cm_id_priv->av.pkey_index; if (cm_id_priv->av.port) qp_attr->port_num = cm_id_priv->av.port->port_num; Thanks Zhijian On 28/11/2022 18:23, lizhijian@fujitsu.com wrote: > > > On 25/11/2022 22:16, Jason Gunthorpe wrote: >>>>>>> --- >>>>>>> drivers/infiniband/core/cm.c | 3 ++- >>>>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c >>>>>>> index 1f9938a2c475..58837aac980b 100644 >>>>>>> --- a/drivers/infiniband/core/cm.c >>>>>>> +++ b/drivers/infiniband/core/cm.c >>>>>>> @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, >>>>>>> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; >>>>>>> if (cm_id_priv->responder_resources) >>>>>>> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | >>>>>>> - IB_ACCESS_REMOTE_ATOMIC; >>>>>>> + IB_ACCESS_REMOTE_ATOMIC | >>>>>>> + IB_ACCESS_FLUSHABLE; >>>>>> What is the point of this? Nothing checks IB_ACCESS_FLUSHABLE ? > >>> I'm fine to expand it in next version. >> OIC, that is why it escaped grep >> >> But this is back to my original question - why is it OK to do this >> here in CMA? Shouldn't this cause other drivers to refuse to create >> the QP because they don't support the flag? >> > > Jason, > > My flush example got wrong since V5 where responder side does > qp_access_flags check. so i added this patch. > > I also agreed it's a good idea that we should only add this flush flag > to the supported drivers. But i haven't figured out how to achieve it in > current RDMA. > > After more digging into rdma-core, i found that this flag can be also > set from usespace by calling ibv_modify_qp(). > For server side(responder), ibv_modify_qp() must be called after > rdma_accept(). rdma_accept() inside will modify qp_access_flags > again(rdma_get_request is the first place to modify qp_access_flags). > > Back to the original question, IIUC, current rdma-core have no API to > set qp_access_flags during qp creating. > > FLUSH operation in responder side will check both mr->access_flags and > qp_access_flags. So unsupported device/driver are not able to do flush > at all though qp_access_flags apply to all drivers. > > > ------------------------------------------ > (gdb) bt > #0 __ibv_modify_qp_1_1 (qp=0x40fbf0, attr=0x7fffffffd920, attr_mask=57) > at /home/lizhijian/rdma-core/libibverbs/verbs.c:715 > #1 0x00007ffff7faa1db in ucma_init_conn_qp (id_priv=0x40f6d0, qp=0x40fbf0) > at /home/lizhijian/rdma-core/librdmacm/cma.c:1380 > #2 0x00007ffff7faada2 in rdma_create_qp_ex (id=0x40f6d0, > attr=0x7fffffffda30) > at /home/lizhijian/rdma-core/librdmacm/cma.c:1676 > #3 0x00007ffff7faae94 in rdma_create_qp (id=0x40f6d0, pd=0x407710, > qp_init_attr=0x7fffffffdae0) > at /home/lizhijian/rdma-core/librdmacm/cma.c:1702 > #4 0x00007ffff7fab5d3 in rdma_get_request (listen=0x40ede0, id=0x4051a8 > <id>) > at /home/lizhijian/rdma-core/librdmacm/cma.c:1883 > #5 0x0000000000401af9 in run () at > /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:91 > #6 0x00000000004021ea in main (argc=7, argv=0x7fffffffe228) > at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:282 > > (gdb) bt > #0 __ibv_modify_qp_1_1 (qp=0x40fbf0, attr=0x7fffffffd930, > attr_mask=1216897) > at /home/lizhijian/rdma-core/libibverbs/verbs.c:715 > #1 0x00007ffff7fa9f16 in ucma_modify_qp_rtr (id=0x40f6d0, resp_res=128 > '\200') > at /home/lizhijian/rdma-core/librdmacm/cma.c:1304 > #2 0x00007ffff7fab80a in rdma_accept (id=0x40f6d0, conn_param=0x0) > at /home/lizhijian/rdma-core/librdmacm/cma.c:1932 > #3 0x0000000000401c8a in run () at > /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:132 > #4 0x00000000004021ea in main (argc=7, argv=0x7fffffffe228) > at /home/lizhijian/rdma-core/librdmacm/examples/rdma_flush_server.c:282 > > >> Jason
On Mon, Dec 05, 2022 at 10:07:11AM +0000, lizhijian@fujitsu.com wrote: > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > index 1f9938a2c475..603c0aecc361 100644 > --- a/drivers/infiniband/core/cm.c > +++ b/drivers/infiniband/core/cm.c > @@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, > *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | > IB_QP_PKEY_INDEX | IB_QP_PORT; > qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; > - if (cm_id_priv->responder_resources) > + if (cm_id_priv->responder_resources) { > + struct ib_device *ib_dev = cm_id_priv->id.device; > + u64 support_flush = ib_dev->attrs.device_cap_flags & > + (IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT); > + u32 flushable = support_flush ? > + (IB_ACCESS_FLUSH_GLOBAL | > + IB_ACCESS_FLUSH_PERSISTENT) : 0; > + > qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | > - IB_ACCESS_REMOTE_ATOMIC; > + IB_ACCESS_REMOTE_ATOMIC | > + flushable; > + } This makes more sense Jason
On 06/12/2022 01:12, Jason Gunthorpe wrote: > On Mon, Dec 05, 2022 at 10:07:11AM +0000, lizhijian@fujitsu.com wrote: >> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c >> index 1f9938a2c475..603c0aecc361 100644 >> --- a/drivers/infiniband/core/cm.c >> +++ b/drivers/infiniband/core/cm.c >> @@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, >> *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | >> IB_QP_PKEY_INDEX | IB_QP_PORT; >> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; >> - if (cm_id_priv->responder_resources) >> + if (cm_id_priv->responder_resources) { >> + struct ib_device *ib_dev = cm_id_priv->id.device; >> + u64 support_flush = ib_dev->attrs.device_cap_flags & >> + (IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT); >> + u32 flushable = support_flush ? >> + (IB_ACCESS_FLUSH_GLOBAL | >> + IB_ACCESS_FLUSH_PERSISTENT) : 0; >> + >> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | >> - IB_ACCESS_REMOTE_ATOMIC; >> + IB_ACCESS_REMOTE_ATOMIC | >> + flushable; >> + } > > This makes more sense thanks for your help, i have posted V7 revision. https://lore.kernel.org/lkml/20221206130201.30986-1-lizhijian@fujitsu.com/T/#t Thanks Zhijian > > Jason
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 1f9938a2c475..58837aac980b 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -4096,7 +4096,8 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; if (cm_id_priv->responder_resources) qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | - IB_ACCESS_REMOTE_ATOMIC; + IB_ACCESS_REMOTE_ATOMIC | + IB_ACCESS_FLUSHABLE; qp_attr->pkey_index = cm_id_priv->av.pkey_index; if (cm_id_priv->av.port) qp_attr->port_num = cm_id_priv->av.port->port_num;