Re: [PATCH] iommu: Don't call .probe_finalize() under group->mutex

From: Yong Wu
Date: Wed May 20 2020 - 02:55:08 EST


On Tue, 2020-05-19 at 15:28 +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@xxxxxxx>
>
> The .probe_finalize() call-back of some IOMMU drivers calls into
> arm_iommu_attach_device(). This function will call back into the
> IOMMU core code, where it tries to take group->mutex again, resulting
> in a deadlock.
>
> As there is no reason why .probe_finalize() needs to be called under
> that mutex, move it after the lock has been released to fix the
> deadlock.
>
> Cc: Yong Wu <yong.wu@xxxxxxxxxxxx>
> Reported-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
> Fixes: deac0b3bed26 ("iommu: Split off default domain allocation from group assignment")
> Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>

Tested-by: Yong Wu <yong.wu@xxxxxxxxxxxx>

Tested on MediaTek-v1 mt2701 evb board.