From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796147328; b=ta+s0/gjsci4gpnmPyQDLwrqNFJWQz8fQPZjPTfQ+K0Rv2vwt46/vKX2Rzhnhe34TP8N AvjogWTaNbeIGKqlTfRy8ynZWU8bLW9nm/O2VzCfmMhuqYcqsiUqR8cIwti6rmettRr6Y snuisznDu8gAlsiT/j8ehfhsUF8+LN3nTOHz0CooRUQxHmaJV22Uvjeh3YjfuBhoz1Alt 7D8eJ4000vk88tI7nUebcekoiH+ZNe4DLxAbMAeAyLOC9s/TMaRZJ5bw33rKqWyg7HGBp oQVnh1EwB8jT1JbPphRXwvfll7r9uPyVG9ljb3SrUF3l0z2adGPEjcfeWVipYsPzidg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796147328; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=pwY94FD+wAfnQe+yKfrMMs0U0uy3MIFMU0+AIhkDqM0=; b=4vyBlp69zbx+I9r/c5fAJz5WY4/NinCKV2PnIle1TdUTbwpr1oWqN4aDAOM5lBNGWEVJ OuziX4pd1XlgIapUCDnKOLiGWSgqOPMq91MdUQSNl0sHookvGRajYgBAjABo5dTWek5cZ BXpLxg6Q6t3HsggLaNfvJZZH5C2VpDBqZs/AAtc6rfCeHjVHbQTuNLHgdhMNF8oOCoVbr dJQOLMTOpjtaN80NDSwowXiEuXPhVXzw7ribFkqi+YDamU7cRQtXbmm28qAhw2ZW9/JZQ fjclmLnRPtcmz7+lq5OXPKc/VdQ8n9WL0z6WRvp9ep2riN7B0Qq+IShIGw9WBWy1T6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Q86R+RSL; arc=none smtp.remote-ip=209.85.215.177 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBA3B606A31A for ; Tue, 1 Dec 2026 17:48:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BBA3B606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dama-to.20260707.gappssmtp.com header.i=@dama-to.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Q86R+RSL Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-cdba1bbde0bso4752696a12.2 for ; Tue, 01 Dec 2026 09:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20260707.gappssmtp.com; s=20260707; t=1796147327; x=1796752127; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pwY94FD+wAfnQe+yKfrMMs0U0uy3MIFMU0+AIhkDqM0=; b=Q86R+RSLglj8RZ2uDU2LjzzI5M2HkV4l9RSRAmJUvfR4jc63AqqmiO7DPuGKu60LBM 9oxNOUmpD8KaLwPijTE9HRANG0t0vWuWRVbWf8ehk04fWG5Jh88Kh0Khzzqp9HkuSgJI FuS52TP40zC0/l/meHGafP/SChe/S8Et+p3gXvAbvtB2kvynlLefktn/jfusnjR2mLwv OmP5qsSBg8D1ynTES4YyJG4wiL9Mafo7ixDJJLAw0xH05wBGaxJ1TrAJDdEz4CLb0Sg5 LP/K4/y+NdaMgo3tm/x12onCiryaynSbsW0XdLPq43nrSaQAjn4HJlEhtINUpYJ/W3FC VcxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796147327; x=1796752127; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pwY94FD+wAfnQe+yKfrMMs0U0uy3MIFMU0+AIhkDqM0=; b=EB5voGUVptj3lCFTu2QI8DSqrwdakV4aebbbphVR8JAPJINGvQ482C3TfRfCzhZz6S F8Twx3hzyOho2WBgwi12qTBAKd4utA56F9VkR7t/SelXwwHDItHSRWA+FuAKUBe9iDqw NvbWDB4UWks80R3T3JpavLCO3SyRbhEbPzRrfJcn8GzM2yH8zU/937N038ENNAwljqm8 2TQkq6VJQTicX1YycMPi/hqUeseIK1BfzKmsu10PRRpE+yCeay+cksDUQ4v7kT+9IpDl pSSfbV2HYmonawwcFpiShl0+kOaWjBvgbgovzYEv1CJ8eJqwJW1o1JFtkBzIHFd1HiJX JmqA== X-Gm-Message-State: APuU4Z9Xxwzox9DomFNM13FyB2nKKwi6CAW1LP6h3+qFQzPNaIOQz4Dh CpICFjoxyv7apEUdLh5fZDF0evgl8LfHKuSMsJKE+YLw9ctLr5aa1IhfcvYGItSX4eRFsxyz12/ SV/S2 X-Gm-Gg: AZFdTZeJM4S+vWLjbAbnyDb9Vja8istUWO5IU7IGjtxvesS4z3h65ArNbmevPO0VKC/ qbopVQRWPQksN9nhQ7E54yq0RdKdacvj3C5wuIdRj31vjfbgmlGTFL2MbIxFSK/sC2U6h0ejVJC e56wgH5sZyykSCBEafhXRItFzVK/giGMRd+Z1LB8JaZ1Q+jv3HwYusRWFKbUoMjEOHE2wZx/ITD 4NpFjFyYrmnQAexpWz544CqErxwKgIozu2pgNzzV7XAZAvhOShBtYuQzVes7lth7c+bCb2r6DjM F6Q4dXSaoALrH3ZAJFsL9YLaVTtrRw6sQCxv/1W3/0BoBhsKckC6jMk4qc2j5K9GrpVNNuW/YFy 9GfKiVjkQETWYovv/tCUGc+MWhFyFXNvNauTHKLIGkP+cVvFssus3FYRr0H6g+8k9cMMftt7o1d 3RLDK1oq+MxbS8bF3QcXFcpS1g3GXiaKBUmVbPp7JB0sh22AIbA1QQuUIE4e0TCkADOV9lchAyQ Kbf8yVuz9mNJwU9INcgE5yval5F/xuNg80QyGR0hsTrr6RcFDRC6aJqBKCG5bIyzZNF7UTkJ/8Z yh7kFbdf1hM8NLp4fQi7ul5ddO8= X-Received: by 2002:a17:90b:39a7:b0:3b3:bb55:d9c with SMTP id 98e67ed59e1d1-3b41c7b5dfamr37400538a91.2.1796147326028; Tue, 01 Dec 2026 09:48:46 -0800 (PST) Received: from localhost ([2a03:2880:2ff:49::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b4afeaaa84sm43017592a91.10.2026.12.01.09.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 09:48:45 -0800 (PST) Date: Tue, 1 Dec 2026 09:48:44 -0800 From: Joe Damato To: iommu@lists.linux.dev, "Joerg Roedel (AMD)" , linux-kernel@vger.kernel.org, Robin Murphy , Will Deacon Subject: Re: [PATCH 0/2] iommu/dma: Skip iova_to_phys() on unmap for coherent devices Message-ID: References: <20261106175745.3362057-1-joe@dama.to> X-Mailing-List: iommu@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261106175745.3362057-1-joe@dama.to> On Fri, Nov 06, 2026 at 09:57:41AM -0800, Joe Damato wrote: > Greetings: > > iommu_dma_unmap_phys() calls iommu_iova_to_phys() on every unmap, which > walks the IOMMU page table. The physical address it returns is only used > for devices that are non-coherent or use a swiotlb. > > For a coherent device that does not use swiotlb, the lookup is not > needed. iommu_dma_sync_single_for_cpu() and > iommu_dma_sync_single_for_device() already skip it for these devices, as > does __iommu_dma_iova_unlink() for the dma_iova_link() API. > > Patch 1 factors the check out into a helper. Patch 2 uses the helper to > skip the lookup in iommu_dma_unmap_phys(). > > I split this into two patches because I thought it would make review and > bisect easier, but I can make them a single patch if needed. > > One behavior change: for these devices the WARN_ON(!phys) in > iommu_dma_unmap_phys() is no longer reached, so unmapping an IOVA that > is not mapped no longer warns there. CONFIG_DMA_API_DEBUG still catches > this class of driver bug. > > I tested on prod hosts serving TX heavy network traffic, which unmaps TX > buffers on completion. > > Intel Xeon Gold 6138 (Skylake), VT-d: > > - iova_to_phys() on unmap: 119-143 ns per TX packet (~0.5% of busy > CPU) before, 0 after > > AMD EPYC 9334 (Genoa), AMD IOMMU: > > - iova_to_phys() on unmap: ~10 ns per TX packet (~0.1% of busy CPU) > before, 0 after > > So, the performance improvement is small, but measureable. The proposed > change removes redundant work in the unmap, though, making it match the map > path. > > Thanks, > Joe > > Joe Damato (2): > iommu/dma: Add helper for coherent devs without swiotlb > iommu/dma: Skip iova_to_phys() on unmap when unneeded > > drivers/iommu/dma-iommu.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > > base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1 Hi: Just wanted to ping on the above. Sorry, I think my git settings were a little off and I realized my cover letter had no To line. Not sure if I need to resend the series or not, but I haven't heard anything in a few weeks. Thanks, Joe