[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200904121949.GA570531@ulmo>
Date: Fri, 4 Sep 2020 14:19:49 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Joerg Roedel <joro@...tes.org>,
Jonathan Hunter <jonathanh@...dia.com>,
Krishna Reddy <vdumpa@...dia.com>,
iommu@...ts.linux-foundation.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] iommu/tegra-smmu: Add locking around mapping
operations
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@...il.com>
> ---
>
> 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@...dia.com>
Acked-by: Thierry Reding <treding@...dia.com>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists