Re: [PATCH] iommu/intel: Use try_cmpxchg64{,_local}() in iommu.c

Baolu Lu
2024-04-24T03:46:21Z

On 4/15/24 12:23 AM, Uros Bizjak wrote:
> Replace this pattern in iommu.c:
>
> cmpxchg64{,_local}(*ptr, 0, new) != 0
>
> .. with the simpler and faster:
>
> !try_cmpxchg64{,_local}(*ptr, &tmp, new)
>
> The x86 CMPXCHG instruction returns success in the ZF flag, so this change
> saves a compare after the CMPXCHG.
>
> No functional change intended.
>
> Signed-off-by: Uros Bizjak<ubizjak@gmail.com>
> Cc: David Woodhouse<dwmw2@infradead.org>
> Cc: Lu Baolu<baolu.lu@linux.intel.com>
> Cc: Joerg Roedel<joro@8bytes.org>
> Cc: Will Deacon<will@kernel.org>
> Cc: Robin Murphy<robin.murphy@arm.com>
> ---
> drivers/iommu/intel/iommu.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)

Patch has been queued for iommu/vt-d.

Best regards,
baolu