Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp993103ioo; Sat, 21 May 2022 23:39:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIhxEjGr51PIOr0wsuQCVQOKXRYqj5k+oAMFnW4V6GsLSIFCOYv3U43Nxz/m9WzBq5NJXG X-Received: by 2002:aa7:d619:0:b0:42a:af7b:eda7 with SMTP id c25-20020aa7d619000000b0042aaf7beda7mr18385671edr.235.1653201542031; Sat, 21 May 2022 23:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653201542; cv=none; d=google.com; s=arc-20160816; b=SvQZbbinSPcuCi6XDtrLUsrnBkTueEdb7jccpfCET4opQm71hpwWxhljqP5ZnKjrKX 9+QmjXn/NvhK8Z84pmoojDmNoiAJ2baqt0w66oQLI+PSq9nykXoXDjBQ0SpameUle1UH BkizDC7mhKlBx3U8MSYIg4Ln67tq4dXx7zpQom5RWiVHVOS21aAaOZ/YbJ81JxF/aEiY dgYtGUp4BSU8xW4OPnDzOgilIvaJvGxM0Hybn3SU9sHPslObVr4VIM0lBnT6pXA4TxFs gBSxrcIC8GnjSVEEWG/ZllYyNyn2NABc6TbV7ScccdJ+azwkNC0OI7xMsX3tHrzgDlll U0Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=EvJrYdj/LFS6h9wGgXVrfGitFLi/IACZTKGnY0/6E7Y=; b=FjjX2P1sgblQQjm0yxVtTRHQFyhZv6huH97LTsHSsV8QecU9amREogZ9Vc75J8+aQ0 hPuuqHp8iUX5qd/8C9YBKad3yxTlwmNpRf5/OUuaaJj74qXGV3l7ZEUh+0H2Pq5jWpnw Ep/QWvHT9gNoEuswmUwyCiqB+BqL7Ow5ijTDySzaTwe+YIJU0kJCT2E1KIcCdli4eGOk YacxwXHyRdpKX55gGmoILaPGIXEUEzVJFG1Dlld3YhIPRKkUAfUJvSZUh6e0wuqmNSv0 SEYzhjGFFi0huRtvl9W0gsN/tnfJxEBHqaP1ZJc52kgsBFMZEfir0o0xAryD5ZtYxVbA L5iw== 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=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bl3-20020a170906c24300b006fe7bc6e3a7si10779345ejb.769.2022.05.21.23.38.36; Sat, 21 May 2022 23:39:01 -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=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347397AbiETIwC (ORCPT + 99 others); Fri, 20 May 2022 04:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344968AbiETIwB (ORCPT ); Fri, 20 May 2022 04:52:01 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C335DD00 for ; Fri, 20 May 2022 01:52:00 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id BC47C1E9; Fri, 20 May 2022 10:51:58 +0200 (CEST) Date: Fri, 20 May 2022 10:51:57 +0200 From: Joerg Roedel To: Christoph Hellwig Cc: Robin Murphy , John Garry , will@kernel.org, m.szyprowski@samsung.com, chenxiang66@hisilicon.com, thunder.leizhen@huawei.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, liyihang6@hisilicon.com Subject: Re: [RFC PATCH] dma-iommu: Add iommu_dma_max_mapping_size() Message-ID: 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> <20220518131353.GB26019@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220518131353.GB26019@lst.de> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Wed, May 18, 2022 at 03:13:53PM +0200, Christoph Hellwig wrote: > On Tue, May 17, 2022 at 01:02:00PM +0100, Robin Murphy wrote: > >> 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. 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. > > Well, for swiotlb it is a hard limit. So if we want to go down that > route we need two APIs, one for the optimal size and one for the > hard limit. I agree with Robin, and if it really helps some drivers I am all for doing a dma_opt_mapping_size() instead. Limiting DMA mapping sizes to make drivers perform better gets a clear NAK from my side. Regards, Joerg