[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211209193253.GB34762@Asurada-Nvidia>
Date: Thu, 9 Dec 2021 11:32:54 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Dmitry Osipenko <digetx@...il.com>
CC: <thierry.reding@...il.com>, <joro@...tes.org>, <will@...nel.org>,
<vdumpa@...dia.com>, <jonathanh@...dia.com>,
<linux-tegra@...r.kernel.org>, <iommu@...ts.linux-foundation.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v8 6/6] iommu/tegra-smmu: Add pagetable mappings to
debugfs
On Thu, Dec 09, 2021 at 05:47:18PM +0300, Dmitry Osipenko wrote:
> External email: Use caution opening links or attachments
>
>
> 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.
debugfs_create_dir returns ERR_PTR on failure. So here should be
to check !IS_ERR. Thanks for pointing it out!
> > + struct dentry *d;
>
> The file name is wrong here.
>
> if (group->soc)
> name = group->soc->name;
> else
> name = group->swgrp->name;
Yea, I'll add this.
>
> > + 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.a
Will see how to handle it.
Thanks
Nic
Powered by blists - more mailing lists