From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796147328; b=y0k9nG/KcjrTx7FdP31089Bfl9KRqU5xaQBgDoTW3++Rfg3qFBvxKKz1mZH2q5TJVgrV Ikr/rCHk08S7jaBi/+HoKQltr40qW8RwzDJ7Z68EGmvZZq2KpOPOkpxB+N6JM97H9e6Uc bmMSrYXq+ufu1uxjov15Td6hUnzrTakjZDTas2mhjrLx+5k6TwVavPgcj/+FzIq0RUsJQ CYIplk0++fjFI8AiSGn7ZIQXkt2CI671uf4j8jTO5WSGP8cX6vOQCc6Q/nfirb6RKYIJZ VjfDwO2NrRT/JXcC5x7qKZttK1saZUKFLCVzfMpMWRz6+UXXO/EAmkkHfILODpGK7ZQ== 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-Forwarded-Encrypted: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=jvuDpHIlc9005GeDLyD5mp21gPX+ou4RSamlJUD8SEnwgtPVOPGGrQ0md8JtyiWly3hA hpZEZk//am8E8nVPFcDrmqbuUujG6Yry5deuVNbVsl/oKJv9ZWSuaXZsCHvEB6qqMjokQ FhHO9H59+wvvj2mp/q7s+QffK8okyN0x+CnlAYBYpNJif0K064PcG8Nw582gaGGD+MhK6 CiBuZEypX0A8PyZhD9wxIgLjsYdj6SYJLHYn/OlS5cOW/W1NNu0y1OnA37xZrbkqjOqwv SghiqeNO99Hepnngr37591m194PzOe0JK/kifPwSnR0NHm6kX3v7I4XhY9kPv4ti+3w== 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=NXuyogAJ; arc=none smtp.remote-ip=209.85.215.169 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 BED87606A320 for ; Tue, 1 Dec 2026 17:48:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BED87606A320 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=NXuyogAJ Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-cdadf7e248aso5495482a12.3 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=vger.kernel.org; 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=NXuyogAJwSIkWiEQCkNoVpapPOWMJ5+maJpDZF0/tXOC2hFWN1DWFG2jWNvlszcMdv mtEIqmDkQYu/zk5OoiOXfhq+IX7DkeCbJuOTbCRtTlfGM/M3y4njOqo8ecFTp+Xn/2yo OCWcHIRK3sR9dLjJXM4ue5hLKHhNUosjevuQYx+tOde5pKflIpyP8frYH7SICLjulSep tD+tEyCvmTvhk7dxwVHvGUiymkyzKWmNrS6sSAwrmABNIfDyloVTh+6TA3t1M2IZSVsU Sa7q3qEGc7zwV6szEDbjDg7bQb3VepZgcVsD2o7fBWYeJ3IW1+TwRyEjGoMaofdEzhVw Q+tQ== 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=I4TjrHzTPa9ZVHOqyHx5eYWJZpXR5y0Fo0e1VrMzzZw1+I54FL1oDxnbWO6i/yQHyu llbYTDjRr0V2gwzepyeotVGmrSqWgXJCYWCOstB9hRd7l0i0S4swh0WaRZTvFwzFOE5P ohB2u10gEz86qOn3yEECypxDsFTnwaNAaY8f1W7DN4he7mQW5jTs6L5LpWRxaTtEdvDf rP+8mLHbr+E/4yYxKf0qfgUeoHhTk/3AC1n8IOiIabYNO/+y9JpvRMA24+XNzOhFqz9Z wuSd7oATF0YiQQjHrr02f4Yjv9ODtugZJGvFEA7gXCKpUnqIgEbQmi/1Nw9SpfPPwJgN 6tVw== X-Forwarded-Encrypted: i=1; AL+hErErjwqCIIXam67/+Q5t0N5HHu7WuG/boonFx3yhl6mvBU/170B247x09RK/Sq491FSIEPgVQ897acU6hU4=@vger.kernel.org X-Gm-Message-State: APuU4Z+U14tfmEE0fSp6Zo3a5Lq+p4s1eBlDvPpcSAv6daJVIk6YwLT6 s251jgVQsFGEIq70tElBr7ztVT85hpCsZmBBVCTJlzWNfKoO5iNCPpIV8aQereWsWq8= X-Gm-Gg: AZFdTZeicbTrUloIJK9xg4DmQV4TYz+uHZvp1cIjuk7aYm/9Gx3RkPRpAz4gZzKDoGE c06ad/4OIbx1v/IiPa6jfpzkSD9j6EAcvpFVrStpZtrAJ0gj2w+H6WZMn/uuupUGlWzh+2WN3wI W6E0iAFoj9I6MK9QVtB46qhrgujExZIptx/YVQC4ULfQkKLqdI2SbVDLU6mcduK9LGW7I398QmH d+oJATzDN9EkzTJuuqh4u4/ACFmbpIpm1/77kyK9lsja+ovOs9cjBeuWieQ6PkfWQq6DmU8nblN gZjx4EqIgFWpf8crXhVFb3xy8oRIatmhJXuxTj9KUpG9qPgeKYLIBHVtGwRbG5OQZSQXNJO1QlR dWLNkCBtn4I7K1EeAO5OGN5wJa59pqXl+S3BKgAEfIy3+EYR5BvTtIh4netDfDi5ZDfKk1tER/Z 6jvdnjXPPK/hTuMytL+tEE0J3ik9t16bizhosGS70g0wxAtGVoEnwiUaHOpEans2N9cIl/zk0we k1z+5uLJ5s5Bc2LQvN7iPTPX2qKDnh5rG7gqCeMxSWAKO6T3gs2n9AtCC9QRu6J0WegFKR61+o3 Vw8An/sWH8hbVw9MR4rhl+PEwcs= 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: linux-kernel@vger.kernel.org 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