igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] igt/amd_prime: Link an amdgpu bo into i915 and try to shrink it
@ 2018-08-07 15:57 Chris Wilson
  2018-08-07 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Wilson @ 2018-08-07 15:57 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

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>
---
 tests/amdgpu/amd_prime.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
index 9bf298a41..bda0ce83d 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);
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-08 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-07 15:57 [Intel-gfx] [PATCH i-g-t] igt/amd_prime: Link an amdgpu bo into i915 and try to shrink it Chris Wilson
2018-08-07 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-08-07 18:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-08-08 12:49 ` [igt-dev] [PATCH i-g-t] " Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).