Lines Matching +full:pre +full:- +full:delay

1 // SPDX-License-Identifier: MIT
18 * to check on its health and to flush any idle-barriers. If that request
20 * issue a reset -- in the hope that restores progress.
26 long delay; in next_heartbeat() local
28 delay = READ_ONCE(engine->props.heartbeat_interval_ms); in next_heartbeat()
30 rq = engine->heartbeat.systole; in next_heartbeat()
37 * heartbeat periods (or to override the pre-emption timeout as well, in next_heartbeat()
41 if (rq && rq->sched.attr.priority >= I915_PRIORITY_BARRIER && in next_heartbeat()
42 delay == engine->defaults.heartbeat_interval_ms) { in next_heartbeat()
47 * a pre-emption might not even have been attempted. So make sure in next_heartbeat()
48 * this last attempt allows enough time for a pre-emption to occur. in next_heartbeat()
50 longer = READ_ONCE(engine->props.preempt_timeout_ms) * 2; in next_heartbeat()
52 if (longer > delay) in next_heartbeat()
53 delay = longer; in next_heartbeat()
56 if (!delay) in next_heartbeat()
59 delay = msecs_to_jiffies_timeout(delay); in next_heartbeat()
60 if (delay >= HZ) in next_heartbeat()
61 delay = round_jiffies_up_relative(delay); in next_heartbeat()
62 mod_delayed_work(system_highpri_wq, &engine->heartbeat.work, delay + 1); in next_heartbeat()
81 engine->wakeref_serial = READ_ONCE(engine->serial) + 1; in idle_pulse()
83 if (!engine->heartbeat.systole && intel_engine_has_heartbeat(engine)) in idle_pulse()
84 engine->heartbeat.systole = i915_request_get(rq); in idle_pulse()
90 idle_pulse(rq->engine, rq); in heartbeat_commit()
100 drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat"); in show_heartbeat()
105 engine->name); in show_heartbeat()
109 engine->name, in show_heartbeat()
110 rq->fence.context, in show_heartbeat()
111 rq->fence.seqno, in show_heartbeat()
112 rq->sched.attr.priority); in show_heartbeat()
130 intel_gt_handle_error(engine->gt, engine->mask, in reset_engine()
133 engine->name); in reset_engine()
141 struct intel_context *ce = engine->kernel_context; in heartbeat()
148 rq = engine->heartbeat.systole; in heartbeat()
151 engine->heartbeat.systole = NULL; in heartbeat()
157 if (intel_gt_is_wedged(engine->gt)) in heartbeat()
160 if (i915_sched_engine_disabled(engine->sched_engine)) { in heartbeat()
161 reset_engine(engine, engine->heartbeat.systole); in heartbeat()
165 if (engine->heartbeat.systole) { in heartbeat()
166 long delay = READ_ONCE(engine->props.heartbeat_interval_ms); in heartbeat() local
168 /* Safeguard against too-fast worker invocations */ in heartbeat()
170 rq->emitted_jiffies + msecs_to_jiffies(delay))) in heartbeat()
173 if (!i915_sw_fence_signaled(&rq->submit)) { in heartbeat()
184 } else if (engine->sched_engine->schedule && in heartbeat()
185 rq->sched.attr.priority < I915_PRIORITY_BARRIER) { in heartbeat()
193 if (rq->sched.attr.priority >= attr.priority) in heartbeat()
195 if (rq->sched.attr.priority >= attr.priority) in heartbeat()
199 engine->sched_engine->schedule(rq, &attr); in heartbeat()
205 rq->emitted_jiffies = jiffies; in heartbeat()
209 serial = READ_ONCE(engine->serial); in heartbeat()
210 if (engine->wakeref_serial == serial) in heartbeat()
213 if (!mutex_trylock(&ce->timeline->mutex)) { in heartbeat()
215 if (xchg(&engine->heartbeat.blocked, serial) == serial) in heartbeat()
216 intel_gt_handle_error(engine->gt, engine->mask, in heartbeat()
219 engine->name); in heartbeat()
230 mutex_unlock(&ce->timeline->mutex); in heartbeat()
232 if (!engine->i915->params.enable_hangcheck || !next_heartbeat(engine)) in heartbeat()
233 i915_request_put(fetch_and_zero(&engine->heartbeat.systole)); in heartbeat()
247 if (cancel_delayed_work(&engine->heartbeat.work)) in intel_engine_park_heartbeat()
248 i915_request_put(fetch_and_zero(&engine->heartbeat.systole)); in intel_engine_park_heartbeat()
272 INIT_DELAYED_WORK(&engine->heartbeat.work, heartbeat); in intel_engine_init_heartbeat()
278 struct intel_context *ce = engine->kernel_context; in __intel_engine_pulse()
281 lockdep_assert_held(&ce->timeline->mutex); in __intel_engine_pulse()
289 __set_bit(I915_FENCE_FLAG_SENTINEL, &rq->fence.flags); in __intel_engine_pulse()
292 GEM_BUG_ON(rq->sched.attr.priority < I915_PRIORITY_BARRIER); in __intel_engine_pulse()
301 unsigned long delay) in set_heartbeat() argument
305 old = xchg(&engine->props.heartbeat_interval_ms, delay); in set_heartbeat()
306 if (delay) in set_heartbeat()
315 unsigned long delay) in intel_engine_set_heartbeat() argument
317 struct intel_context *ce = engine->kernel_context; in intel_engine_set_heartbeat()
320 if (!delay && !intel_engine_has_preempt_reset(engine)) in intel_engine_set_heartbeat()
321 return -ENODEV; in intel_engine_set_heartbeat()
324 if (delay != engine->defaults.heartbeat_interval_ms && in intel_engine_set_heartbeat()
325 delay < 2 * engine->props.preempt_timeout_ms) { in intel_engine_set_heartbeat()
327 …drm_notice(&engine->i915->drm, "%s heartbeat interval adjusted to a non-default value which may do… in intel_engine_set_heartbeat()
328 engine->name); in intel_engine_set_heartbeat()
330 …drm_notice(&engine->i915->drm, "%s heartbeat interval adjusted to a non-default value which may ca… in intel_engine_set_heartbeat()
331 engine->name); in intel_engine_set_heartbeat()
336 err = mutex_lock_interruptible(&ce->timeline->mutex); in intel_engine_set_heartbeat()
340 if (delay != engine->props.heartbeat_interval_ms) { in intel_engine_set_heartbeat()
341 unsigned long saved = set_heartbeat(engine, delay); in intel_engine_set_heartbeat()
351 mutex_unlock(&ce->timeline->mutex); in intel_engine_set_heartbeat()
360 struct intel_context *ce = engine->kernel_context; in intel_engine_pulse()
364 return -ENODEV; in intel_engine_pulse()
369 err = -EINTR; in intel_engine_pulse()
370 if (!mutex_lock_interruptible(&ce->timeline->mutex)) { in intel_engine_pulse()
372 mutex_unlock(&ce->timeline->mutex); in intel_engine_pulse()
383 struct intel_context *ce = engine->kernel_context; in intel_engine_flush_barriers()
387 if (llist_empty(&engine->barrier_tasks)) in intel_engine_flush_barriers()
393 if (mutex_lock_interruptible(&ce->timeline->mutex)) { in intel_engine_flush_barriers()
394 err = -EINTR; in intel_engine_flush_barriers()
408 mutex_unlock(&ce->timeline->mutex); in intel_engine_flush_barriers()