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 D30FFCCA482 for ; Thu, 23 Jun 2022 08:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230282AbiFWIgZ (ORCPT ); Thu, 23 Jun 2022 04:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbiFWIgT (ORCPT ); Thu, 23 Jun 2022 04:36:19 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2A6048E57; Thu, 23 Jun 2022 01:36:17 -0700 (PDT) Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LTD9H0dZ7z684wN; Thu, 23 Jun 2022 16:35:47 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.24; Thu, 23 Jun 2022 10:36:14 +0200 Received: from [10.195.245.183] (10.195.245.183) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:36:13 +0100 Message-ID: Date: Thu, 23 Jun 2022 09:36:12 +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> <31417477-953d-283e-808e-cf8701e820a8@huawei.com> <5b214e95-dd95-551a-496e-a2139a74e8eb@huawei.com> <9b1d155e-28cc-08dc-5a5a-8580132575e7@huawei.com> <23bf4427-41c3-bf1d-903a-75928bb47627@acm.org> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.195.245.183] X-ClientProxiedBy: lhreml705-chm.china.huawei.com (10.201.108.54) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/06/2022 16:37, John Garry via iommu wrote: > >> On 6/9/22 10:54, John Garry wrote: >>> ok, but do you have a system where the UFS host controller is behind >>> an IOMMU? I had the impression that UFS controllers would be mostly >>> found in embedded systems and IOMMUs are not as common on there. >> >> Modern phones have an IOMMU. Below one can find an example from a >> Pixel 6 phone. The UFS storage controller is not controller by the >> IOMMU as far as I can see but I wouldn't be surprised if the security >> team would ask us one day to enable the IOMMU for the UFS controller. > > OK, then unfortunately it seems that you have no method to test. I might > be able to test USB MSC but I am not even sure if I can even get DMA > mappings who length exceeds the IOVA rcache limit there. I was able to do some testing on USB MSC for an XHCI controller. The result is that limiting the max HW sectors there does not affect performance in normal conditions. However if I hack the USB driver and fiddle with request queue settings then it can: - lift max_sectors limit in usb_stor_host_template 120KB -> 256KB - lift request queue read_ahead_kb 128KB -> 256KB In this scenario I can get 42.5MB/s read throughput, as opposed to 39.5MB/s in normal conditions. Since .can_queue=1 for that host it would not fall foul of some issues I experience in IOVA allocator performance, so limiting max_sectors would not be required for that reason. So this is an artificial test, but it may be worth considering only applying this DMA mapping optimal max_sectors limit to SAS controllers which I know can benefit. Christoph, any opinion? thanks, John