From patchwork Wed Mar 2 17:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Weinehall X-Patchwork-Id: 8483821 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 567B59F314 for ; Wed, 2 Mar 2016 17:01:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 843EE2012D for ; Wed, 2 Mar 2016 17:01:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7280220121 for ; Wed, 2 Mar 2016 17:01:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C3306E912; Wed, 2 Mar 2016 17:01:34 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E4DA6E912 for ; Wed, 2 Mar 2016 17:01:33 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 02 Mar 2016 09:01:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,529,1449561600"; d="scan'208";a="58492408" Received: from dweineha-mobl3.fi.intel.com ([10.237.72.54]) by fmsmga004.fm.intel.com with ESMTP; 02 Mar 2016 09:01:32 -0800 From: David Weinehall To: intel-gfx@lists.freedesktop.org Date: Wed, 2 Mar 2016 19:01:28 +0200 Message-Id: <1456938088-25533-1-git-send-email-david.weinehall@linux.intel.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456924317-23525-1-git-send-email-david.weinehall@linux.intel.com> References: <1456924317-23525-1-git-send-email-david.weinehall@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t v4] tests/pm_rpm: Fix CRASH on machines that lack LLC 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.2 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 On machines that lack an LLC the pm-caching subtest will terminate with sigbus and thus CRASH during the I915_CACHING_CACHED iteration. To work around this we reset the caching to I915_CACHING_NONE before doing memory access. v2: Various improvements based on feedback from Chris Wilson v3: Fix incorrect Signed-off-by: line v4: Further improvements based on feedback from Chris Wilson Signed-off-by: David Weinehall Reviewed-by: Imre Deak --- tests/pm_rpm.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 2aa6c1018aa2..c57bf11d4e4e 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1800,7 +1800,8 @@ static void pm_test_caching(void) uint32_t handle; uint8_t *gem_buf; - uint32_t i, got_caching; + uint32_t i; + uint32_t default_cache_level; uint32_t gtt_obj_max_size = (16 * 1024); uint32_t cache_levels[3] = { I915_CACHING_NONE, @@ -1808,42 +1809,34 @@ static void pm_test_caching(void) I915_CACHING_DISPLAY, /* eDRAM caching */ }; + disable_all_screens(&ms_data); handle = gem_create(drm_fd, gtt_obj_max_size); + default_cache_level = gem_get_caching(drm_fd, handle); gem_buf = gem_mmap__gtt(drm_fd, handle, gtt_obj_max_size, PROT_WRITE); for (i = 0; i < ARRAY_SIZE(cache_levels); i++) { - memset(gem_buf, 16 << i, gtt_obj_max_size); + igt_assert(wait_for_suspended()); + gem_set_caching(drm_fd, handle, default_cache_level); - disable_all_screens_and_wait(&ms_data); + /* Ensure we bind the vma into the GGTT */ + memset(gem_buf, 16 << i, gtt_obj_max_size); + /* Now try changing the cache-level on the bound object. + * This will either unlikely unbind the object from the GGTT, + * or more likely just change the PTEs inside the GGTT. Either + * way the driver must take the rpm wakelock around the GSM + * access. + */ igt_debug("Setting cache level %u\n", cache_levels[i]); - + igt_assert(wait_for_suspended()); gem_set_caching(drm_fd, handle, cache_levels[i]); - - got_caching = gem_get_caching(drm_fd, handle); - - igt_debug("Got back %u\n", got_caching); - - /* - * Allow fall-back to CACHING_NONE in case the platform does - * not support it. - */ - if (cache_levels[i] == I915_CACHING_DISPLAY) - igt_assert(got_caching == I915_CACHING_NONE || - got_caching == I915_CACHING_DISPLAY); - else - igt_assert(got_caching == cache_levels[i]); - - enable_one_screen_and_wait(&ms_data); } igt_assert(munmap(gem_buf, gtt_obj_max_size) == 0); gem_close(drm_fd, handle); } - - static void fences_subtest(bool dpms) { int i;