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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 193B9C52D7C for ; Fri, 23 Aug 2024 15:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z6pk1UL3fRTH9Ji085RPbIrifTTX3NzzgAezYbbN/U8=; b=EMckMGtWCi172VNgqOJl2e6aDi UB6GBtDtsphDHURloGxwCgB9nPXXJBiR97pAZUNGk+7QxkF9TvCdCW0ty7D9m3cOluAgX5PcA4nyK oqSj7bSomdBIBn8EzdAeBYhL9VoD3sMIAbzviZg7Y04WZhVYX7+UXsNdnUN/wd1dsWkDs7BQ8QXqw VTcdHvjAV2rgPrDoDiyFSPHfG1oJGJg+F92MEWQXDPJSjmiyueFXQODa0fV/2F/HGKdQ0g+IHyfc5 QKlU1cdrZiHqzvHK4frgGJ5PIWXiWl1tmnejKbkWHdIcoi2rUU/9oHmRpgGhOcgpOAiKpd8nnKBK8 gntaVGag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shWcw-0000000HPmv-3tuM; Fri, 23 Aug 2024 15:55:02 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shWc0-0000000HPcm-3wsi for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 15:54:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 353CFCE0E20; Fri, 23 Aug 2024 15:54:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0485C32786; Fri, 23 Aug 2024 15:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724428442; bh=Oknf7Bh9HhKv0p492TrRsH9RWzKQ8QEpPRIapU/vtx4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LOaBFcd86Xy8xkLlgveZzv5oo4gHNIAjYJKRrV+TC2Bha+Q2oqc9RS+z+rkF4CG2r B5sh76TgNhE4pN1HNDODQfBdpvhseP3oeLf/V0phOsnkC5hYiwMbjJsfMPriDnpFr1 1EElvFr60JqEx3pGRRsrwoGDMLKE7F2QsZnMtzWB5Q/WS/hPsK4+GUslyCRxbLUGht XO+yjRD7jZRykvbhuEAS1i5EBdSN5H5NjKTvTxqSBV4T7lUoAzYdSgLPfQhTWXGw2D QHPbQkcTkw6x9vSWAi+n/+lSqRlxg5S//qG88Jksy+7Ri/hrEtpjWPn2zUoehjlYa9 jvQ1MPNHFTRYA== Date: Fri, 23 Aug 2024 16:53:57 +0100 From: Will Deacon To: Ashish Mhetre , joro@8bytes.org Cc: robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH V4] iommu/io-pgtable-arm: Optimise non-coherent unmap Message-ID: <20240823155357.GC525@willie-the-truck> References: <20240806105135.218089-1-amhetre@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240806105135.218089-1-amhetre@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_085405_206847_A88A171C X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 06, 2024 at 10:51:35AM +0000, Ashish Mhetre wrote: > The current __arm_lpae_unmap() function calls dma_sync() on individual > PTEs after clearing them. Overall unmap performance can be improved by > around 25% for large buffer sizes by combining the syncs for adjacent > leaf entries. > Optimize the unmap time by clearing all the leaf entries and issuing a > single dma_sync() for them. > Below is detailed analysis of average unmap latency(in us) with and > without this optimization obtained by running dma_map_benchmark for > different buffer sizes. > > UnMap Latency(us) > Size Without With % gain with > optimiztion optimization optimization > > 4KB 3 3 0 > 8KB 4 3.8 5 > 16KB 6.1 5.4 11.48 > 32KB 10.2 8.5 16.67 > 64KB 18.5 14.9 19.46 > 128KB 35 27.5 21.43 > 256KB 67.5 52.2 22.67 > 512KB 127.9 97.2 24.00 > 1MB 248.6 187.4 24.62 > 2MB 65.5 65.5 0 > 4MB 119.2 119 0.17 > > Reviewed-by: Robin Murphy > Signed-off-by: Ashish Mhetre > --- > Changes in V2: > - Updated the commit message to be imperative. > - Fixed ptep at incorrect index getting cleared for non-leaf entries. > > Changes in V3: > - Used loop-local variables and removed redundant function variables. > - Added check for zero-sized dma_sync in __arm_lpae_clear_pte(). > - Merged both patches into this single patch by adding check for a > NULL gather in __arm_lpae_unmap() itself. > > Changes in V4: > - Updated the subject in commit message to correctly reflect the changes > made in this patch. > --- > drivers/iommu/io-pgtable-arm.c | 31 +++++++++++++++++-------------- > 1 file changed, 17 insertions(+), 14 deletions(-) Acked-by: Will Deacon Joerg, please can you pick this one up for -next? Cheers, Will