From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t] igt/amd_prime: Link an amdgpu bo into i915 and try to shrink it
Date: Tue, 7 Aug 2018 16:57:51 +0100 [thread overview]
Message-ID: <20180807155751.30698-1-chris@chris-wilson.co.uk> (raw)
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
next reply other threads:[~2018-08-07 15:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 15:57 Chris Wilson [this message]
2018-08-07 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/amd_prime: Link an amdgpu bo into i915 and try to shrink it 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180807155751.30698-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).