public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Joerg Roedel <joro@8bytes.org>, Len Brown <lenb@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Chen-Yu Tsai <wenst@chromium.org>
Subject: Re: [PATCH 3/3] iommu: Do not attempt to re-lock the iommu device when probing
Date: Wed, 9 Aug 2023 11:33:30 -0300	[thread overview]
Message-ID: <ZNOjuo9jYdSgUwZ5@nvidia.com> (raw)
In-Reply-To: <4208251b-8822-9376-cbe3-572f362720c5@samsung.com>

On Wed, Aug 09, 2023 at 03:38:30PM +0200, Marek Szyprowski wrote:
> On 09.08.2023 14:15, Jason Gunthorpe wrote:
> > On Wed, Aug 09, 2023 at 04:01:42AM +0000, Tian, Kevin wrote:
> >>> From: Jason Gunthorpe <jgg@nvidia.com>
> >>> Sent: Wednesday, August 9, 2023 1:27 AM
> >>>
> >>> @@ -1800,11 +1801,18 @@ struct probe_iommu_args {
> >>>   static int probe_iommu_group(struct device *dev, void *data)
> >>>   {
> >>>   	struct probe_iommu_args *args = data;
> >>> +	bool need_lock;
> >>>   	int ret;
> >>>
> >>> -	device_lock(dev);
> >>> +	/* Probing the iommu itself is always done under the device_lock */
> >>> +	need_lock = !args->iommu || args->iommu->hwdev != dev;
> >>> +
> >> is !args->iommu a valid case?
> > Hmm, not any more, it used to happen in an earlier version
> >   
> >> btw probably a dumb question. Why do we continue to probe the
> >> iommu device itself instead of skipping it? The group is a concept
> >> for devices which require DMA protection from iommu instead of
> >> for the iommu device itself...
> > Yeah, that is how I originally did it, but since the locking appeared
> > here I thought it would be safer to just continue to invoke probe as
> > we have always done. I don't know for sure that there isn't some
> > driver that relies on this for some reason.
> >
> > eg it might change the group layouts or something.
> 
> Well, I don't think that there is any driver doing such things, but the 
> only way to check is simply change the behavior an wait for complaints.

My other concern is that we don't fully block iommu devices from being
self probed. They can still be probed during rescan and during 2nd
calls to bus_iommu_probe().

But OK, it makes more logical sense to just block it so lets try that.

Jason

  reply	other threads:[~2023-08-09 14:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 17:27 [PATCH 0/3] Fix device_lock deadlock on two probe() paths Jason Gunthorpe
2023-08-08 17:27 ` [PATCH 1/3] iommu: Provide iommu_probe_device_locked() Jason Gunthorpe
2023-08-09  3:55   ` Tian, Kevin
2023-08-09  9:14   ` Joerg Roedel
2023-08-08 17:27 ` [PATCH 2/3] iommu: Pass in the iommu_device to probe for in bus_iommu_probe() Jason Gunthorpe
2023-08-09  3:57   ` Tian, Kevin
2023-08-08 17:27 ` [PATCH 3/3] iommu: Do not attempt to re-lock the iommu device when probing Jason Gunthorpe
2023-08-09  4:01   ` Tian, Kevin
2023-08-09 12:15     ` Jason Gunthorpe
2023-08-09 13:38       ` Marek Szyprowski
2023-08-09 14:33         ` Jason Gunthorpe [this message]
2023-08-08 20:18 ` [PATCH 0/3] Fix device_lock deadlock on two probe() paths Mark Brown
2023-08-08 22:26   ` Jason Gunthorpe
2023-08-09  6:37 ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNOjuo9jYdSgUwZ5@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=wenst@chromium.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox