Re: [PATCH v8 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

From: Dmitry Osipenko
Date: Thu Dec 09 2021 - 09:47:24 EST


09.12.2021 10:38, Nicolin Chen пишет:
> @@ -545,6 +719,15 @@ static void tegra_smmu_detach_as(struct tegra_smmu *smmu,
> if (group->swgrp != swgrp)
> continue;
> group->as = NULL;
> +
> + if (smmu->debugfs_mappings) {

Do we really need this check?

Looks like all debugfs_create_dir() usages in this driver are incorrect,
that function never returns NULL. Please fix this.

> + struct dentry *d;

The file name is wrong here.

if (group->soc)
name = group->soc->name;
else
name = group->swgrp->name;

> + d = debugfs_lookup(group->swgrp->name,
> + smmu->debugfs_mappings);
> + debugfs_remove(d);
> + }

This now looks problematic to me. You created debugfs file when the
first member of the shared group was attached to AS, now you remove this
file when any device is detached. The shared debugfs file should be
refcounted or something.