[PATCH v5 05/15] iommu/arm-smmu-v3: Flush in-flight fault work on domain detach
Jason Gunthorpe
jgg at nvidia.com
Wed Sep 23 11:37:05 PDT 2026
> [ ... 54 lines skipped ... ]
> @@ -3422,8 +3423,38 @@ void arm_smmu_attach_release(struct arm_smmu_attach_state *state)
> * which the IOMMU core might free once this returns. Drain the hardware
> * eventq, so that a pending event cannot turn into new fault work.
> */
> - if (master_domain->using_iopf && master->stall_enabled)
> - arm_smmu_wait_for_queue_drained(smmu, &smmu->evtq.q, false);
> + if (master_domain->using_iopf && master->stall_enabled) {
> + timed_out = arm_smmu_wait_for_queue_drained(smmu, &smmu->evtq.q,
> + false);
> + /*
> + * Ensure pending events have reached the IOPF queue, unless
> + * the drain timed out: a stuck consumer would also block an
> + * unbounded wait_event() inside the synchronize_irq().
> + */
> + if (!timed_out) {
> + if (smmu->evtq.q.irq)
> + synchronize_irq(smmu->evtq.q.irq);
> + /* Pending events might be in the combined_irq handler */
> + if (smmu->combined_irq)
> + synchronize_irq(smmu->combined_irq);
> + }
I think this logic is overkill. If we can't flush the queue we are
probably going to crash next. Chuck a warn on and hope for the
best. We don't need this fancy half attempt at recovery.
--
Jason
More information about the linux-arm-kernel
mailing list