diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-04 14:40:09 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-04 15:39:34 +0100 |
commit | a4e7ccdac38ec8335d9e4e2656c1a041c77feae1 (patch) | |
tree | 1193136bd117e31907d0375b84c6e7a1f8356704 /drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | |
parent | 2935ed5339c495066d901b97de384d86c55a3f6d (diff) | |
download | linux-a4e7ccdac38ec8335d9e4e2656c1a041c77feae1.tar.bz2 |
drm/i915: Move context management under GEM
Keep track of the GEM contexts underneath i915->gem.contexts and assign
them their own lock for the purposes of list management.
v2: Focus on lock tracking; ctx->vm is protected by ctx->mutex
v3: Correct split with removal of logical HW ID
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191004134015.13204-15-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/selftests/i915_gem_gtt.c')
-rw-r--r-- | drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index e40e6cfa51f1..8d8121c02161 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -1246,6 +1246,7 @@ static int exercise_mock(struct drm_i915_private *i915, unsigned long end_time)) { const u64 limit = totalram_pages() << PAGE_SHIFT; + struct i915_address_space *vm; struct i915_gem_context *ctx; IGT_TIMEOUT(end_time); int err; @@ -1254,7 +1255,9 @@ static int exercise_mock(struct drm_i915_private *i915, if (!ctx) return -ENOMEM; - err = func(i915, ctx->vm, 0, min(ctx->vm->total, limit), end_time); + vm = i915_gem_context_get_vm_rcu(ctx); + err = func(i915, vm, 0, min(vm->total, limit), end_time); + i915_vm_put(vm); mock_context_close(ctx); return err; @@ -1801,15 +1804,15 @@ static int igt_cs_tlb(void *arg) goto out_unlock; } - vm = ctx->vm; - if (!vm) - goto out_unlock; + vm = i915_gem_context_get_vm_rcu(ctx); + if (i915_is_ggtt(vm)) + goto out_vm; /* Create two pages; dummy we prefill the TLB, and intended */ bbe = i915_gem_object_create_internal(i915, PAGE_SIZE); if (IS_ERR(bbe)) { err = PTR_ERR(bbe); - goto out_unlock; + goto out_vm; } batch = i915_gem_object_pin_map(bbe, I915_MAP_WC); @@ -2014,6 +2017,8 @@ out_put_act: i915_gem_object_put(act); out_put_bbe: i915_gem_object_put(bbe); +out_vm: + i915_vm_put(vm); out_unlock: mutex_unlock(&i915->drm.struct_mutex); mock_file_free(i915, file); |