Lines Matching full:engine

17  * While the engine is active, we send a periodic pulse along the engine
19 * is stuck, and we fail to preempt it, we declare the engine hung and
23 static bool next_heartbeat(struct intel_engine_cs *engine) in next_heartbeat() argument
28 delay = READ_ONCE(engine->props.heartbeat_interval_ms); in next_heartbeat()
30 rq = engine->heartbeat.systole; in next_heartbeat()
42 delay == engine->defaults.heartbeat_interval_ms) { in next_heartbeat()
50 longer = READ_ONCE(engine->props.preempt_timeout_ms) * 2; in next_heartbeat()
51 longer = intel_clamp_heartbeat_interval_ms(engine, longer); in next_heartbeat()
62 mod_delayed_work(system_highpri_wq, &engine->heartbeat.work, delay + 1); in next_heartbeat()
79 static void idle_pulse(struct intel_engine_cs *engine, struct i915_request *rq) in idle_pulse() argument
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()
97 struct intel_engine_cs *engine) in show_heartbeat() argument
100 drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat"); in show_heartbeat()
103 intel_engine_dump(engine, &p, in show_heartbeat()
105 engine->name); in show_heartbeat()
107 intel_engine_dump(engine, &p, in show_heartbeat()
109 engine->name, in show_heartbeat()
117 reset_engine(struct intel_engine_cs *engine, struct i915_request *rq) in reset_engine() argument
120 show_heartbeat(rq, engine); in reset_engine()
122 if (intel_engine_uses_guc(engine)) in reset_engine()
128 intel_guc_find_hung_context(engine); in reset_engine()
130 intel_gt_handle_error(engine->gt, engine->mask, in reset_engine()
133 engine->name); in reset_engine()
139 struct intel_engine_cs *engine = in heartbeat() local
140 container_of(wrk, typeof(*engine), heartbeat.work.work); in heartbeat()
141 struct intel_context *ce = engine->kernel_context; in heartbeat()
146 intel_engine_flush_submission(engine); in heartbeat()
148 rq = engine->heartbeat.systole; in heartbeat()
151 engine->heartbeat.systole = NULL; in heartbeat()
154 if (!intel_engine_pm_get_if_awake(engine)) 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()
184 } else if (engine->sched_engine->schedule && in heartbeat()
199 engine->sched_engine->schedule(rq, &attr); in heartbeat()
202 reset_engine(engine, rq); in heartbeat()
209 serial = READ_ONCE(engine->serial); in heartbeat()
210 if (engine->wakeref_serial == serial) in heartbeat()
214 /* Unable to lock the kernel timeline, is the engine stuck? */ 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()
232 if (!engine->i915->params.enable_hangcheck || !next_heartbeat(engine)) in heartbeat()
233 i915_request_put(fetch_and_zero(&engine->heartbeat.systole)); in heartbeat()
234 intel_engine_pm_put(engine); in heartbeat()
237 void intel_engine_unpark_heartbeat(struct intel_engine_cs *engine) in intel_engine_unpark_heartbeat() argument
242 next_heartbeat(engine); in intel_engine_unpark_heartbeat()
245 void intel_engine_park_heartbeat(struct intel_engine_cs *engine) in intel_engine_park_heartbeat() argument
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()
253 struct intel_engine_cs *engine; in intel_gt_unpark_heartbeats() local
256 for_each_engine(engine, gt, id) in intel_gt_unpark_heartbeats()
257 if (intel_engine_pm_is_awake(engine)) in intel_gt_unpark_heartbeats()
258 intel_engine_unpark_heartbeat(engine); in intel_gt_unpark_heartbeats()
263 struct intel_engine_cs *engine; in intel_gt_park_heartbeats() local
266 for_each_engine(engine, gt, id) in intel_gt_park_heartbeats()
267 intel_engine_park_heartbeat(engine); in intel_gt_park_heartbeats()
270 void intel_engine_init_heartbeat(struct intel_engine_cs *engine) in intel_engine_init_heartbeat() argument
272 INIT_DELAYED_WORK(&engine->heartbeat.work, heartbeat); in intel_engine_init_heartbeat()
275 static int __intel_engine_pulse(struct intel_engine_cs *engine) in __intel_engine_pulse() argument
278 struct intel_context *ce = engine->kernel_context; in __intel_engine_pulse()
282 GEM_BUG_ON(!intel_engine_has_preemption(engine)); in __intel_engine_pulse()
283 GEM_BUG_ON(!intel_engine_pm_is_awake(engine)); in __intel_engine_pulse()
295 next_heartbeat(engine); in __intel_engine_pulse()
300 static unsigned long set_heartbeat(struct intel_engine_cs *engine, in set_heartbeat() argument
305 old = xchg(&engine->props.heartbeat_interval_ms, delay); in set_heartbeat()
307 intel_engine_unpark_heartbeat(engine); in set_heartbeat()
309 intel_engine_park_heartbeat(engine); in set_heartbeat()
314 int intel_engine_set_heartbeat(struct intel_engine_cs *engine, 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()
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()
326 if (intel_engine_uses_guc(engine)) 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()
334 intel_engine_pm_get(engine); 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()
344 if (intel_engine_has_preemption(engine)) { in intel_engine_set_heartbeat()
345 err = __intel_engine_pulse(engine); in intel_engine_set_heartbeat()
347 set_heartbeat(engine, saved); in intel_engine_set_heartbeat()
354 intel_engine_pm_put(engine); in intel_engine_set_heartbeat()
358 int intel_engine_pulse(struct intel_engine_cs *engine) in intel_engine_pulse() argument
360 struct intel_context *ce = engine->kernel_context; in intel_engine_pulse()
363 if (!intel_engine_has_preemption(engine)) in intel_engine_pulse()
366 if (!intel_engine_pm_get_if_awake(engine)) in intel_engine_pulse()
371 err = __intel_engine_pulse(engine); in intel_engine_pulse()
375 intel_engine_flush_submission(engine); in intel_engine_pulse()
376 intel_engine_pm_put(engine); in intel_engine_pulse()
380 int intel_engine_flush_barriers(struct intel_engine_cs *engine) in intel_engine_flush_barriers() argument
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()
390 if (!intel_engine_pm_get_if_awake(engine)) in intel_engine_flush_barriers()
410 intel_engine_pm_put(engine); in intel_engine_flush_barriers()