blob: ceef580b6b2c4e8c55b6dbff200838819574960f [file] [log] [blame]
From 5b153ce6971f1926f54096300a1da084c54bcab1 Mon Sep 17 00:00:00 2001
From: Lepton Wu <ytht.net@gmail.com>
Date: Wed, 4 Sep 2019 13:08:27 -0700
Subject: [PATCH] BACKPORT: FROMLIST: drm/ttm: let ttm_bo_wait timeout be
configurable
When running dEQP against virgl driver, it turns out the default
15 seconds timeout for ttm_bo_wait is not big enough for
GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.22
Change it to a configurable value so we can tune it before virgl
performance gets improved.
Signed-off-by: Lepton Wu <ytht.net@gmail.com>
BUG=b:138755978
TEST=Compile kernel
(am from https://patchwork.kernel.org/patch/11132281/)
Change-Id: I4fb34cdd0848c7f0c20434ad932b9e0151911321
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1788167
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Lepton Wu <lepton@chromium.org>
Commit-Queue: Lepton Wu <lepton@chromium.org>
[rebase510(groeck): Context conflicts (drivers/gpu/drm/Kconfig)]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
---
drivers/gpu/drm/Kconfig | 2 ++
drivers/gpu/drm/ttm/Kconfig | 7 +++++++
drivers/gpu/drm/ttm/ttm_bo.c | 3 ++-
3 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 drivers/gpu/drm/ttm/Kconfig
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index dc0f94f02a82edffcddbd72a19129481a8a1b891..372d752f13654c0b44dc3439621b49ae50ed5cc1 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -220,6 +220,8 @@ config DRM_TTM_HELPER
help
Helpers for ttm-based gem objects
+source "drivers/gpu/drm/ttm/Kconfig"
+
config DRM_GEM_DMA_HELPER
tristate
depends on DRM
diff --git a/drivers/gpu/drm/ttm/Kconfig b/drivers/gpu/drm/ttm/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..c7953271c59b0c59c64aa8fc400862d57b8880d3
--- /dev/null
+++ b/drivers/gpu/drm/ttm/Kconfig
@@ -0,0 +1,7 @@
+config DRM_TTM_BO_WAIT_TIMEOUT
+ int "Default timeout for ttm bo wait (in seconds)"
+ depends on DRM_TTM
+ default 15
+ help
+ This option controls the default timeout (in seconds) used in
+ ttm_bo_wait
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 326a3d13a82956846a428ac2e395bab48297a486..eff2e9df2f53bbbcba393e7e90890d029a7c2a93 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1098,6 +1098,7 @@ EXPORT_SYMBOL(ttm_bo_unmap_virtual);
*/
int ttm_bo_wait_ctx(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx)
{
+ long timeout = CONFIG_DRM_TTM_BO_WAIT_TIMEOUT * HZ;
long ret;
if (ctx->no_wait_gpu) {
@@ -1109,7 +1110,7 @@ int ttm_bo_wait_ctx(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx)
}
ret = dma_resv_wait_timeout(bo->base.resv, DMA_RESV_USAGE_BOOKKEEP,
- ctx->interruptible, 15 * HZ);
+ ctx->interruptible, timeout);
if (unlikely(ret < 0))
return ret;
if (unlikely(ret == 0))
--
2.38.3