Lines Matching refs:engine

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
102 intel_engine_dump(engine, &p, in show_heartbeat()
104 engine->name); in show_heartbeat()
106 intel_engine_dump(engine, &p, in show_heartbeat()
108 engine->name, in show_heartbeat()
116 reset_engine(struct intel_engine_cs *engine, struct i915_request *rq) in reset_engine() argument
119 show_heartbeat(rq, engine); in reset_engine()
121 if (intel_engine_uses_guc(engine)) in reset_engine()
127 intel_guc_find_hung_context(engine); in reset_engine()
129 intel_gt_handle_error(engine->gt, engine->mask, in reset_engine()
132 engine->name); in reset_engine()
138 struct intel_engine_cs *engine = in heartbeat() local
139 container_of(wrk, typeof(*engine), heartbeat.work.work); in heartbeat()
140 struct intel_context *ce = engine->kernel_context; in heartbeat()
145 intel_engine_flush_submission(engine); in heartbeat()
147 rq = engine->heartbeat.systole; in heartbeat()
150 engine->heartbeat.systole = NULL; in heartbeat()
153 if (!intel_engine_pm_get_if_awake(engine)) in heartbeat()
156 if (intel_gt_is_wedged(engine->gt)) in heartbeat()
159 if (i915_sched_engine_disabled(engine->sched_engine)) { in heartbeat()
160 reset_engine(engine, engine->heartbeat.systole); in heartbeat()
164 if (engine->heartbeat.systole) { in heartbeat()
165 long delay = READ_ONCE(engine->props.heartbeat_interval_ms); in heartbeat()
183 } else if (engine->sched_engine->schedule && in heartbeat()
198 engine->sched_engine->schedule(rq, &attr); in heartbeat()
201 reset_engine(engine, rq); in heartbeat()
208 serial = READ_ONCE(engine->serial); in heartbeat()
209 if (engine->wakeref_serial == serial) in heartbeat()
214 if (xchg(&engine->heartbeat.blocked, serial) == serial) in heartbeat()
215 intel_gt_handle_error(engine->gt, engine->mask, in heartbeat()
218 engine->name); in heartbeat()
231 if (!engine->i915->params.enable_hangcheck || !next_heartbeat(engine)) in heartbeat()
232 i915_request_put(fetch_and_zero(&engine->heartbeat.systole)); in heartbeat()
233 intel_engine_pm_put(engine); in heartbeat()
236 void intel_engine_unpark_heartbeat(struct intel_engine_cs *engine) in intel_engine_unpark_heartbeat() argument
241 next_heartbeat(engine); in intel_engine_unpark_heartbeat()
244 void intel_engine_park_heartbeat(struct intel_engine_cs *engine) in intel_engine_park_heartbeat() argument
246 if (cancel_delayed_work(&engine->heartbeat.work)) in intel_engine_park_heartbeat()
247 i915_request_put(fetch_and_zero(&engine->heartbeat.systole)); in intel_engine_park_heartbeat()
252 struct intel_engine_cs *engine; in intel_gt_unpark_heartbeats() local
255 for_each_engine(engine, gt, id) in intel_gt_unpark_heartbeats()
256 if (intel_engine_pm_is_awake(engine)) in intel_gt_unpark_heartbeats()
257 intel_engine_unpark_heartbeat(engine); in intel_gt_unpark_heartbeats()
262 struct intel_engine_cs *engine; in intel_gt_park_heartbeats() local
265 for_each_engine(engine, gt, id) in intel_gt_park_heartbeats()
266 intel_engine_park_heartbeat(engine); in intel_gt_park_heartbeats()
269 void intel_engine_init_heartbeat(struct intel_engine_cs *engine) in intel_engine_init_heartbeat() argument
271 INIT_DELAYED_WORK(&engine->heartbeat.work, heartbeat); in intel_engine_init_heartbeat()
274 static int __intel_engine_pulse(struct intel_engine_cs *engine) in __intel_engine_pulse() argument
277 struct intel_context *ce = engine->kernel_context; in __intel_engine_pulse()
281 GEM_BUG_ON(!intel_engine_has_preemption(engine)); in __intel_engine_pulse()
282 GEM_BUG_ON(!intel_engine_pm_is_awake(engine)); in __intel_engine_pulse()
296 static unsigned long set_heartbeat(struct intel_engine_cs *engine, in set_heartbeat() argument
301 old = xchg(&engine->props.heartbeat_interval_ms, delay); in set_heartbeat()
303 intel_engine_unpark_heartbeat(engine); in set_heartbeat()
305 intel_engine_park_heartbeat(engine); in set_heartbeat()
310 int intel_engine_set_heartbeat(struct intel_engine_cs *engine, in intel_engine_set_heartbeat() argument
313 struct intel_context *ce = engine->kernel_context; in intel_engine_set_heartbeat()
316 if (!delay && !intel_engine_has_preempt_reset(engine)) in intel_engine_set_heartbeat()
320 if (delay != engine->defaults.heartbeat_interval_ms && in intel_engine_set_heartbeat()
321 delay < 2 * engine->props.preempt_timeout_ms) { in intel_engine_set_heartbeat()
322 if (intel_engine_uses_guc(engine)) in intel_engine_set_heartbeat()
323 …drm_notice(&engine->i915->drm, "%s heartbeat interval adjusted to a non-default value which may do… in intel_engine_set_heartbeat()
324 engine->name); in intel_engine_set_heartbeat()
326 …drm_notice(&engine->i915->drm, "%s heartbeat interval adjusted to a non-default value which may ca… in intel_engine_set_heartbeat()
327 engine->name); in intel_engine_set_heartbeat()
330 intel_engine_pm_get(engine); in intel_engine_set_heartbeat()
336 if (delay != engine->props.heartbeat_interval_ms) { in intel_engine_set_heartbeat()
337 unsigned long saved = set_heartbeat(engine, delay); in intel_engine_set_heartbeat()
340 if (intel_engine_has_preemption(engine)) { in intel_engine_set_heartbeat()
341 err = __intel_engine_pulse(engine); in intel_engine_set_heartbeat()
343 set_heartbeat(engine, saved); in intel_engine_set_heartbeat()
350 intel_engine_pm_put(engine); in intel_engine_set_heartbeat()
354 int intel_engine_pulse(struct intel_engine_cs *engine) in intel_engine_pulse() argument
356 struct intel_context *ce = engine->kernel_context; in intel_engine_pulse()
359 if (!intel_engine_has_preemption(engine)) in intel_engine_pulse()
362 if (!intel_engine_pm_get_if_awake(engine)) in intel_engine_pulse()
367 err = __intel_engine_pulse(engine); in intel_engine_pulse()
371 intel_engine_flush_submission(engine); in intel_engine_pulse()
372 intel_engine_pm_put(engine); in intel_engine_pulse()
376 int intel_engine_flush_barriers(struct intel_engine_cs *engine) in intel_engine_flush_barriers() argument
379 struct intel_context *ce = engine->kernel_context; in intel_engine_flush_barriers()
383 if (llist_empty(&engine->barrier_tasks)) in intel_engine_flush_barriers()
386 if (!intel_engine_pm_get_if_awake(engine)) in intel_engine_flush_barriers()
406 intel_engine_pm_put(engine); in intel_engine_flush_barriers()