]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iommu/amd: Reduce domain lock scope in attach device path
authorVasant Hegde <vasant.hegde@amd.com>
Wed, 30 Oct 2024 06:35:51 +0000 (06:35 +0000)
committerJoerg Roedel <jroedel@suse.de>
Wed, 30 Oct 2024 10:06:44 +0000 (11:06 +0100)
commitd6b47dec368400a62d2b9d44c8e136fc15eac72c
tree8ab77bacd5cacee5631d2a689d153f643fa65a9a
parent07bbd660dbd6ff03907d9ddbdfe9deabbd18ac4d
iommu/amd: Reduce domain lock scope in attach device path

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 doamin 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().

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20241030063556.6104-8-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c