Re: [PATCH 2/3] iommu/vt-d: Use try_cmpxchg64() in intel_pasid_get_entry()

From: Baolu Lu
Date: Thu May 23 2024 - 21:11:18 EST


On 5/22/24 4:26 PM, Uros Bizjak wrote:
Use try_cmpxchg64() instead of cmpxchg64 (*ptr, old, new) != old in
intel_pasid_get_entry(). cmpxchg returns success in ZF flag, so
this change saves a compare after cmpxchg (and related move
instruction in front of cmpxchg).

Signed-off-by: Uros Bizjak<ubizjak@xxxxxxxxx>
Cc: David Woodhouse<dwmw2@xxxxxxxxxxxxx>
Cc: Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx>
Cc: Joerg Roedel<joro@xxxxxxxxxx>
Cc: Will Deacon<will@xxxxxxxxxx>
Cc: Robin Murphy<robin.murphy@xxxxxxx>
---
drivers/iommu/intel/pasid.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>

Best regards,
baolu