Re: [PATCH v5] iommu/tegra-smmu: Add locking around mapping operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 01, 2020 at 11:37:30PM +0300, Dmitry Osipenko wrote:
> The mapping operations of the Tegra SMMU driver are subjected to a race
> condition issues because SMMU Address Space isn't allocated and freed
> atomically, while it should be. This patch makes the mapping operations
> atomic, it fixes an accidentally released Host1x Address Space problem
> which happens while running multiple graphics tests in parallel on
> Tegra30, i.e. by having multiple threads racing with each other in the
> Host1x's submission and completion code paths, performing IOVA mappings
> and unmappings in parallel.
> 
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
> 
> Changelog:
> 
> v5: - Replaced GFP_NOWAIT check with __GFP_ATOMIC to fix "sleep in
>       atomic context" warnings, NOWAIT != ATOMIC.
> 
> v4: - Returned to use spinlock, but now using a smarter allocation
>       logic that performs allocation in a sleeping context whenever
>       possible.
> 
>     - Removed the stable tag because patch isn't portable as-is
>       since the arguments of map/unmap() callbacks changed recently.
>       Perhaps we could just ignore older kernels for now. It will be
>       possible to fix older kernels with a custom patch if will be needed.
> 
> v3: - No changes. Resending for visibility.
> 
>  drivers/iommu/tegra-smmu.c | 95 +++++++++++++++++++++++++++++++++-----
>  1 file changed, 84 insertions(+), 11 deletions(-)

Seems to work fine. Tested on Jetson TX1 with display and GPU, which are
the primary users of the SMMU.

Tested-by: Thierry Reding <treding@xxxxxxxxxx>
Acked-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux