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 95BD0C43334 for ; Wed, 8 Jun 2022 17:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbiFHRuk (ORCPT ); Wed, 8 Jun 2022 13:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbiFHRuh (ORCPT ); Wed, 8 Jun 2022 13:50:37 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8F957985; Wed, 8 Jun 2022 10:50:34 -0700 (PDT) Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJF8r2xCyz67VbM; Thu, 9 Jun 2022 01:49:16 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml713-chm.china.huawei.com (10.206.15.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 19:50:31 +0200 Received: from [10.47.90.54] (10.47.90.54) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 18:50:30 +0100 Message-ID: <31417477-953d-283e-808e-cf8701e820a8@huawei.com> Date: Wed, 8 Jun 2022 18:50:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v3 3/4] scsi: core: Cap shost max_sectors according to DMA optimum mapping limits To: Bart Van Assche , , , , , , , , CC: , , , , , , , References: <1654507822-168026-1-git-send-email-john.garry@huawei.com> <1654507822-168026-4-git-send-email-john.garry@huawei.com> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.47.90.54] X-ClientProxiedBy: lhreml744-chm.china.huawei.com (10.201.108.194) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On 08/06/2022 18:33, Bart Van Assche wrote: > On 6/6/22 02:30, John Garry wrote: >> +    if (dma_dev->dma_mask) { >> +        shost->max_sectors = min_t(unsigned int, shost->max_sectors, >> +                dma_opt_mapping_size(dma_dev) >> SECTOR_SHIFT); >> +    } > > Since IOVA_RANGE_CACHE_MAX_SIZE = 6 this limits max_sectors to 2**6 * > PAGE_SIZE or 256 KiB if the page size is 4 KiB. It's actually 128K for 4K page size, as any IOVA size is roundup to power-of-2 when testing if we may cache it, which means anything >128K would roundup to 256K and cannot be cached. > I think that's too > small. Some (SRP) storage arrays require much larger transfers to > achieve optimal performance. Have you tried this achieve this optimal performance with an IOMMU enabled? Please note that this limit only applies if we have an IOMMU enabled for the scsi host dma device. Otherwise we are limited by dma direct or swiotlb max mapping size, as before. Thanks, John