drm/i915: Make the heartbeat play nice with long pre-emption timeouts
authorJohn Harrison <John.C.Harrison@Intel.com>
Thu, 6 Oct 2022 21:38:12 +0000 (14:38 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Mon, 24 Oct 2022 19:12:36 +0000 (12:12 -0700)
commit47daf84a8bfbc0ff7342b75fa2175591b64ef8d7
tree88bd6cbabc73e3fa645594379b827f243ebd40bb
parentc3bd49cd9a1043b963331e7fd874b380bed3f2bd
drm/i915: Make the heartbeat play nice with long pre-emption timeouts

Compute workloads are inherently not pre-emptible for long periods on
current hardware. As a workaround for this, the pre-emption timeout
for compute capable engines was disabled. This is undesirable with GuC
submission as it prevents per engine reset of hung contexts. Hence the
next patch will re-enable the timeout but bumped up by an order of
magnitude.

However, the heartbeat might not respect that. Depending upon current
activity, a pre-emption to the heartbeat pulse might not even be
attempted until the last heartbeat period. Which means that only one
period is granted for the pre-emption to occur. With the aforesaid
bump, the pre-emption timeout could be significantly larger than this
heartbeat period.

So adjust the heartbeat code to take the pre-emption timeout into
account. When it reaches the final (high priority) period, it now
ensures the delay before hitting reset is bigger than the pre-emption
timeout.

v2: Fix for selftests which adjust the heartbeat period manually.
v3: Add FIXME comment about selftests. Add extra FIXME comment and
drm_notices when setting heartbeat to a non-default value (review
feedback from Tvrtko)

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221006213813.1563435-4-John.C.Harrison@Intel.com
drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c