Re: [PATCH v2 03/11] iommu/arm-smmu-v3: Add arm_smmu_drain_queue_for_iopf() helper

Nicolin Chen <[email protected]> Tue, 28 Jul 2026 22:26:19 -0700
Newsgroups dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <ammO+4W/[email protected]>
On Wed, Jul 29, 2026 at 05:15:43AM +0000, Pranjal Shrivastava wrote:
> For PRIQ/EVTQ, my only worry was the HW producing more events,
> say Device A is detached (we call drain from attach_release) but Device B
> (still attached) starts an agressive DMA with multiple PRI requests/evts.
> 
> Maybe we should go back to snapshot based polling for that?

If you look closely, "pending" is the snapshot, regardless of the
growing prod.

 * With @until_empty == false (for EVTQ/PRIQ), exit once "drained" reaches its
 * target: "pending" (i.e. prod0 - cons0, frozen at the entry time):
 *
 *   cons0                cons                 prod0         (prod)
 *     |<---- drained ---->|                     |             |
 *  ---+###################+=====================+=============+--->
 *     |<--------------- pending --------------->|

Nicolin