drivers/gpu/drm/i915/gt/selftest_execlists.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/selftest_execlists.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/selftest_execlists.c- Extension
.c- Size
- 100216 bytes
- Lines
- 4507
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/prime_numbers.hdrm/drm_print.hgem/i915_gem_internal.hgem/i915_gem_pm.hgt/intel_engine_heartbeat.hgt/intel_reset.hgt/selftest_engine_heartbeat.hi915_jiffies.hi915_selftest.hselftests/i915_random.hselftests/igt_flush_test.hselftests/igt_live_test.hselftests/igt_spinner.hselftests/lib_sw_fence.hgem/selftests/igt_gem_utils.hgem/selftests/mock_context.h
Detected Declarations
struct preempt_clientstruct live_preempt_cancelstruct preempt_smokefunction is_activefunction wait_for_submitfunction wait_for_resetfunction maxfunction live_sanitycheckfunction for_each_enginefunction live_unlite_restorefunction live_unlite_switchfunction live_unlite_preemptfunction live_unlite_ringfunction for_each_enginefunction live_pin_rewindfunction for_each_enginefunction engine_lock_reset_taskletfunction engine_unlock_reset_taskletfunction live_hold_resetfunction for_each_enginefunction live_error_interruptfunction for_each_enginefunction emit_semaphore_chainfunction semaphore_queuefunction release_queuefunction slice_semaphore_queuefunction for_each_enginefunction live_timeslice_preemptfunction for_each_enginefunction create_rewinderfunction live_timeslice_rewindfunction for_each_enginefunction slice_timeoutfunction live_timeslice_queuefunction for_each_enginefunction live_timeslice_nopreemptfunction for_each_enginefunction live_busywait_preemptfunction for_each_enginefunction spinner_create_requestfunction live_preemptfunction for_each_enginefunction live_late_preemptfunction for_each_enginefunction preempt_client_initfunction preempt_client_finifunction live_nopreemptfunction for_each_engine
Annotated Snippet
struct preempt_client {
struct igt_spinner spin;
struct i915_gem_context *ctx;
};
static int preempt_client_init(struct intel_gt *gt, struct preempt_client *c)
{
c->ctx = kernel_context(gt->i915, NULL);
if (!c->ctx)
return -ENOMEM;
if (igt_spinner_init(&c->spin, gt))
goto err_ctx;
return 0;
err_ctx:
kernel_context_close(c->ctx);
return -ENOMEM;
}
static void preempt_client_fini(struct preempt_client *c)
{
igt_spinner_fini(&c->spin);
kernel_context_close(c->ctx);
}
static int live_nopreempt(void *arg)
{
struct intel_gt *gt = arg;
struct intel_engine_cs *engine;
struct preempt_client a, b;
enum intel_engine_id id;
int err = -ENOMEM;
/*
* Verify that we can disable preemption for an individual request
* that may be being observed and not want to be interrupted.
*/
if (preempt_client_init(gt, &a))
return -ENOMEM;
if (preempt_client_init(gt, &b))
goto err_client_a;
b.ctx->sched.priority = I915_PRIORITY_MAX;
for_each_engine(engine, gt, id) {
struct i915_request *rq_a, *rq_b;
if (!intel_engine_has_preemption(engine))
continue;
engine->execlists.preempt_hang.count = 0;
rq_a = spinner_create_request(&a.spin,
a.ctx, engine,
MI_ARB_CHECK);
if (IS_ERR(rq_a)) {
err = PTR_ERR(rq_a);
goto err_client_b;
}
/* Low priority client, but unpreemptable! */
__set_bit(I915_FENCE_FLAG_NOPREEMPT, &rq_a->fence.flags);
i915_request_add(rq_a);
if (!igt_wait_for_spinner(&a.spin, rq_a)) {
pr_err("First client failed to start\n");
goto err_wedged;
}
rq_b = spinner_create_request(&b.spin,
b.ctx, engine,
MI_ARB_CHECK);
if (IS_ERR(rq_b)) {
err = PTR_ERR(rq_b);
goto err_client_b;
}
i915_request_add(rq_b);
/* B is much more important than A! (But A is unpreemptable.) */
GEM_BUG_ON(rq_prio(rq_b) <= rq_prio(rq_a));
/* Wait long enough for preemption and timeslicing */
if (igt_wait_for_spinner(&b.spin, rq_b)) {
pr_err("Second client started too early!\n");
goto err_wedged;
}
Annotation
- Immediate include surface: `linux/prime_numbers.h`, `drm/drm_print.h`, `gem/i915_gem_internal.h`, `gem/i915_gem_pm.h`, `gt/intel_engine_heartbeat.h`, `gt/intel_reset.h`, `gt/selftest_engine_heartbeat.h`, `i915_jiffies.h`.
- Detected declarations: `struct preempt_client`, `struct live_preempt_cancel`, `struct preempt_smoke`, `function is_active`, `function wait_for_submit`, `function wait_for_reset`, `function max`, `function live_sanitycheck`, `function for_each_engine`, `function live_unlite_restore`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.