[PATCH rfcv2 6/8] iommu/arm-smmu-v3: Populate smmu_domain->invs when attaching masters
Jason Gunthorpe
jgg at nvidia.com
Wed Oct 1 09:25:16 PDT 2025
On Tue, Sep 30, 2025 at 01:19:29PM -0700, Nicolin Chen wrote:
> I see a cleaner way of handling this is to update invs->num_invs
> inside arm_smmu_invs_unref():
> ----------------------------------------------------------------
> @@ -1209,6 +1216,13 @@ size_t arm_smmu_invs_unref(struct arm_smmu_invs *invs,
> j++;
> }
> }
> +
> + /* The lock is required to fence concurrent ATS operations. */
> + write_lock_irqsave(&invs->rwlock, flags);
> + /* Trim the size by removing tailing trash entries */
> + WRITE_ONCE(invs->num_invs, num_invs);
> + write_unlock_irqrestore(&invs->rwlock, flags);
That seems Ok
It means the arm_smmu_invs_unref() becomes the fence that guarentees
the ATS is stopped for anything marked as trash.
Then the next steps can just be normal RCU and don't need rwlocking.
Jason
More information about the linux-arm-kernel
mailing list