Re: [PATCH v3 3/7] iommu/arm-smmu-v3: Introduce a per-domain arm_smmu_invs array

Nicolin Chen
2025-10-20T19:16:49Z

On Mon, Oct 20, 2025 at 09:10:56AM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 17, 2025 at 01:12:02PM -0700, Nicolin Chen wrote:
> > On Fri, Oct 17, 2025 at 09:47:07PM +0800, kernel test robot wrote:
> > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c: note: in included file:
> > > >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:1048:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct callback_head *head @@ got struct callback_head [noderef] __rcu * @@
> > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:1048:9: sparse: expected struct callback_head *head
> > > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:1048:9: sparse: got struct callback_head [noderef] __rcu *
> > > >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:1048:9: sparse: sparse: cast removes address space '__rcu' of expression
> > ...
> > > 1045
> > > 1046 static inline void arm_smmu_domain_free(struct arm_smmu_domain *smmu_domain)
> > > 1047 {
> > > > 1048 kfree_rcu(smmu_domain->invs, rcu);
> >
> > Looks like it should be:
> > static inline void arm_smmu_domain_free(struct arm_smmu_domain *smmu_domain)
> > {
> > - kfree_rcu(smmu_domain->invs, rcu);
> > + struct arm_smmu_invs *invs = rcu_dereference(smmu_domain->invs);
>
> rcu_derference_protected(,true) since we know there is no concurrency
> here..

Oh right, it's outside rcu_read_lock().

Thanks
Nicolin