From patchwork Fri Jul 10 13:26:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tim.gore@intel.com X-Patchwork-Id: 6766081 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 74DDEC05AC for ; Fri, 10 Jul 2015 13:27:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9226E20651 for ; Fri, 10 Jul 2015 13:27:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A6CDB20622 for ; Fri, 10 Jul 2015 13:27:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BE306EDD3; Fri, 10 Jul 2015 06:27:04 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D4E0B6EDD3 for ; Fri, 10 Jul 2015 06:27:02 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 10 Jul 2015 06:27:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,446,1432623600"; d="scan'208";a="603708036" Received: from tgore-linux2.isw.intel.com ([10.102.226.157]) by orsmga003.jf.intel.com with ESMTP; 10 Jul 2015 06:27:00 -0700 From: tim.gore@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 10 Jul 2015 14:26:59 +0100 Message-Id: <1436534819-11328-1-git-send-email-tim.gore@intel.com> X-Mailer: git-send-email 1.9.1 Cc: thomas.wood@intel.com, mika.kuoppala@intel.com Subject: [Intel-gfx] [PATCH i-g-t] tests/gem_reset_stats.c: fix "ban" tests with scheduler X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tim Gore The tests for context banning fail when the gpu scheduler is enabled. The test causes a hang (using an infinite loop batch) and then queues up some work behind it on both the hanging context and also on a second "good" context. On the "good" context it queues up 2 batch buffers. After the hanging ring has been reset (not a full gpu reset) the test checks the values of batch_active and batch_pending returned by the i915_get_reset_stats_ioctl. For the "good" context it expects to see batch_pending == 2, because two batch buffers we queued up behind the hang on this context. But, with the scheduler enabled (android, gen8), one of these batch buffers is still waiting in the scheduler and has not made it as far as the ring->request_list, so this batch buffer is unaffected by the ring reset, and batch_pending is only 1. I considered putting in a test for the scheduler being enabled, but decided that a simpler solution is to only queue up 1 batch buffer on the good context. This does not change the test logic in any way and ensures that we should always have batch_pending=1, with or without the scheduler. Signed-off-by: Tim Gore --- tests/gem_reset_stats.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c index 2bb4291..6529463 100644 --- a/tests/gem_reset_stats.c +++ b/tests/gem_reset_stats.c @@ -468,7 +468,7 @@ static void test_rs_ctx(int num_fds, int num_ctx, int hang_index, static void test_ban(void) { - int h1,h2,h3,h4,h5,h6,h7; + int h1,h2,h3,h4,h5,h6; int fd_bad, fd_good; int retry = 10; int active_count = 0, pending_count = 0; @@ -496,7 +496,6 @@ static void test_ban(void) pending_count++; h6 = exec_valid(fd_good, 0); - h7 = exec_valid(fd_good, 0); while (retry--) { h3 = inject_hang_no_ban_error(fd_bad, 0); @@ -525,7 +524,7 @@ static void test_ban(void) igt_assert_eq(h4, -EIO); assert_reset_status(fd_bad, 0, RS_BATCH_ACTIVE); - gem_sync(fd_good, h7); + gem_sync(fd_good, h6); assert_reset_status(fd_good, 0, RS_BATCH_PENDING); igt_assert_eq(gem_reset_stats(fd_good, 0, &rs_good), 0); @@ -534,12 +533,11 @@ static void test_ban(void) igt_assert(rs_bad.batch_active == active_count); igt_assert(rs_bad.batch_pending == pending_count); igt_assert(rs_good.batch_active == 0); - igt_assert(rs_good.batch_pending == 2); + igt_assert(rs_good.batch_pending == 1); gem_close(fd_bad, h1); gem_close(fd_bad, h2); gem_close(fd_good, h6); - gem_close(fd_good, h7); h1 = exec_valid(fd_good, 0); igt_assert_lte(0, h1); @@ -554,7 +552,7 @@ static void test_ban(void) static void test_ban_ctx(void) { - int h1,h2,h3,h4,h5,h6,h7; + int h1,h2,h3,h4,h5,h6; int ctx_good, ctx_bad; int fd; int retry = 10; @@ -587,7 +585,6 @@ static void test_ban_ctx(void) pending_count++; h6 = exec_valid(fd, ctx_good); - h7 = exec_valid(fd, ctx_good); while (retry--) { h3 = inject_hang_no_ban_error(fd, ctx_bad); @@ -616,7 +613,7 @@ static void test_ban_ctx(void) igt_assert_eq(h4, -EIO); assert_reset_status(fd, ctx_bad, RS_BATCH_ACTIVE); - gem_sync(fd, h7); + gem_sync(fd, h6); assert_reset_status(fd, ctx_good, RS_BATCH_PENDING); igt_assert_eq(gem_reset_stats(fd, ctx_good, &rs_good), 0); @@ -625,12 +622,11 @@ static void test_ban_ctx(void) igt_assert(rs_bad.batch_active == active_count); igt_assert(rs_bad.batch_pending == pending_count); igt_assert(rs_good.batch_active == 0); - igt_assert(rs_good.batch_pending == 2); + igt_assert(rs_good.batch_pending == 1); gem_close(fd, h1); gem_close(fd, h2); gem_close(fd, h6); - gem_close(fd, h7); h1 = exec_valid(fd, ctx_good); igt_assert_lte(0, h1);