Re: [PATCH v1 2/4] iommu/tegra: gart: Check whether page is already mapped

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

 



On Tue, Sep 26, 2017 at 04:49:52PM +0300, Dmitry Osipenko wrote:
> On 26.09.2017 14:06, Thierry Reding wrote:
> > On Wed, Jul 05, 2017 at 07:29:46PM +0300, Dmitry Osipenko wrote:
> >> Due to a bug, multiple devices may try to map the same IOVA region. We can
> >> catch that case by checking that 'VALID' bit of the GART's page entry is
> >> unset prior to mapping of the page.
> > 
> > Due to what bug? Sounds to me like access to the GART should be
> > exclusive, so that only a single driver can ever access it.
> > 
> 
> Actually, there are a lot of peripherals behind the GART. But yes, probably we
> would use it exclusively for the GPU allocations.
> 
> In a case of the GPU allocations there could be a bug in the allocation code
> (drm_mm_scan) that would cause re-mapping of the already mapped pages, we would
> be able to catch such a bug.

Sounds to me like something that should be opt-in. Given that we could
potentially map a lot of memory, the additional read seems like it could
incur a significant performance penalty.

How about protecting this by some Kconfig symbol (or debug module
parameter) and adding a WARN instead of failing the mapping operation?

The reason is that we really should be using the GART from a single
driver because it is a shared memory region. To avoid drivers from
treading on each others' feet the allocations must be managed by some
central entity. So either something like DMA API should manage it, or
we hardwire it to Tegra DRM explicitly.

And if a central allocator is responsible for all mappings through the
GART, then we should assume that it isn't buggy, and therefore the extra
check of the PTEs should not be needed in most cases, hence we can get a
performance boost by disabling the check by default.

Of course if there is not much performance impact, maybe it is okay to
keep it always enabled.

Thierry

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