Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3978608iob; Tue, 17 May 2022 11:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeN/1RWzM5e7CZpzIUQqExdotl9AYZLPqGBavfVKNVjc7TCcDVyuCqrpeuY/i3EKnxcGqQ X-Received: by 2002:a17:90a:343:b0:1cb:234a:a975 with SMTP id 3-20020a17090a034300b001cb234aa975mr37610749pjf.83.1652810688945; Tue, 17 May 2022 11:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652810688; cv=none; d=google.com; s=arc-20160816; b=IWh/LssXktse/Phr7hW8JWTUzVqt7JfCIaBVySMMr63iofhADLWcL69yuGWUfe0x7j kfxdrQwUsNhhYypOagDB/VCBMYQWXukuQhDYV6Jnv8DyL+Qu4e2ba1sw7cqbpU3i8hNB 24JZAoRBcIg/VfDjOcvQwv2uRK6YRkLgSYE+H+h+JJq8K1H84kwVZc+0YsKL9JRS2uV8 aKTq+ugHq2+Y0MJXT+o81R5r9c+zqPwHVFwyY8kFycJgEprl7TyGZlb0y0o6rYnDd0YG P1wJDKAzwBd2x3dUG4/7r40bgvWE+ClTuYFufx19m80oW7EhQpaagCwShBqzv/LwXJI0 ywoA== 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=tQGysoVizFaWBnaG3G61vmUD2D+lkJwZuOpJt7j3KYk=; b=cJGG+gIbkncuVD+BS/AuqVmpxSklDghdem/dT6xlf3weOQRzjA2NQt7JJ8kOLClGem Vy5UIS4HW8WeA1jFgQFxp8exlFCVoesFVQSZFIqRor0n7vvK7M6nEj/5JFsnPM/ngLmK /5Qvt6o54/4if7QXZYTGZOuSxV1FyKHUCRWpfGtodvDm1XsQKBLBrxF+M3c428XEzrMC EE5u+EWhZqlmlTT4W1jsTbHWHdzNlQCowDkVbWPR26HnIVbifv+DzdIyx+gO1OMs6qfz EBIzZNc2QBij23AuNLYBvmD01QD+k6Tr//NlhhQCAwrvMedra4/b7s7yWrjcM6iiEpCM MNcA== 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 bx2-20020a17090af48200b001d291084911si3372676pjb.151.2022.05.17.11.04.34; Tue, 17 May 2022 11:04:48 -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 S1345143AbiEQL02 (ORCPT + 99 others); Tue, 17 May 2022 07:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbiEQL01 (ORCPT ); Tue, 17 May 2022 07:26:27 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE88222A9 for ; Tue, 17 May 2022 04:26:25 -0700 (PDT) Received: from fraeml734-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4L2Yj52qykz689TL; Tue, 17 May 2022 19:26:17 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml734-chm.china.huawei.com (10.206.15.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 17 May 2022 13:26:23 +0200 Received: from [10.47.88.19] (10.47.88.19) 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; Tue, 17 May 2022 12:26:22 +0100 Message-ID: <9160031b-50be-6993-5a8e-f238391962c5@huawei.com> Date: Tue, 17 May 2022 12:26:21 +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: [RFC PATCH] dma-iommu: Add iommu_dma_max_mapping_size() To: Robin Murphy , , , , CC: , , , , References: <1652706361-92557-1-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: 7bit X-Originating-IP: [10.47.88.19] X-ClientProxiedBy: lhreml743-chm.china.huawei.com (10.201.108.193) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.7 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 17/05/2022 11:40, Robin Murphy wrote: > On 2022-05-16 14:06, John Garry wrote: >> For streaming DMA mappings involving an IOMMU and whose IOVA len >> regularly >> exceeds the IOVA rcache upper limit (meaning that they are not cached), >> performance can be reduced. >> >> Add the IOMMU callback for DMA mapping API dma_max_mapping_size(), which >> allows the drivers to know the mapping limit and thus limit the requested >> IOVA lengths. >> >> This resolves the performance issue originally reported in [0] for a SCSI >> HBA driver which was regularly mapping SGLs which required IOVAs in >> excess of the IOVA caching limit. In this case the block layer limits the >> max sectors per request - as configured in __scsi_init_queue() - which >> will limit the total SGL length the driver tries to map and in turn >> limits >> IOVA lengths requested. >> >> [0] >> https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizhen@huawei.com/ >> >> >> Signed-off-by: John Garry >> --- >> Sending as an RFC as iommu_dma_max_mapping_size() is a soft limit, and >> not >> a hard limit which I expect is the semantics of >> dma_map_ops.max_mapping_size > > Indeed, sorry but NAK for this being nonsense. As I've said at least > once before, if the unnecessary SAC address allocation attempt slows > down your workload, make it not do that in the first place. If you don't > like the existing command-line parameter then fine, > there are plenty of > other options, it just needs to be done in a way that doesn't break x86 > systems with dodgy firmware, as my first attempt turned out to. Sorry, but I am not interested in this. It was discussed in Jan last year without any viable solution. Anyway we still have the long-term IOVA aging issue, and requesting non-cached IOVAs is involved in that. So I would rather keep the SCSI driver to requesting cached IOVAs all the time. I did try to do it the other way around - configuring the IOVA caching range according to the drivers requirement but that got nowhere. > > Furthermore, if a particular SCSI driver doesn't benefit from mappings > larger than 256KB, then that driver is also free to limit its own > mapping size. There are other folks out there with use-cases for mapping > *gigabytes* at once; you don't get to cripple the API and say that > that's suddenly not allowed just because it happens to make your thing > go faster, that's absurd. I'd say less catastrophically slow, not faster. So how to inform the SCSI driver of this caching limit then so that it may limit the SGL length? Thanks, John