]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu/amd: serialize sequence allocation under concurrent TLB invalidations
authorAnkit Soni <Ankit.Soni@amd.com>
Thu, 22 Jan 2026 15:30:38 +0000 (15:30 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Tue, 3 Feb 2026 13:27:05 +0000 (14:27 +0100)
commit9e249c48412828e807afddc21527eb734dc9bd3d
tree8db2544375a42daf8a53a5cc1f3109aca5c18016
parent5b0530bb16ec5af3cc96fc25891d6a860fd37a8c
iommu/amd: serialize sequence allocation under concurrent TLB invalidations

With concurrent TLB invalidations, completion wait randomly gets timed out
because cmd_sem_val was incremented outside the IOMMU spinlock, allowing
CMD_COMPL_WAIT commands to be queued out of sequence and breaking the
ordering assumption in wait_on_sem().
Move the cmd_sem_val increment under iommu->lock so completion sequence
allocation is serialized with command queuing.
And remove the unnecessary return.

Fixes: d2a0cac10597 ("iommu/amd: move wait_on_sem() out of spinlock")
Tested-by: Srikanth Aithal <sraithal@amd.com>
Reported-by: Srikanth Aithal <sraithal@amd.com>
Signed-off-by: Ankit Soni <Ankit.Soni@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd/amd_iommu_types.h
drivers/iommu/amd/init.c
drivers/iommu/amd/iommu.c