Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2734489iof; Wed, 8 Jun 2022 10:54:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXfmpJtY3mDx0SNi7abysELKhAjK4pieLWg2IcXkIakeX4EHmISDfugPeqN1Knh/9agU+B X-Received: by 2002:a17:906:4fce:b0:6f4:f41c:3233 with SMTP id i14-20020a1709064fce00b006f4f41c3233mr31153532ejw.117.1654710881089; Wed, 08 Jun 2022 10:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654710881; cv=none; d=google.com; s=arc-20160816; b=pbKWjxxh1GEYnLx8pF0F9YnktKqb1uQsFSgBIkd0W0i03NDGH9bIhWE3HgluqM7IIw +Mv0KovKN+7LK+PpuP8ANsdV+jM3oMabzwvZoggnXqGmaBX974fEtCLRzD79B+/ZuGES a4NDMYHCvFBR9z0irWVGKxfJdOlRiCfD4SfUVxNo7yz1meuafemoCwP91/zvCoxgPSc0 bhj33X4bSGAbU7CMj1PpY/tnp1RdyOW84AHSVOSonHOrZOvgIbVNRG25QkVd7ZXFQOUt 7vn8FqGEtUC/HFutoXh6xVFp5g+r0T320Opm6E45/7Aism1+ELu0iEZlWYh3sn63/gBs 0O8g== 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:user-agent:mime-version:date:message-id; bh=iyWg3gfWk2x7cttdhiTTbV0SGVuCPZx/PjI7YsXs3iE=; b=dY/C/dorwCdvTw0iHtoLXxQ5x4BHTzZeb1+NUUYqaWf/Bjr5dp4U7EZ+ilsDsLxsyq ECWOpLq1ywTOtEM28PdK1uUzCeNWKIP4VjpgEHyagEmhMB01rx6Fw46BT9kjjyvHPUre C1L4cRm21jWXNWdZWbg37JvBKoPxV50oasZr8uRwTBX/THKCJNHDZ5P6W02LHk8HEUmf DGzniYQgg0mTwqvXNhkFO29eCi0vSJR0ulE4BmyW+wQ77zQ3/KUPMhnZSnqZwqOP+WX6 mKtmat1LfrDUkus3m5JhH3N9U7e1BsfPDdXY7zECMTUN13N+ktwhqJKB/SCqVhZetGeI NQgg== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020a17090658d600b006fecdce291dsi2534491ejs.520.2022.06.08.10.53.44; Wed, 08 Jun 2022 10:54:41 -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; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbiFHRul (ORCPT + 99 others); Wed, 8 Jun 2022 13:50:41 -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 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@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