Skip to content

Commit 2827ce6

Browse files
ickledanvet
authored andcommitted
drm/i915/gt: Double check heartbeat timeout before resetting
Check that we have actually passed the heartbeat interval since last checking the request before resetting the device. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2780 Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Mika Kuoppala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Daniel Vetter <[email protected]>
1 parent 10c5585 commit 2827ce6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static bool next_heartbeat(struct intel_engine_cs *engine)
3131
delay = msecs_to_jiffies_timeout(delay);
3232
if (delay >= HZ)
3333
delay = round_jiffies_up_relative(delay);
34-
mod_delayed_work(system_highpri_wq, &engine->heartbeat.work, delay);
34+
mod_delayed_work(system_highpri_wq, &engine->heartbeat.work, delay + 1);
3535

3636
return true;
3737
}
@@ -103,6 +103,13 @@ static void heartbeat(struct work_struct *wrk)
103103
goto out;
104104

105105
if (engine->heartbeat.systole) {
106+
long delay = READ_ONCE(engine->props.heartbeat_interval_ms);
107+
108+
/* Safeguard against too-fast worker invocations */
109+
if (!time_after(jiffies,
110+
rq->emitted_jiffies + msecs_to_jiffies(delay)))
111+
goto out;
112+
106113
if (!i915_sw_fence_signaled(&rq->submit)) {
107114
/*
108115
* Not yet submitted, system is stalled.
@@ -140,6 +147,8 @@ static void heartbeat(struct work_struct *wrk)
140147
"stopped heartbeat on %s",
141148
engine->name);
142149
}
150+
151+
rq->emitted_jiffies = jiffies;
143152
goto out;
144153
}
145154

0 commit comments

Comments
 (0)