Client will get banned from creating new context if it has managed to get > 3 context banned.
Signed-off-by: Mika Kuoppala <mika.kuopp...@intel.com> --- tests/gem_reset_stats.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 669a30a..1b9b5cd 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -327,15 +327,15 @@ static void test_rs_ctx(const struct intel_execution_engine *e, } } -static void test_ban_ctx(const struct intel_execution_engine *e, - const bool ban_default) +static void __test_ban_ctx(int fd_bad, + const struct intel_execution_engine *e, + const bool ban_default) { struct local_drm_i915_reset_stats rs_bad, rs_good; - int fd_bad, fd_good, i; + int fd_good, i; uint32_t ctx_good, ctx_bad; int active_count = 0, pending_count = 0; - fd_bad = drm_open_driver(DRIVER_INTEL); fd_good = drm_open_driver(DRIVER_INTEL); ctx_good = gem_context_create(fd_bad); @@ -401,10 +401,44 @@ static void test_ban_ctx(const struct intel_execution_engine *e, igt_assert_eq(rs_good.batch_active, 0); igt_assert_eq(rs_good.batch_pending, 0); - close(fd_bad); close(fd_good); } +static void test_ban_ctx(const struct intel_execution_engine *e, bool ban_default) +{ + int fd; + fd = drm_open_driver(DRIVER_INTEL); + + __test_ban_ctx(fd, e, ban_default); + + close(fd); +} + +static void test_ban_client(const struct intel_execution_engine *e) +{ + struct drm_i915_gem_context_create create; + int fd; + fd = drm_open_driver(DRIVER_INTEL); + + __test_ban_ctx(fd, e, false); + igt_assert_lt(0, noop(fd, 0, e)); + + __test_ban_ctx(fd, e, false); + igt_assert_lt(0, noop(fd, 0, e)); + + __test_ban_ctx(fd, e, false); + igt_assert_lt(0, noop(fd, 0, e)); + + __test_ban_ctx(fd, e, false); + + memset(&create, 0, sizeof(create)); + igt_assert_eq(-1, igt_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create)); + igt_assert_eq(-EIO, -errno); + igt_assert_lt(0, noop(fd, 0, e)); + + close(fd); +} + static void test_unrelated_ctx(const struct intel_execution_engine *e) { int fd1,fd2; @@ -844,6 +878,9 @@ igt_main igt_subtest_f("ban-ctx-%s", e->name) RUN_CTX_TEST(test_ban_ctx(e, false)); + igt_subtest_f("ban-client-%s", e->name) + RUN_CTX_TEST(test_ban_client(e)); + igt_subtest_f("reset-count-%s", e->name) RUN_TEST(test_reset_count(e, false)); -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx