From patchwork Thu Oct 22 15:09:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11851501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BABD7C388F7 for ; Thu, 22 Oct 2020 15:09:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0CAB24630 for ; Thu, 22 Oct 2020 15:09:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0CAB24630 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 13D986E102; Thu, 22 Oct 2020 15:09:55 +0000 (UTC) Received: from fireflyinternet.com (unknown [77.68.26.236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 557996E0C4; Thu, 22 Oct 2020 15:09:52 +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 22776346-1500050 for multiple; Thu, 22 Oct 2020 16:09:46 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 22 Oct 2020 16:09:43 +0100 Message-Id: <20201022150943.3041180-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_mmap_gtt: Trim object size for ptracing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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, Chris Wilson Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" For verifying vm_ops.access we only need a page or two to check we both advance across a page boundary and find the right offset within a page. 16MiB is overkill for the slow uncached reads through the slow ptrace interface, so reduce the object size by a couple of orders of magnitude. Signed-off-by: Chris Wilson Reviewed-by: Mika Kuoppala --- tests/i915/gem_mmap_gtt.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c index 6637bba06..3cce19e9a 100644 --- a/tests/i915/gem_mmap_gtt.c +++ b/tests/i915/gem_mmap_gtt.c @@ -525,6 +525,7 @@ static void *memchr_inv(const void *s, int c, size_t n) static void test_ptrace(int fd) { + unsigned long sz = 16 * 4096; unsigned long AA, CC; unsigned long *gtt, *cpy; uint32_t bo; @@ -533,16 +534,16 @@ test_ptrace(int fd) memset(&AA, 0xaa, sizeof(AA)); memset(&CC, 0x55, sizeof(CC)); - cpy = malloc(OBJECT_SIZE); - memset(cpy, AA, OBJECT_SIZE); + cpy = malloc(sz); + memset(cpy, AA, sz); - bo = gem_create(fd, OBJECT_SIZE); - gtt = mmap_bo(fd, bo, OBJECT_SIZE); - memset(gtt, CC, OBJECT_SIZE); + bo = gem_create(fd, sz); + gtt = mmap_bo(fd, bo, sz); + memset(gtt, CC, sz); gem_close(fd, bo); - igt_assert(!memchr_inv(gtt, CC, OBJECT_SIZE)); - igt_assert(!memchr_inv(cpy, AA, OBJECT_SIZE)); + igt_assert(!memchr_inv(gtt, CC, sz)); + igt_assert(!memchr_inv(cpy, AA, sz)); igt_fork(child, 1) { ptrace(PTRACE_TRACEME, 0, NULL, NULL); @@ -553,7 +554,7 @@ test_ptrace(int fd) pid = wait(NULL); ptrace(PTRACE_ATTACH, pid, NULL, NULL); - for (int i = 0; i < OBJECT_SIZE / sizeof(long); i++) { + for (int i = 0; i < sz / sizeof(long); i++) { long ret; ret = ptrace(PTRACE_PEEKDATA, pid, gtt + i); @@ -570,10 +571,10 @@ test_ptrace(int fd) igt_waitchildren(); /* The contents of the two buffers should now be swapped */ - igt_assert(!memchr_inv(gtt, AA, OBJECT_SIZE)); - igt_assert(!memchr_inv(cpy, CC, OBJECT_SIZE)); + igt_assert(!memchr_inv(gtt, AA, sz)); + igt_assert(!memchr_inv(cpy, CC, sz)); - munmap(gtt, OBJECT_SIZE); + munmap(gtt, sz); free(cpy); }