On Mon, May 07, 2018 at 02:53:28PM +0200, Anna-Maria Gleixner wrote:
> Since introduction of the pd_bitmap_lock in commit 2bc001808904
> ("iommu/amd: Split domain id out of amd_iommu_devtable_lock")
> amd_iommu_devtable_lock is only taken around __detach_device() and
> __attach_device() calls.
> 
> The lock is not protecting anything as all operations are domain specific
> and protected by domain->lock in __detach_device() and __attach_device(),
> so amd_iommu_devtable_lock has no real purpose anymore.

There is a subtle problem with this, as the lock you remove here
protects changes to the device table. Now one could argue that we never
check what we actually overwrite there, so it doesn't matter and the
lock can be removed. That is true, but it leaves an existing
race-condition in the code when a two cores try to assign the same
device to different domains.

So while at it, can you look into fixing that too before removing the
devtable_lock?


        Joerg

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to