Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Replace the hardcoded I915_FENCE_TIMEOUT

Expose the hardcoded timeout for unsignaled foreign fences as a Kconfig
option, primarily to allow brave systems to disable the timeout and
solely rely on correct signaling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200509105021.12542-1-chris@chris-wilson.co.uk

+46 -9
+12
drivers/gpu/drm/i915/Kconfig.profile
··· 1 + config DRM_I915_FENCE_TIMEOUT 2 + int "Timeout for unsignaled foreign fences (ms, jiffy granularity)" 3 + default 10000 # milliseconds 4 + help 5 + When listening to a foreign fence, we install a supplementary timer 6 + to ensure that we are always signaled and our userspace is able to 7 + make forward progress. This value specifies the timeout used for an 8 + unsignaled foreign fence. 9 + 10 + May be 0 to disable the timeout, and rely on the foreign fence being 11 + eventually signaled. 12 + 1 13 config DRM_I915_USERFAULT_AUTOSUSPEND 2 14 int "Runtime autosuspend delay for userspace GGTT mmaps (ms)" 3 15 default 250 # milliseconds
+1
drivers/gpu/drm/i915/Makefile
··· 35 35 36 36 # core driver code 37 37 i915-y += i915_drv.o \ 38 + i915_config.o \ 38 39 i915_irq.o \ 39 40 i915_getparam.o \ 40 41 i915_params.o \
+3 -2
drivers/gpu/drm/i915/display/intel_display.c
··· 15815 15815 if (new_plane_state->uapi.fence) { /* explicit fencing */ 15816 15816 ret = i915_sw_fence_await_dma_fence(&state->commit_ready, 15817 15817 new_plane_state->uapi.fence, 15818 - I915_FENCE_TIMEOUT, 15818 + i915_fence_timeout(dev_priv), 15819 15819 GFP_KERNEL); 15820 15820 if (ret < 0) 15821 15821 return ret; ··· 15842 15842 15843 15843 ret = i915_sw_fence_await_reservation(&state->commit_ready, 15844 15844 obj->base.resv, NULL, 15845 - false, I915_FENCE_TIMEOUT, 15845 + false, 15846 + i915_fence_timeout(dev_priv), 15846 15847 GFP_KERNEL); 15847 15848 if (ret < 0) 15848 15849 goto unpin_fb;
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_clflush.c
··· 108 108 if (clflush) { 109 109 i915_sw_fence_await_reservation(&clflush->base.chain, 110 110 obj->base.resv, NULL, true, 111 - I915_FENCE_TIMEOUT, 111 + i915_fence_timeout(to_i915(obj->base.dev)), 112 112 I915_FENCE_GFP); 113 113 dma_resv_add_excl_fence(obj->base.resv, &clflush->base.dma); 114 114 dma_fence_work_commit(&clflush->base);
+1 -2
drivers/gpu/drm/i915/gem/i915_gem_client_blt.c
··· 288 288 289 289 i915_gem_object_lock(obj); 290 290 err = i915_sw_fence_await_reservation(&work->wait, 291 - obj->base.resv, NULL, 292 - true, I915_FENCE_TIMEOUT, 291 + obj->base.resv, NULL, true, 0, 293 292 I915_FENCE_GFP); 294 293 if (err < 0) { 295 294 dma_fence_set_error(&work->dma, err);
+2 -2
drivers/gpu/drm/i915/gem/i915_gem_fence.c
··· 72 72 0, 0); 73 73 74 74 if (i915_sw_fence_await_reservation(&stub->chain, 75 - obj->base.resv, NULL, 76 - true, I915_FENCE_TIMEOUT, 75 + obj->base.resv, NULL, true, 76 + i915_fence_timeout(to_i915(obj->base.dev)), 77 77 I915_FENCE_GFP) < 0) 78 78 goto err; 79 79
+15
drivers/gpu/drm/i915/i915_config.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright © 2020 Intel Corporation 4 + */ 5 + 6 + #include "i915_drv.h" 7 + 8 + unsigned long 9 + i915_fence_context_timeout(const struct drm_i915_private *i915, u64 context) 10 + { 11 + if (context && IS_ACTIVE(CONFIG_DRM_I915_FENCE_TIMEOUT)) 12 + return msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT); 13 + 14 + return 0; 15 + }
+9 -1
drivers/gpu/drm/i915/i915_drv.h
··· 614 614 615 615 #define I915_IDLE_ENGINES_TIMEOUT (200) /* in ms */ 616 616 617 + unsigned long i915_fence_context_timeout(const struct drm_i915_private *i915, 618 + u64 context); 619 + 620 + static inline unsigned long 621 + i915_fence_timeout(const struct drm_i915_private *i915) 622 + { 623 + return i915_fence_context_timeout(i915, U64_MAX); 624 + } 625 + 617 626 #define I915_RESET_TIMEOUT (10 * HZ) /* 10s */ 618 - #define I915_FENCE_TIMEOUT (10 * HZ) /* 10s */ 619 627 620 628 #define I915_ENGINE_DEAD_TIMEOUT (4 * HZ) /* Seqno, head and subunits dead */ 621 629 #define I915_SEQNO_DEAD_TIMEOUT (12 * HZ) /* Seqno dead with active head */
+2 -1
drivers/gpu/drm/i915/i915_request.c
··· 1098 1098 { 1099 1099 mark_external(rq); 1100 1100 return i915_sw_fence_await_dma_fence(&rq->submit, fence, 1101 - fence->context ? I915_FENCE_TIMEOUT : 0, 1101 + i915_fence_context_timeout(rq->i915, 1102 + fence->context), 1102 1103 I915_FENCE_GFP); 1103 1104 } 1104 1105