Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp98006iob; Tue, 17 May 2022 20:04:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUiKnSNL5eRyuQq7HwBTrw9aSWRXKWLO2hiis5C5fgzqsdwhK27z8W4BCc+gF0TVNacySy X-Received: by 2002:a17:902:e5cc:b0:15e:84d0:decb with SMTP id u12-20020a170902e5cc00b0015e84d0decbmr24897481plf.91.1652843078276; Tue, 17 May 2022 20:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652843078; cv=none; d=google.com; s=arc-20160816; b=b2VI7fnu+FIyA2sfssRSQ7DWgDzCnY07F0KQVl2LbYSiiY3dSP7TWdXCIiMRiU3SYx HeOuOHZzKwtLTLnglsI6LZJcz0HV4l6NMY7tfHjRsChXf84DCNef2sLRUK+c+dn8X65L uZgJ8FIWO1C610mVUd3gkOI5r4L644gpvUt+zjYu0cGS9HiQ/1e6RnAFWBq8cc77dKlG McUsgdTvAvZwl8p2r+K9TSpgPMakd2L5eIMO5ajTjEzJBXSs3terKOvytgncg9O3V0uJ wf0dtwGSLrSrhdhuV1lyPt5aq0jsffwu2D5B9J4OH3yVibeK/Ct7MkJHOIJioi9EFN91 qC3w== 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=RYVJv5R1yEtGZhfg6PmBqdM3gBYqalJWGi2DTz4g5YY=; b=LaRw0AL5EXWVI/Qr4g+7FaW5fNY90LaLv3v37XcYN1/NX4HuNqkoaf3P+2/9/w4GRO K/OaNKBnh9glqvb6poRnMN2SKUU9iFhrHGJsujr+KpuJgniaTZtxtgG9CJ+6D5mVp/Dg 3zXrvg0wX/OE5UHYp54Ziq7JZ3LmwhpeCRnlRZDfUYiqm69fg3D815Wubx0cp67WnED9 Kt5EXqz1h6mmJThy1DZx4uQOv6H49IP2yguV3eTI/Z8dq+06o17grk+6taoHJfhYeTZ/ xiBjGs+S0X40BSYHt5iDvs7B5rRXouz4Iaw1K+vDpD69b7cBP+0ca2UFJIwi2kCP5/jU PgPg== 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 24-20020a630a18000000b003f25f65e382si967934pgk.658.2022.05.17.20.04.23; Tue, 17 May 2022 20:04:38 -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 S1347164AbiEQNue (ORCPT + 99 others); Tue, 17 May 2022 09:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232153AbiEQNub (ORCPT ); Tue, 17 May 2022 09:50:31 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED0B4C790 for ; Tue, 17 May 2022 06:50:28 -0700 (PDT) Received: from fraeml738-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4L2cqw2BnSz67xWY; Tue, 17 May 2022 21:47:24 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml738-chm.china.huawei.com (10.206.15.219) 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 15:50:25 +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 14:50:24 +0100 Message-ID: <1043830a-02af-bf8a-6089-0eb7a84a8e85@huawei.com> Date: Tue, 17 May 2022 14:50:24 +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> <9160031b-50be-6993-5a8e-f238391962c5@huawei.com> <8f193bdd-3a0a-f9ed-0726-e6081f374320@arm.com> From: John Garry In-Reply-To: <8f193bdd-3a0a-f9ed-0726-e6081f374320@arm.com> 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 13:02, Robin Murphy wrote: >>> >>> 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. > > Er, OK, if you're not interested in solving that problem I don't see why > you'd bring it up, but hey ho. *I* still think it's important, so I > guess I'll revive my old patch with a CONFIG_X86 bodge and have another > go at some point. Let me rephrase, I would be happy to help fix that problem if we really can get it fixed, however for my problem it's better to try to get the SCSI driver to stop requesting uncached IOVAs foremost. > >> 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. Note that this is still not a final solution as it's not always viable to ask a user to unbind + bind the driver. > > FWIW I thought that all looked OK, it just kept getting drowned out by > more critical things in my inbox so I hoped someone else might comment. > If it turns out that I've become the de-facto IOVA maintainer in > everyone else's minds now and they're all waiting for my word then fair > enough, I just need to know and reset my expectations accordingly. Joerg? It would be great to see an improvement here... > >>> 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? > > Driver-specific mechanism; block-layer-specific mechanism; redefine this > whole API to something like dma_opt_mapping_size(), as a limit above > which mappings might become less efficient or start to fail (callback to > my thoughts on [1] as well, I suppose); many options. ok, fine. > Just not imposing > a ridiculously low *maximum* on everyone wherein mapping calls "should > not be larger than the returned value" when that's clearly bollocks. I agree that this change is in violation as the documentation clearly implies a hard limit. However, FWIW, from looking at users of dma_max_mapping_size(), they seem to use in a similar way to SCSI/block layer core, i.e. use this value to limit the max SGL total len per IO command. And not as a method to learn max DMA consistent mappings size for ring buffers, etc. Anyway I'll look at dma_opt_mapping_size() but I am not sure how keen Christoph will be on this... it is strange to introduce that API due to peculiarity of the IOVA allocator. > > > [1] > https://lore.kernel.org/linux-iommu/20220510142109.777738-1-ltykernel@gmail.com/ Thanks, John