From: Vasant Hegde <vasant.hegde@amd.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux.dev, will@kernel.org, robin.murphy@arm.com,
suravee.suthikulpanit@amd.com
Subject: Re: [PATCH v2 06/10] iommu/amd: Reduce domain lock scope in attach device path
Date: Wed, 16 Oct 2024 15:43:44 +0530 [thread overview]
Message-ID: <70d5fa32-9911-46f5-bcc1-30e3ba4e8ab3@amd.com> (raw)
In-Reply-To: <20241015170134.GQ1825128@ziepe.ca>
Jason,
On 10/15/2024 10:31 PM, Jason Gunthorpe wrote:
> On Tue, Oct 15, 2024 at 10:15:30PM +0530, Vasant Hegde wrote:
>>>> With all changes locking sequence will be :
>>>> group->mutex -> dev_data->mutex -> domain->lock
>>>>
>>>> In defer attach path (iommu_deferred_attach()), core call attach_device() w/o
>>>> group->mutex lock. So I retained dev_data lock.
>>>
>>> deferred attach is broken to not have the core code take the lock, all
>>> most all drivers depend on group_mutex for correctness.
>>>
>>> I think we should fix that, not retain unnecessary locks in drivers :\
>>
>> If you recall, I had a patch to fix core code [1]. Robin had a concern and hence
>> that patch was dropped.
>
> I do, but I think the concern was addressed.
>
> There might have been a small argument if AMD had a non-sleeping
> attach path (at least in some case), but here you are switching to a
> mutex so that is out the window.
>
> It is one thing to say we don't want the group mutex in core because
> it is just documentation, it is quite another to say you will keep a
> fully redundant mutex in the driver!!
>
> Drivers are relying on the group mutex, we have a lockdep assertion
> helper now, we need to hold it consistently when invoking the
> attach_dev and related ops.
Yeah. Its redundant mutex lock. I am happy to get rid of it.
I will look into it as separate fix.
-Vasant
next prev parent reply other threads:[~2024-10-16 10:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 6:58 [PATCH v2 00/10] iommu/amd: Improve domain allocator and device attach code path Vasant Hegde
2024-09-10 6:58 ` [PATCH v2 01/10] iommu/amd: Use ida interface to manage protection domain ID Vasant Hegde
2024-10-15 8:38 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 02/10] iommu/amd: Remove protection_domain.dev_cnt variable Vasant Hegde
2024-10-15 8:39 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 03/10] iommu/amd: xarray to track protection_domain->iommu list Vasant Hegde
2024-10-15 8:39 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 04/10] iommu/amd: Remove unused amd_iommus variable Vasant Hegde
2024-10-15 8:39 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 05/10] iommu/amd: Do not detach devices in domain free path Vasant Hegde
2024-10-15 8:40 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 06/10] iommu/amd: Reduce domain lock scope in attach device path Vasant Hegde
2024-10-15 8:38 ` Joerg Roedel
2024-10-15 12:30 ` Vasant Hegde
2024-10-15 16:12 ` Jason Gunthorpe
2024-10-15 16:45 ` Vasant Hegde
2024-10-15 17:01 ` Jason Gunthorpe
2024-10-16 10:13 ` Vasant Hegde [this message]
2024-09-10 6:58 ` [PATCH v2 07/10] iommu/amd: Rearrange attach device code Vasant Hegde
2024-10-15 8:41 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 08/10] iommu/amd: Convert dev_data lock from spinlock to mutex Vasant Hegde
2024-10-15 8:43 ` Joerg Roedel
2024-09-10 6:58 ` [PATCH v2 09/10] iommu/amd: Reorder attach device code Vasant Hegde
2024-10-15 8:44 ` Joerg Roedel
2024-10-15 16:42 ` Vasant Hegde
2024-09-10 6:58 ` [PATCH v2 10/10] iommu/amd: Improve amd_iommu_release_device() Vasant Hegde
2024-10-15 8:45 ` Joerg Roedel
2024-10-04 14:24 ` [PATCH v2 00/10] iommu/amd: Improve domain allocator and device attach code path Vasant Hegde
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=70d5fa32-9911-46f5-bcc1-30e3ba4e8ab3@amd.com \
--to=vasant.hegde@amd.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--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