Re: [PATCH v4 03/10] iommu/arm-smmu-v3: Store IOTLB cache tags in struct arm_smmu_attach_state

From: Jason Gunthorpe

Date: Fri Apr 10 2026 - 16:48:23 EST


On Fri, Apr 10, 2026 at 11:52:01AM -0700, Nicolin Chen wrote:
> > Only readers *with the possibility of concurrent access* should be
> > marked with READ_ONCE. IIRC this is just the invalidation walker.
>
> I added a cleanup patch to the beginning of the series and corrected
> all the new reads/writes too.
>
> > Places like this have to be protected by a lock or the whole thing is
> > wrong, so it should have a lockdep annoation.
>
> Hmm, is the lockdep_is_held() in rcu_dereference_protected() enough?

Yes.. but I didn't notice it there, not where I usually look for
lockdeps :)

But also that should have failed in your testing in the SVA case, so
make sure you test with lockdep on, and segfault some app using SVA to
trigger the error clean up flow.

> > But why does arm_smmu_mm_release() need a tag in the first place? ASID
> > isn't going to be used when EPD0|EPD1 is set, so the tag can just be
> > 0. Probably make a patch with that change early on..
>
> I see. I added a cleanup patch.

Also double check it still generates a hitless update, I think it
should but worth confirming.

Also is ASID 0 used at all?

Jason