diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-08-07 16:56:19 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-08-08 17:01:59 +0100 |
commit | e6ddaca7a8ea9d3d27f0ecaa36b357cc02e2df3b (patch) | |
tree | 089cb624f555aa98111e7d9e2589e3768d74823a /tests/amdgpu | |
parent | e897d8d2c12f90025130a011561d2ee0155831d7 (diff) |
igt/amd_prime: Link an amdgpu bo into i915 and try to shrink it
Create and export an amdgpu bo into i915 so that we can try and
invalidate the i915_bo->pages from inside the shrinker, teaching lockdep
about that linkage.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Diffstat (limited to 'tests/amdgpu')
-rw-r--r-- | tests/amdgpu/amd_prime.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c index 9bf298a4..bda0ce83 100644 --- a/tests/amdgpu/amd_prime.c +++ b/tests/amdgpu/amd_prime.c @@ -392,6 +392,35 @@ static void amd_to_i915(int i915, int amd, amdgpu_device_handle device) ib_result_mc_address, 4096); } +static void shrink(int i915, int amd, amdgpu_device_handle device) +{ + struct amdgpu_bo_alloc_request request = { + .alloc_size = 1024 * 1024 * 4, + .phys_alignment = 4096, + .preferred_heap = AMDGPU_GEM_DOMAIN_GTT, + }; + amdgpu_bo_handle bo; + uint32_t handle; + int dmabuf; + + igt_assert_eq(amdgpu_bo_alloc(device, &request, &bo), 0); + amdgpu_bo_export(bo, + amdgpu_bo_handle_type_dma_buf_fd, + (uint32_t *)&dmabuf); + amdgpu_bo_free(bo); + + handle = prime_fd_to_handle(i915, dmabuf); + close(dmabuf); + + /* Populate the i915_bo->pages. */ + gem_set_domain(i915, handle, I915_GEM_DOMAIN_GTT, 0); + + /* Now evict them, establishing the link from i915:shrinker to amd. */ + igt_drop_caches_set(i915, DROP_SHRINK_ALL); + + gem_close(i915, handle); +} + igt_main { amdgpu_device_handle device; @@ -420,6 +449,9 @@ igt_main igt_subtest("amd-to-i915") amd_to_i915(i915, amd, device); + igt_subtest("shrink") + shrink(i915, amd, device); + igt_fixture { amdgpu_device_deinitialize(device); close(amd); |