[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250818143949.GO802098@nvidia.com>
Date: Mon, 18 Aug 2025 11:39:49 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: robin.murphy@....com, joro@...tes.org, bhelgaas@...gle.com,
will@...nel.org, robin.clark@....qualcomm.com, yong.wu@...iatek.com,
matthias.bgg@...il.com, angelogioacchino.delregno@...labora.com,
thierry.reding@...il.com, vdumpa@...dia.com, jonathanh@...dia.com,
rafael@...nel.org, lenb@...nel.org, kevin.tian@...el.com,
yi.l.liu@...el.com, baolu.lu@...ux.intel.com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-tegra@...r.kernel.org,
linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
patches@...ts.linux.dev, pjaroszynski@...dia.com, vsethi@...dia.com,
helgaas@...nel.org, etzhao1900@...il.com
Subject: Re: [PATCH v3 3/5] iommu: Add iommu_get_domain_for_dev_locked()
helper
On Mon, Aug 11, 2025 at 03:59:10PM -0700, Nicolin Chen wrote:
> Introduce a new iommu_get_domain_for_dev_locked() helper to be used by
> those drivers in a context that is already under the protection of the
> group->mutex, e.g. those attach_dev callback functions. And roll out the
> new helper to all the existing IOMMU drivers.
I still don't much care for this, I think it would be better to
approach this problem by passing the old domain to the driver callback:
> @@ -390,7 +390,7 @@ static int qcom_iommu_attach_dev(struct iommu_domain *domain, struct device *dev
> static int qcom_iommu_identity_attach(struct iommu_domain *identity_domain,
> struct device *dev)
> {
> - struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
> + struct iommu_domain *domain = iommu_get_domain_for_dev_locked(dev);
Because this is a very common pattern in drivers.
Once that is done we can see what calls to iommu_get_domain_for_dev()
are even left, arguably we should be trying to eliminate this badly
locked thing...
Jason
Powered by blists - more mailing lists