iommu/amd: Lock the device table by DeviceID
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | iommu/amd: Serialize device-table writes with one per-segment lockdrivers/ drivers/ drivers/ | +12 | 0 replies | |
| 2/3 | iommu/amd: Identify a DTE entry by its DeviceIDdrivers/ | +15 | 0 replies | |
| 3/3 | iommu/amd: Drop the iommu_dev_data allocation for alias devicesdrivers/ | +4 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] iommu/amd: Lock the device table by DeviceID
The device table is indexed by DeviceID, but the lock that protects a write lives in iommu_dev_data. A DTE can therefore be updated with no lock when no dev_data exists. set_dte_irq_entry() skips the lock when search_dev_data() returns NULL, and clone_alias() allocates a dev_data for an alias DeviceID only so that it has a lock to take. That alias object is never attached to a domain and never freed.
Move dte_lock to the PCI segment so every writer takes the same lock. Address each slot by DeviceID instead of by a dev_data pointer, and drop the alias allocation. A DTE update is not a fast path, so one lock per segment is enough.
Full series including other cleanup is available at:
https://github.com/AMDESE/linux-iommu/tree/iommu_code_audit_7.4_v1
Vasant Hegde (3):
iommu/amd: Serialize device-table writes with one per-segment lock iommu/amd: Identify a DTE entry by its DeviceID iommu/amd: Drop the iommu_dev_data allocation for alias devices
drivers/iommu/amd/amd_iommu_types.h | 2 +- drivers/iommu/amd/init.c | 1 + drivers/iommu/amd/iommu.c | 76 ++++++++++------------------- 3 files changed, 29 insertions(+), 50 deletions(-)
Signature · 1 line
2.31.1