]> www.infradead.org Git - users/dwmw2/linux.git/commit
iommu/amd: Use try_cmpxchg64() in v2_alloc_pte()
authorUros Bizjak <ubizjak@gmail.com>
Wed, 22 May 2024 08:26:47 +0000 (10:26 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 25 Jun 2024 12:20:41 +0000 (14:20 +0200)
commit9a448e453151ec4e4b98a914b463539e790dd198
tree6b5a4f4360f0613d299b2a8c9f49371e6a6c0188
parent83a7eefedc9b56fe7bfeff13b6c7356688ffa670
iommu/amd: Use try_cmpxchg64() in v2_alloc_pte()

Use try_cmpxchg64() instead of cmpxchg64 (*ptr, old, new) != old in
v2_alloc_pte().  cmpxchg returns success in ZF flag, so this change
saves a compare after cmpxchg (and related move instruction
in front of cmpxchg).

This is the same improvement as implemented for alloc_pte() in:

  commit 0d10fe759117 ("iommu/amd: Use try_cmpxchg64 in alloc_pte and free_clear_pte")

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20240522082729.971123-1-ubizjak@gmail.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/io_pgtable_v2.c