Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yuho Choi <oss.patchbox@gmail.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Tomasz Jeznach <tomasz.jeznach@linux.dev>,
	iommu@lists.linux.dev
Subject: iommu: TLB sync timeouts and page table freeing on unmap
Date: Thu, 22 Oct 2026 13:54:07 -0400	[thread overview]
Message-ID: <20261022175408.52254-2-oss.patchbox@gmail.com> (raw)

Hi,

While looking at how IOMMU drivers handle TLB invalidation timeouts, I
noticed that several of them only log the timeout and carry on. For
example, ipmmu_tlb_sync() in drivers/iommu/ipmmu-vmsa.c (v7.3):

	if (read_poll_timeout_atomic(ipmmu_ctx_read_root, val,
				     !(val & IMCTR_FLUSH), 1, TLB_LOOP_TIMEOUT,
				     false, domain, IMCTR))
		dev_err_ratelimited(domain->mmu->dev,
			"TLB sync timed out -- MMU may be deadlocked\n");

and qcom_iommu_tlb_sync() in drivers/iommu/arm/arm-smmu/qcom_iommu.c
does the same. On unmap, __arm_lpae_unmap() in
drivers/iommu/io-pgtable-arm.c frees a page table right after the walk
flush:

	io_pgtable_tlb_flush_walk(iop, iova + i * size, size,
				  ARM_LPAE_GRANULE(data));
	__arm_lpae_free_pgtable(data, lvl + 1, iopte_deref(pte, data));

and the IOMMU core and its callers release the data pages after
->iotlb_sync(). Both callbacks return void, so a driver cannot stop
that when the invalidation did not complete.

Is a TLB sync timeout considered fatal enough that this does not
matter, or would you take changes in this area? For example, a driver
could record the failure and fail later map requests, as [1], or 
these callbacks could be allowed to return an error.

This came up during static analysis for research that is not yet
published; I have not seen such a timeout on hardware. I'm happy to
send patches if one of these directions is acceptable.

[1] https://lore.kernel.org/r/e2b13e82-f762-4fb0-83cb-d4bef57be427@linux.dev

Thanks,
Yuho

             reply	other threads:[~2026-10-22 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 17:54 Yuho Choi [this message]
2026-10-23 15:47 ` iommu: TLB sync timeouts and page table freeing on unmap Robin Murphy
2026-10-23 17:00   ` Yuho Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022175408.52254-2-oss.patchbox@gmail.com \
    --to=oss.patchbox@gmail.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=robin.murphy@arm.com \
    --cc=tomasz.jeznach@linux.dev \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox