* [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
@ 2019-03-06 22:55 Dmitry Osipenko
2019-04-03 10:47 ` Dmitry Osipenko
2019-04-18 10:00 ` Thierry Reding
0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2019-03-06 22:55 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter; +Cc: dri-devel, linux-tegra, linux-kernel
The allocated pages need to be invalidated in CPU caches. On ARM32 the
DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and
the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures
that the corresponding CPU cache lines are getting invalidated and nothing
more, that's exactly what is needed for a newly allocated pages.
This fixes randomly failing rendercheck tests on Tegra30 using the
Opentegra driver for tests that use small-sized pixmaps (10x10 and less,
i.e. 1-2 memory pages) because apparently CPU reads out stale data from
caches and/or that data is getting evicted to DRAM at the time of HW job
execution.
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
drivers/gpu/drm/tegra/gem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 4f80100ff5f3..4cce11fd8836 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -204,7 +204,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
{
if (bo->pages) {
dma_unmap_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
- DMA_BIDIRECTIONAL);
+ DMA_FROM_DEVICE);
drm_gem_put_pages(&bo->gem, bo->pages, true, true);
sg_free_table(bo->sgt);
kfree(bo->sgt);
@@ -230,7 +230,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
}
err = dma_map_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
- DMA_BIDIRECTIONAL);
+ DMA_FROM_DEVICE);
if (err == 0) {
err = -EFAULT;
goto free_sgt;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
2019-03-06 22:55 [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages() Dmitry Osipenko
@ 2019-04-03 10:47 ` Dmitry Osipenko
2019-04-18 10:00 ` Thierry Reding
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2019-04-03 10:47 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter; +Cc: dri-devel, linux-tegra, linux-kernel
07.03.2019 1:55, Dmitry Osipenko пишет:
> The allocated pages need to be invalidated in CPU caches. On ARM32 the
> DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and
> the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures
> that the corresponding CPU cache lines are getting invalidated and nothing
> more, that's exactly what is needed for a newly allocated pages.
>
> This fixes randomly failing rendercheck tests on Tegra30 using the
> Opentegra driver for tests that use small-sized pixmaps (10x10 and less,
> i.e. 1-2 memory pages) because apparently CPU reads out stale data from
> caches and/or that data is getting evicted to DRAM at the time of HW job
> execution.
>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Thierry, please don't forget about this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
2019-03-06 22:55 [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages() Dmitry Osipenko
@ 2019-04-18 10:00 ` Thierry Reding
2019-04-18 10:00 ` Thierry Reding
1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2019-04-18 10:00 UTC (permalink / raw)
To: Dmitry Osipenko; +Cc: linux-tegra, linux-kernel, dri-devel, Jonathan Hunter
[-- Attachment #1.1: Type: text/plain, Size: 982 bytes --]
On Thu, Mar 07, 2019 at 01:55:19AM +0300, Dmitry Osipenko wrote:
> The allocated pages need to be invalidated in CPU caches. On ARM32 the
> DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and
> the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures
> that the corresponding CPU cache lines are getting invalidated and nothing
> more, that's exactly what is needed for a newly allocated pages.
>
> This fixes randomly failing rendercheck tests on Tegra30 using the
> Opentegra driver for tests that use small-sized pixmaps (10x10 and less,
> i.e. 1-2 memory pages) because apparently CPU reads out stale data from
> caches and/or that data is getting evicted to DRAM at the time of HW job
> execution.
>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> drivers/gpu/drm/tegra/gem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages()
@ 2019-04-18 10:00 ` Thierry Reding
0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2019-04-18 10:00 UTC (permalink / raw)
To: Dmitry Osipenko; +Cc: Jonathan Hunter, dri-devel, linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
On Thu, Mar 07, 2019 at 01:55:19AM +0300, Dmitry Osipenko wrote:
> The allocated pages need to be invalidated in CPU caches. On ARM32 the
> DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and
> the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures
> that the corresponding CPU cache lines are getting invalidated and nothing
> more, that's exactly what is needed for a newly allocated pages.
>
> This fixes randomly failing rendercheck tests on Tegra30 using the
> Opentegra driver for tests that use small-sized pixmaps (10x10 and less,
> i.e. 1-2 memory pages) because apparently CPU reads out stale data from
> caches and/or that data is getting evicted to DRAM at the time of HW job
> execution.
>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> drivers/gpu/drm/tegra/gem.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-18 10:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 22:55 [PATCH v1] drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages() Dmitry Osipenko
2019-04-03 10:47 ` Dmitry Osipenko
2019-04-18 10:00 ` Thierry Reding
2019-04-18 10:00 ` Thierry Reding
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.