From patchwork Fri Jul 13 09:54:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10522957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9010760245 for ; Fri, 13 Jul 2018 09:54:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FE832978B for ; Fri, 13 Jul 2018 09:54:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73FC12978D; Fri, 13 Jul 2018 09:54:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F7FE2978B for ; Fri, 13 Jul 2018 09:54:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 60FED6F1D3; Fri, 13 Jul 2018 09:54:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id B805B6E25B; Fri, 13 Jul 2018 09:54:47 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12341159-1500050 for multiple; Fri, 13 Jul 2018 10:54:33 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 13 Jul 2018 10:54:40 +0100 Message-Id: <20180713095440.18529-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 Subject: [Intel-gfx] [PATCH i-g-t] igt: Force eviction of test bo directly X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Currently we indirectly try to evict the test buffers by mmaping enough bo that should fill the aperture. However, this assumes that the kernel is trying to fill the aperture and does not use random replacement (which it does) or use small partials to avoid mmaping the whole object (which it does). Rather than assume, use the debugfs interface to force the eviction of the bound objects. Signed-off-by: Chris Wilson Reviewed-by: MichaƂ Winiarski --- tests/gem_caching.c | 9 +-------- tests/gem_partial_pwrite_pread.c | 9 +-------- tests/gem_tiled_partial_pwrite_pread.c | 9 +-------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/gem_caching.c b/tests/gem_caching.c index 7a9f03aa3..09e1a5f97 100644 --- a/tests/gem_caching.c +++ b/tests/gem_caching.c @@ -55,7 +55,6 @@ drm_intel_bo *scratch_bo; drm_intel_bo *staging_bo; #define BO_SIZE (4*4096) uint32_t devid; -uint64_t mappable_gtt_limit; int fd; static void @@ -90,9 +89,7 @@ blt_bo_fill(drm_intel_bo *tmp_bo, drm_intel_bo *bo, uint8_t val) drm_intel_gem_bo_unmap_gtt(tmp_bo); - if (bo->offset < mappable_gtt_limit && - (IS_G33(devid) || intel_gen(devid) >= 4)) - igt_trash_aperture(); + igt_drop_caches_set(fd, DROP_BOUND); copy_bo(tmp_bo, bo); } @@ -136,9 +133,6 @@ igt_main gem_set_caching(fd, scratch_bo->handle, 1); staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096); - - igt_init_aperture_trashers(bufmgr); - mappable_gtt_limit = gem_mappable_aperture_size(); } igt_subtest("reads") { @@ -278,7 +272,6 @@ igt_main } igt_fixture { - igt_cleanup_aperture_trashers(); drm_intel_bufmgr_destroy(bufmgr); close(fd); diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c index d8cdd2a0a..35e39ad7f 100644 --- a/tests/gem_partial_pwrite_pread.c +++ b/tests/gem_partial_pwrite_pread.c @@ -56,7 +56,6 @@ drm_intel_bo *scratch_bo; drm_intel_bo *staging_bo; #define BO_SIZE (4*4096) uint32_t devid; -uint64_t mappable_gtt_limit; int fd; static void @@ -91,9 +90,7 @@ blt_bo_fill(drm_intel_bo *tmp_bo, drm_intel_bo *bo, uint8_t val) drm_intel_gem_bo_unmap_gtt(tmp_bo); - if (bo->offset < mappable_gtt_limit && - (IS_G33(devid) || intel_gen(devid) >= 4)) - igt_trash_aperture(); + igt_drop_caches_set(fd, DROP_BOUND); copy_bo(tmp_bo, bo); } @@ -264,9 +261,6 @@ igt_main /* overallocate the buffers we're actually using because */ scratch_bo = drm_intel_bo_alloc(bufmgr, "scratch bo", BO_SIZE, 4096); staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096); - - igt_init_aperture_trashers(bufmgr); - mappable_gtt_limit = gem_mappable_aperture_size(); } do_tests(-1, ""); @@ -277,7 +271,6 @@ igt_main do_tests(2, "-display"); igt_fixture { - igt_cleanup_aperture_trashers(); drm_intel_bufmgr_destroy(bufmgr); close(fd); diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c index 0b4972e37..c2f44c9d8 100644 --- a/tests/gem_tiled_partial_pwrite_pread.c +++ b/tests/gem_tiled_partial_pwrite_pread.c @@ -61,7 +61,6 @@ drm_intel_bo *tiled_staging_bo; unsigned long scratch_pitch; #define BO_SIZE (32*4096) uint32_t devid; -uint64_t mappable_gtt_limit; int fd; static void @@ -112,9 +111,7 @@ blt_bo_fill(drm_intel_bo *tmp_bo, drm_intel_bo *bo, int val) drm_intel_gem_bo_unmap_gtt(tmp_bo); - if (bo->offset < mappable_gtt_limit && - (IS_G33(devid) || intel_gen(devid) >= 4)) - igt_trash_aperture(); + igt_drop_caches_set(fd, DROP_BOUND); copy_bo(tmp_bo, 0, bo, 1); } @@ -295,9 +292,6 @@ igt_main BO_SIZE/4096, 4, &tiling_mode, &scratch_pitch, 0); - - igt_init_aperture_trashers(bufmgr); - mappable_gtt_limit = gem_mappable_aperture_size(); } igt_subtest("reads") @@ -310,7 +304,6 @@ igt_main test_partial_read_writes(); igt_fixture { - igt_cleanup_aperture_trashers(); drm_intel_bufmgr_destroy(bufmgr); close(fd);