All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt] tests/gem_ctx_exec: Add reset-pin-leak subtest
Date: Wed, 18 Jun 2014 22:04:49 +0300	[thread overview]
Message-ID: <1403118289-19550-2-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1403118289-19550-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a subtest to make sure the kernel doesn't leak the vma
pin_count for the last context on reset.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/gem_ctx_exec.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index da49a2f..da7412c 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -46,6 +46,7 @@
 #include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_aux.h"
+#include "igt_debugfs.h"
 
 struct local_drm_i915_gem_context_destroy {
 	__u32 ctx_id;
@@ -92,7 +93,6 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
 
 	ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
 			&execbuf);
-	gem_sync(fd, handle);
 
 	return ret;
 }
@@ -188,15 +188,43 @@ igt_main
 	igt_subtest("basic") {
 		ctx_id = gem_context_create(fd);
 		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+		gem_sync(fd, handle);
 		context_destroy(fd, ctx_id);
 
 		ctx_id = gem_context_create(fd);
 		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+		gem_sync(fd, handle);
 		context_destroy(fd, ctx_id);
 
 		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
+		gem_sync(fd, handle);
 	}
 
 	igt_subtest("eviction")
 		big_exec(fd, handle, I915_EXEC_RENDER);
+
+	igt_subtest("reset-pin-leak") {
+		int i;
+
+		/*
+		 * Use an explicit context to isolate the test from
+		 * any major code changes related to the per-file
+		 * default context (eg. if they would be eliminated).
+		 */
+		ctx_id = gem_context_create(fd);
+
+		/*
+		 * Iterate enough times that the kernel will
+		 * become unhappy if the ggtt pin count for
+		 * the last context is leaked at every reset.
+		 */
+		for (i = 0; i < 20; i++) {
+			igt_set_stop_rings(STOP_RING_DEFAULTS);
+			igt_assert(exec(fd, handle, I915_EXEC_RENDER, 0) == 0);
+			igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+			gem_sync(fd, handle);
+		}
+
+		context_destroy(fd, ctx_id);
+	}
 }
-- 
1.8.5.5

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

  reply	other threads:[~2014-06-18 19:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 19:04 [PATCH] drm/i915: Unpin last_context at reset ville.syrjala
2014-06-18 19:04 ` ville.syrjala [this message]
2014-06-19  7:47 ` Chris Wilson
2014-06-19 16:21   ` Mateo Lozano, Oscar
2014-06-23 10:07 ` Ville Syrjälä
2014-07-07 14:38   ` Daniel Vetter

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=1403118289-19550-2-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.