Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp35949iob; Tue, 17 May 2022 17:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqTqhkqflYXRyElAgwxNsDL3+urVyydTMZu2+VaGzR9382wZEbXgsmo4Ow7M2gQpA3V8OZ X-Received: by 2002:a17:906:9748:b0:6fa:8c68:af0e with SMTP id o8-20020a170906974800b006fa8c68af0emr22679668ejy.153.1652835447192; Tue, 17 May 2022 17:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652835447; cv=none; d=google.com; s=arc-20160816; b=yBDJ1ysqM6iPJow7jpembFdVhkwfQcmPThY5t8DoVknpzj4VuTa4msv+xSVVYZ78Gv ot+OYD6CaWt9HORTtE0IGATG/Qo1YUMoRb24YzAWr0J1NZ1PXntQ5wgX9ZyjpcfpemQ3 NioyxHmCt3MiTmjpf7DEwxzM4dbWLdfztlRvA4p1bYyAk0QQH5RxNUq9FN8hyQSpw2jR VMCl70w6Im6eWsz9Ots6ngXAj9mb37ZLGCKMqi9AVoz93YUlQU74xtLd8NkjFXGksiyi VAWj9ojd/II2TIAd+8utG6a2kAuK14y2iY0N3YQaxHyZH7CyTWnEN/aIcmjvEHwvf+cT OsJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rc9GkWPYwi9LjqP/Z5LP2qV70hypQrqBkulyuMgMrFs=; b=CJ8wCpxxWPc1+PJ0hQX1eo6uILPGr4eOmIVcK5WrWEkoZaofyTfcZ3RqTNuYizavQQ t4+gO2HQXwW0nRapPJw7In/VxR+2Q+8h2JQx/QCVd9c9/grhqv/xfuH+f1c3GMF+MREb 5Iw9BCt7Bxo69yogHvt0Y50xURcgoZe1Rs8+UWbz55YdhB/rKIyjxjZuyl0zN1Y2/gC8 HcpN9roTqsgMBNd5HloWRKVDZ0KV4PqZDm4SMSL7KLbDzlYUxODsMrK8HDFY4Z7SP9+J RUnid4vWyMN3tbpjId38s5qGUVGwFpEh0uoX2D8s4nRu3/E9lfdAZxyGJ7qPH8eOICrQ 4qRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=GyE4Rctc; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du21-20020a17090772d500b006f45e80fdc5si816272ejc.1000.2022.05.17.17.57.01; Tue, 17 May 2022 17:57:27 -0700 (PDT) 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; dkim=pass header.i=@ziepe.ca header.s=google header.b=GyE4Rctc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232262AbiERAEC (ORCPT + 99 others); Tue, 17 May 2022 20:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232253AbiERAEA (ORCPT ); Tue, 17 May 2022 20:04:00 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84B8F53B75 for ; Tue, 17 May 2022 17:03:58 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id z126so402120qkb.2 for ; Tue, 17 May 2022 17:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rc9GkWPYwi9LjqP/Z5LP2qV70hypQrqBkulyuMgMrFs=; b=GyE4RctcHXmpHwWg3/vj2qWS+pJOYVc0XqsDwxjK94QvKCHOXSGP/2QEz3efBSZWCT H4CvW8XL8GdJD0msOv980Gooh7AC3Wc3CqvDGXkdaAZXz39Q2u71SvyoZF8Up253bzYS goKPZggFYA5z1F44SkDR7jfLk29BeY2pWCidXYNEdOeZjC2/oakC7+Gq0sP5tsLHG1yE d9LvRHW6oha2Pe+/oGMstHAI4nBRZIAsffa/V5J3qdtwwlSlKeyoeF8WUySB0HRtRYzq wXI3kIw/DmdcurybnglIzcCy+Hp68JRkm+PLhCRG4lF2og5VUx9yYeONNJVENCk5isn5 wT7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rc9GkWPYwi9LjqP/Z5LP2qV70hypQrqBkulyuMgMrFs=; b=X2IWoUAw8sNm8/orSnN0RZgprrpOHhx7UCXFxFgL254cgv19njGDCYbHjGfiAufcA5 ehUiRZK+wlo4qTHrqOHleEP+B+mdZfdz48ZN/+W6kDHXIYdFHmmkoddI4SVxd+oDEUW+ 8bJml6wVvwqDcPOzQXDsnxkA2HIoCwcXJbz+8p7QocXH3eUzDS51PvOprXQHeF35DGcl 00NlOg5s1w1lQZgctTfrmFOkjGy0rCYJGl6TrNc5GTerC5/+hrdftOx/EZbUeHiO53w0 bbAsB9nEoW/DrKnmiilqYJByye1BHpYMIkrqjTEyHzDH3z3tHjSJBPlnXlKgxavdRpjq L7aw== X-Gm-Message-State: AOAM533iQbciYIJY94MlPANlXP1VioxNBIt6fHchMKKm00FZfWZbOBPp eAd6GxbRVPDjZbP81trOfGba6g== X-Received: by 2002:a05:620a:42:b0:6a0:c64c:35ae with SMTP id t2-20020a05620a004200b006a0c64c35aemr18539952qkt.607.1652832237634; Tue, 17 May 2022 17:03:57 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id n7-20020ac81e07000000b002f39b99f6bfsm262039qtl.89.2022.05.17.17.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 17:03:57 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1nr7AS-008EVK-0v; Tue, 17 May 2022 21:03:56 -0300 Date: Tue, 17 May 2022 21:03:56 -0300 From: Jason Gunthorpe To: Long Li Cc: Ajay Sharma , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Leon Romanovsky , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" Subject: Re: [PATCH 05/12] net: mana: Set the DMA device max page size Message-ID: <20220518000356.GO63055@ziepe.ca> References: <1652778276-2986-1-git-send-email-longli@linuxonhyperv.com> <1652778276-2986-6-git-send-email-longli@linuxonhyperv.com> <20220517145949.GH63055@ziepe.ca> <20220517193515.GN63055@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Tue, May 17, 2022 at 08:04:58PM +0000, Long Li wrote: > > Subject: Re: [PATCH 05/12] net: mana: Set the DMA device max page size > > > > On Tue, May 17, 2022 at 07:32:51PM +0000, Long Li wrote: > > > > Subject: Re: [PATCH 05/12] net: mana: Set the DMA device max page > > > > size > > > > > > > > On Tue, May 17, 2022 at 02:04:29AM -0700, longli@linuxonhyperv.com > > wrote: > > > > > From: Long Li > > > > > > > > > > The system chooses default 64K page size if the device does not > > > > > specify the max page size the device can handle for DMA. This do > > > > > not work well when device is registering large chunk of memory in > > > > > that a large page size is more efficient. > > > > > > > > > > Set it to the maximum hardware supported page size. > > > > > > > > For RDMA devices this should be set to the largest segment size an > > > > ib_sge can take in when posting work. It should not be the page size > > > > of MR. 2M is a weird number for that, are you sure it is right? > > > > > > Yes, this is the maximum page size used in hardware page tables. > > > > As I said, it should be the size of the sge in the WQE, not the "hardware page > > tables" > > This driver uses the following code to figure out the largest page > size for memory registration with hardware: > > page_sz = ib_umem_find_best_pgsz(mr->umem, PAGE_SZ_BM, iova); > > In this function, mr->umem is created with ib_dma_max_seg_size() as > its max segment size when creating its sgtable. > > The purpose of setting DMA page size to 2M is to make sure this > function returns the largest possible MR size that the hardware can > take. Otherwise, this function will return 64k: the default DMA > size. As I've already said, you are supposed to set the value that limits to ib_sge and *NOT* the value that is related to ib_umem_find_best_pgsz. It is usually 2G because the ib_sge's typically work on a 32 bit length. Jason