drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c- Extension
.c- Size
- 41419 bytes
- Lines
- 1917
- 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.hlinux/string_helpers.hgem/i915_gem_internal.hgem/i915_gem_pm.hgt/intel_engine_pm.hgt/intel_engine_regs.hgt/intel_gt.hgt/intel_gt_requests.hgt/intel_reset.hi915_selftest.hgem/selftests/igt_gem_utils.hselftests/i915_random.hselftests/igt_flush_test.hselftests/igt_live_test.hselftests/igt_reset.hselftests/igt_spinner.hselftests/mock_drm.hselftests/mock_gem_device.hhuge_gem_object.higt_gem_utils.h
Detected Declarations
struct parallel_switchfunction live_nop_switchfunction for_each_uabi_enginefunction for_each_prime_number_fromfunction __live_parallel_switch1function __live_parallel_switchNfunction live_parallel_switchfunction real_page_countfunction fake_page_countfunction gpu_fillfunction cpu_fillfunction cpu_checkfunction file_add_objectfunction create_test_objectfunction max_dwordsfunction throttle_releasefunction throttlefunction igt_ctx_execfunction for_each_uabi_enginefunction list_for_each_entryfunction igt_shared_ctx_execfunction for_each_uabi_enginefunction list_for_each_entryfunction rpcs_query_batchfunction emit_rpcs_queryfunction __sseu_preparefunction __read_slice_countfunction __check_rpcsfunction __sseu_finishfunction __sseu_testfunction __igt_ctx_sseufunction igt_ctx_sseufunction igt_ctx_readonlyfunction for_each_gem_enginefunction check_scratchfunction write_to_scratchfunction read_from_scratchfunction check_scratch_pagefunction igt_vm_isolationfunction i915_gem_context_live_selftests
Annotated Snippet
struct parallel_switch {
struct kthread_worker *worker;
struct kthread_work work;
struct intel_context *ce[2];
int result;
};
static void __live_parallel_switch1(struct kthread_work *work)
{
struct parallel_switch *arg =
container_of(work, typeof(*arg), work);
IGT_TIMEOUT(end_time);
unsigned long count;
count = 0;
arg->result = 0;
do {
struct i915_request *rq = NULL;
int n;
for (n = 0; !arg->result && n < ARRAY_SIZE(arg->ce); n++) {
struct i915_request *prev = rq;
rq = i915_request_create(arg->ce[n]);
if (IS_ERR(rq)) {
i915_request_put(prev);
arg->result = PTR_ERR(rq);
break;
}
i915_request_get(rq);
if (prev) {
arg->result =
i915_request_await_dma_fence(rq,
&prev->fence);
i915_request_put(prev);
}
i915_request_add(rq);
}
if (IS_ERR_OR_NULL(rq))
break;
if (i915_request_wait(rq, 0, HZ) < 0)
arg->result = -ETIME;
i915_request_put(rq);
count++;
} while (!arg->result && !__igt_timeout(end_time, NULL));
pr_info("%s: %lu switches (sync) <%d>\n",
arg->ce[0]->engine->name, count, arg->result);
}
static void __live_parallel_switchN(struct kthread_work *work)
{
struct parallel_switch *arg =
container_of(work, typeof(*arg), work);
struct i915_request *rq = NULL;
IGT_TIMEOUT(end_time);
unsigned long count;
int n;
count = 0;
arg->result = 0;
do {
for (n = 0; !arg->result && n < ARRAY_SIZE(arg->ce); n++) {
struct i915_request *prev = rq;
rq = i915_request_create(arg->ce[n]);
if (IS_ERR(rq)) {
i915_request_put(prev);
arg->result = PTR_ERR(rq);
break;
}
i915_request_get(rq);
if (prev) {
arg->result =
i915_request_await_dma_fence(rq,
&prev->fence);
i915_request_put(prev);
}
i915_request_add(rq);
}
count++;
Annotation
- Immediate include surface: `linux/prime_numbers.h`, `linux/string_helpers.h`, `gem/i915_gem_internal.h`, `gem/i915_gem_pm.h`, `gt/intel_engine_pm.h`, `gt/intel_engine_regs.h`, `gt/intel_gt.h`, `gt/intel_gt_requests.h`.
- Detected declarations: `struct parallel_switch`, `function live_nop_switch`, `function for_each_uabi_engine`, `function for_each_prime_number_from`, `function __live_parallel_switch1`, `function __live_parallel_switchN`, `function live_parallel_switch`, `function real_page_count`, `function fake_page_count`, `function gpu_fill`.
- 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.