Re: [PATCH v5 04/15] iommu/arm-smmu-v3: Drain in-flight fault events on domain detach

From: Jason Gunthorpe

Date: Thu Sep 24 2026 - 10:12:44 EST


On Wed, Sep 23, 2026 at 06:42:42PM -0700, Nicolin Chen wrote:

> There is a problem, however, if one of them wraps twice (i.e. 2 x
> queue size): then it would miss the exit at the target length even
> if it is already much longer; and the penalty would be a timeout,
> yet at that moment the queue is definitely drained.

Yes, we this routine should not hit timeouts, that's really bad. The
point is you can hit a false timeout because the algorithm does not
work.

> > > FWIW, the idea of HW drain came from intel_iommu_drain_pasid_prq()..
> >
> > Yeah, but I think they might have over done it too..
>
> I see.

The HW queue may need flushing on the device hot remove path, that
depends how they implemented things. Like on ARM you had a mutex
around the whole thing dev pointer so we don't even need that..

Jason