Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Yuwei <zhangyuwei20@huawei.com>
To: <quic_vjitta@quicinc.com>
Cc: <zhangyuwei20@huawei.com>, <linux-iommu@lists.linux.dev>,
	<linux-arm-kernel@lists.infradead.org>, <robin.murphy@arm.com>,
	<quic_prakgupt@quicinc.com>, <chenjun102@huawei.com>
Subject: [RFC] Partial iommu_unmap issue with contiguous PTE hint enabled
Date: Wed, 9 Sep 2026 09:40:53 +0800	[thread overview]
Message-ID: <20260909014053.493243-1-zhangyuwei20@huawei.com> (raw)
In-Reply-To: <20260804-iommu_contig_hint-v4-1-d7a47ed5db98@oss.qualcomm.com>

Hi Vijayanand,

I have a question regarding the contiguous hint patch set:
https://lore.kernel.org/linux-iommu/20260804-iommu_contig_hint-v4-1-d7a47ed5db98@oss.qualcomm.com/

We encountered an issue during partial unmapping when contiguous PTE
hints (CONT bit) are set. Here is the scenario we observed:

1. Setup / Mapping:
   - Under 4 KiB page granule, a 64 KiB memory region is mapped via
     dma_map_page() (or iommu_map()).
   - Because the 64 KiB range meets the contiguous hint requirement
     (16 x 4 KiB PTEs), all 16 PTEs are programmed with the CONT bit set.

2. Partial Unmapping Trigger:
   - Later, iommu_unmap() is invoked to unmap a 32 KiB partial range
     within this 64 KiB block.

3. Observed Behavior:
   - Calling iommu_unmap() triggers a kernel WARN.
   - Only 28 KiB is successfully unmapped before the operation halts.
   - The remaining memory in this region can no longer be unmapped,
     leading to leaked/stuck IOMMU page table entries.

4. Questions:
   - Is partial unmapping supported when contiguous PTE hints are
     enabled, or is caller-side alignment enforced?
   - Should io-pgtable (or the SMMU driver) handle clearing/splitting
     the CONT bit prior to partial unmap, or refuse the unmap gracefully?
   - What is the recommended fix or expected behavior for handling
     non-64 KiB aligned unmaps over CONT-hinted regions?

Any insights or guidance on how this should be handled would be greatly
appreciated. If needed, I can provide additional logs or help test
potential fixes.

Thanks,
Zhang Yuwei


  parent reply	other threads:[~2026-09-09  1:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  6:14 [PATCH v4] iommu/io-pgtable-arm: Add support for contiguous hint bit Vijayanand Jitta
2026-08-11  5:04 ` Daniel Mentz
2026-08-14  6:12   ` Vijayanand Jitta
2026-08-14 20:45     ` Daniel Mentz
2026-08-27  5:54       ` Vijayanand Jitta
2026-08-30 19:43         ` Daniel Mentz
2026-09-08 16:36           ` Daniel Mentz
2026-09-08 16:47             ` Jason Gunthorpe
2026-09-09  4:05               ` Vijayanand Jitta
2026-08-14 21:57 ` Daniel Mentz
2026-08-27  8:24   ` Vijayanand Jitta
2026-08-27  8:38     ` Vijayanand Jitta
2026-09-09  1:40 ` Zhang Yuwei [this message]
2026-09-09  2:18 ` [RFC] Partial iommu_unmap issue with contiguous PTE hint enabled Zhang Yuwei

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=20260909014053.493243-1-zhangyuwei20@huawei.com \
    --to=zhangyuwei20@huawei.com \
    --cc=chenjun102@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iommu@lists.linux.dev \
    --cc=quic_prakgupt@quicinc.com \
    --cc=quic_vjitta@quicinc.com \
    --cc=robin.murphy@arm.com \
    /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