From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: baolu.lu@linux.intel.com, Vasant Hegde <vasant.hegde@amd.com>,
iommu@lists.linux.dev, joro@8bytes.org, will@kernel.org,
robin.murphy@arm.com, suravee.suthikulpanit@amd.com
Subject: Re: [PATCH v3 06/10] iommu/amd: Reduce domain lock scope in attach device path
Date: Mon, 21 Oct 2024 12:58:15 +0800 [thread overview]
Message-ID: <00f9feac-44f6-4a4f-8073-255ebf7b7398@linux.intel.com> (raw)
In-Reply-To: <20241018115417.GD948948@ziepe.ca>
On 2024/10/18 19:54, Jason Gunthorpe wrote:
> On Fri, Oct 18, 2024 at 10:38:05AM +0800, Baolu Lu wrote:
>> On 2024/10/17 21:32, Jason Gunthorpe wrote:
>>> On Wed, Oct 16, 2024 at 05:34:57AM +0000, Vasant Hegde wrote:
>>>> Currently attach device path takes protection domain lock followed by
>>>> dev_data lock. Most of the operations in this function is specific to
>>>> device data except pdom_attach_iommu() where it updates protection
>>>> domain structure. Hence reduce the scope of protection domain lock.
>>>>
>>>> Note that this changes the locking order. Now it takes device lock
>>>> before taking domain lock (group->mutex -> dev_data->lock ->
>>>> pdom->lock). dev_data->lock is used only in device attachment path.
>>>> So changing order is fine. It will not create any issue.
>>>>
>>>> Finally move numa node assignment to pdom_attach_iommu().
>>> numa node assignment should only be done during domain
>>> allocation. This is important because the domain can be mapped prior
>>> to being attached and without the right nid table levels will be mis
>>> allocated.
>> Sorry for off the topic, just a question about the domain numa ID.
>>
>> When a domain is about to be attached to a device on a different numa
>> node, what should the iommu driver do? Should it:
>>
>> - Ignore the difference (probably log an informational message);
> I would say silently ignore it..
>
> The only case that probably does this is VFIO, and VFIO is probably
> doing it deliberately to save memory.
>
>> - Return -EINVAL to force the upper layer to allocate a different domain
>> for the device?
> This seems extreme..
>
> I think if qemu or something wants to optimize this we need to return
> numa information in the get_infos to let it make the right decisions
> about domain allocation without being forced into anything.
Yea, thanks! This aligns with what we have in the intel driver.
Thanks,
baolu
next prev parent reply other threads:[~2024-10-21 4:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 5:34 [PATCH v3 00/10] iommu/amd: Improve domain allocator and device attach code path Vasant Hegde
2024-10-16 5:34 ` [PATCH v3 01/10] iommu/amd: Use ida interface to manage protection domain ID Vasant Hegde
2024-10-17 13:14 ` Jason Gunthorpe
2024-10-25 12:16 ` Vasant Hegde
2024-10-16 5:34 ` [PATCH v3 02/10] iommu/amd: Remove protection_domain.dev_cnt variable Vasant Hegde
2024-10-17 13:14 ` Jason Gunthorpe
2024-10-16 5:34 ` [PATCH v3 03/10] iommu/amd: xarray to track protection_domain->iommu list Vasant Hegde
2024-10-17 13:19 ` Jason Gunthorpe
2024-10-25 11:23 ` Vasant Hegde
2024-10-16 5:34 ` [PATCH v3 04/10] iommu/amd: Remove unused amd_iommus variable Vasant Hegde
2024-10-17 13:20 ` Jason Gunthorpe
2024-10-16 5:34 ` [PATCH v3 05/10] iommu/amd: Do not detach devices in domain free path Vasant Hegde
2024-10-17 13:22 ` Jason Gunthorpe
2024-10-16 5:34 ` [PATCH v3 06/10] iommu/amd: Reduce domain lock scope in attach device path Vasant Hegde
2024-10-17 13:32 ` Jason Gunthorpe
2024-10-18 2:38 ` Baolu Lu
2024-10-18 11:54 ` Jason Gunthorpe
2024-10-21 4:58 ` Baolu Lu [this message]
2024-10-24 14:41 ` Vasant Hegde
2024-10-16 5:34 ` [PATCH v3 07/10] iommu/amd: Rearrange attach device code Vasant Hegde
2024-10-17 13:33 ` Jason Gunthorpe
2024-10-16 5:34 ` [PATCH v3 08/10] iommu/amd: Convert dev_data lock from spinlock to mutex Vasant Hegde
2024-10-17 13:33 ` Jason Gunthorpe
2024-10-16 5:35 ` [PATCH v3 09/10] iommu/amd: Reorder attach device code Vasant Hegde
2024-10-17 13:35 ` Jason Gunthorpe
2024-10-16 5:35 ` [PATCH v3 10/10] iommu/amd: Improve amd_iommu_release_device() Vasant Hegde
2024-10-17 13:39 ` Jason Gunthorpe
2024-10-24 14:30 ` 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=00f9feac-44f6-4a4f-8073-255ebf7b7398@linux.intel.com \
--to=baolu.lu@linux.intel.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=vasant.hegde@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