Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2616867rdh; Mon, 30 Oct 2023 02:44:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUqJ19E2c7xHY5qua4GiIXwzr2g+DAmF2rLRT4a4jj/wLba0okQuAmwxdpEukhg02weGEn X-Received: by 2002:a17:90a:2a4a:b0:27d:8d42:6def with SMTP id d10-20020a17090a2a4a00b0027d8d426defmr6167869pjg.34.1698659041307; Mon, 30 Oct 2023 02:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698659041; cv=none; d=google.com; s=arc-20160816; b=y0fkiBQc6qJYf1KI5JY/9Ddc1HJR3UBIIxY4Lr1rlvW1Y7PpRSAGasXPgx1J6M0H0P f3d8BQuR3/Vj7yBh3W3RY3qISyEbWxo9IoOj9HTdUxJm/F7t14RtcEnRR6KtWL8i56aJ T8VHSOyOj2TOZi6U2Ovlynvq6TKE2YF/sva934Tz4nnQDMgqZdzB17vwbz0CamZ2tjQ7 2uKoYVQ5tU5fbohYsKy2JcEX5mXLXW6QvwQ2uhc48wXI9AjKU7mzrIhtoHBuBJ1lJY+c pDNdJSWkFDWAMeafMMo/3FXvyp6/lwq6AE3+ZlnuWCGXLvlusSSgUrtRhIk6ImhAeEZR kAYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:mime-version:date:dkim-signature :message-id; bh=6cn7H6WirnCJsuxRJBZuoEdbpY+E2+h4X2v+GizpQXU=; fh=k1q9kndwtCGHWs7ZMCGQ9VGgvQYv3hS0vJCVo9+GIO4=; b=prMq3KMriTIzmjtjjbwubedqkkX7BA7qbpe3PfzWrXBUNycbQLgkf3ORD99+rh2nYh 39SDz/dAicaykkRU0REJxtObMDJl97V75vw53u2RKmM35U2r8QaC/PGVzm1wUWsLIQ0l JVlrE63JhZ8KYmFbk5Lz0/fxVAt9JVLX61MzjzliDR4NxMbaYd9H7Q48ow8AFZo1kFNX H0LNbJoWRY/XMUj0ziSl1++d48G3l3+mtvOn3KSGm8EuLD+E7Jaw2EXwmzUj+tsjoE74 y2yVQ5kfhiJ3lAnHyHQxcgwxtWKpPE5r9OmiA+ZulHTt4lUW7Q4y4esy8rEBVDS5QT78 eMzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=A5Hy9oUe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bo5-20020a17090b090500b00280202c092asi3649851pjb.160.2023.10.30.02.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:44:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=A5Hy9oUe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 080B180BBC65; Mon, 30 Oct 2023 02:44:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbjJ3Jn5 (ORCPT + 99 others); Mon, 30 Oct 2023 05:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjJ3Jn4 (ORCPT ); Mon, 30 Oct 2023 05:43:56 -0400 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54954B3 for ; Mon, 30 Oct 2023 02:43:54 -0700 (PDT) Message-ID: <6e7df8dc-e31b-472c-86fb-0aef8f6e712b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698659030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6cn7H6WirnCJsuxRJBZuoEdbpY+E2+h4X2v+GizpQXU=; b=A5Hy9oUeINP2HvIVJdk5n3qRXZjQCpLhKAAXFKWEJO9K7P+BbxhVCEPJUdRvUc/S3vQ4eb MrWC/0Slhv5cifz+YZsoQrZ9GBDY/CPrw5CaDFE+lJca0D+TBSAumAmvGUy5PmRR1vj59g gGmUiKnVfs/O+Rehr+c5YY3g0rrn100= Date: Mon, 30 Oct 2023 17:43:42 +0800 MIME-Version: 1.0 Subject: Re: [PATCH RFC 1/2] RDMA/rxe: don't allow registering !PAGE_SIZE mr To: "Zhijian Li (Fujitsu)" , "zyjzyj2000@gmail.com" , "jgg@ziepe.ca" , "leon@kernel.org" , "linux-rdma@vger.kernel.org" Cc: "linux-kernel@vger.kernel.org" , "rpearsonhpe@gmail.com" , "Daisuke Matsuda (Fujitsu)" , "bvanassche@acm.org" References: <20231027054154.2935054-1-lizhijian@fujitsu.com> <53c18b2a-c3b2-4936-b654-12cb5f914622@linux.dev> <784a65e3-5438-4700-b3e4-1d72d144ec2a@fujitsu.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <784a65e3-5438-4700-b3e4-1d72d144ec2a@fujitsu.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 02:44:00 -0700 (PDT) 在 2023/10/30 16:13, Zhijian Li (Fujitsu) 写道: > > > On 27/10/2023 16:17, Zhu Yanjun wrote: >> 在 2023/10/27 13:41, Li Zhijian 写道: >>> mr->page_list only encodes *page without page offset, when >>> page_size != PAGE_SIZE, we cannot restore the address with a wrong >>> page_offset. >>> >>> Note that this patch will break some ULPs that try to register 4K >>> MR when PAGE_SIZE is not 4K. >>> SRP and nvme over RXE is known to be impacted. >> >> When ULP uses folio or compound page, ULP can not work well with RXE after this commit is applied. >> >> Perhaps removing page_size set in RXE is a good solution because page_size is set twice, firstly page_size is set in infiniband/core, secondly it is set in RXE. > > Does The RXE one mean rxe_mr_init(), I think rxe_reg_user_mr() requires this. Please read the discussions carefully. This problem has been discussed. Best Regards, Zhu Yanjun > > 48 static void rxe_mr_init(int access, struct rxe_mr *mr) > 49 { > 50 u32 key = mr->elem.index << 8 | rxe_get_next_key(-1); > 51 > 52 /* set ibmr->l/rkey and also copy into private l/rkey > 53 * for user MRs these will always be the same > 54 * for cases where caller 'owns' the key portion > 55 * they may be different until REG_MR WQE is executed. > 56 */ > 57 mr->lkey = mr->ibmr.lkey = key; > 58 mr->rkey = mr->ibmr.rkey = key; > 59 > 60 mr->access = access; > 61 mr->ibmr.page_size = PAGE_SIZE; > 62 mr->page_mask = PAGE_MASK; > 63 mr->page_shift = PAGE_SHIFT; > 64 mr->state = RXE_MR_STATE_INVALID; > 65 } > > > Thanks > Zhijian > >> >> When folio or compound page is used in ULP, it is very possible that page_size in infiniband/core is different from the page_size in RXE >> >> Not sure what problem this difference will cause. >> >> Zhu Yanjun >> >>> >>> Signed-off-by: Li Zhijian >>> --- >>>   drivers/infiniband/sw/rxe/rxe_mr.c | 6 ++++++ >>>   1 file changed, 6 insertions(+) >>> >>> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c >>> index f54042e9aeb2..61a136ea1d91 100644 >>> --- a/drivers/infiniband/sw/rxe/rxe_mr.c >>> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c >>> @@ -234,6 +234,12 @@ int rxe_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sgl, >>>       struct rxe_mr *mr = to_rmr(ibmr); >>>       unsigned int page_size = mr_page_size(mr); >>> +    if (page_size != PAGE_SIZE) { >>> +        rxe_info_mr(mr, "Unsupported MR with page_size %u, expect %lu\n", >>> +               page_size, PAGE_SIZE); >>> +        return -EOPNOTSUPP; >>> +    } >>> + >>>       mr->nbuf = 0; >>>       mr->page_shift = ilog2(page_size); >>>       mr->page_mask = ~((u64)page_size - 1);