From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 99E7DC33C9E for ; Fri, 17 Jan 2020 22:22:52 +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 7B34B2072B for ; Fri, 17 Jan 2020 22:22:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B34B2072B 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 314306F948; Fri, 17 Jan 2020 22:22:52 +0000 (UTC) Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6C626F948 for ; Fri, 17 Jan 2020 22:22:48 +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 19922999-1500050 for multiple; Fri, 17 Jan 2020 22:22:42 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Jan 2020 22:22:39 +0000 Message-Id: <20200117222240.3410108-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Exercise many, many mmap_offset 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Just keep on generating a new mmap_offset for the same old buffer, but for different handles and so exercise the scaling of the obj->mmo lists. Signed-off-by: Chris Wilson Cc: Abdiel Janulgue --- tests/i915/gem_mmap_offset.c | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c index 95e1e3e6c..c3b85d29e 100644 --- a/tests/i915/gem_mmap_offset.c +++ b/tests/i915/gem_mmap_offset.c @@ -326,6 +326,67 @@ static void close_race(int i915, int timeout) munmap(handles, len); } +static void open_flood(int i915, int timeout) +{ + unsigned long count; + uint32_t handle; + int dmabuf; + int *ctl; + + ctl = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); + igt_assert(ctl != MAP_FAILED); + + handle = gem_create(i915, 4096); + dmabuf = prime_handle_to_fd(i915, handle); + + for_each_mmap_offset_type(t) { + struct drm_i915_gem_mmap_offset arg = { + .handle = handle, + .flags = t->type, + }; + + if (mmap_offset_ioctl(i915, &arg)) + continue; + + igt_fork(child, 1) { + i915 = gem_reopen_driver(i915); + arg.handle = prime_fd_to_handle(i915, dmabuf); + + do { + igt_assert_eq(mmap_offset_ioctl(i915, &arg), 0); + } while (!READ_ONCE(*ctl)); + } + } + gem_close(i915, handle); + + count = 0; + igt_until_timeout(timeout) { + int tmp; + + tmp = gem_reopen_driver(i915); + handle = prime_fd_to_handle(i915, dmabuf); + + for_each_mmap_offset_type(t) { + struct drm_i915_gem_mmap_offset arg = { + .handle = handle, + .flags = t->type, + }; + + mmap_offset_ioctl(i915, &arg); + } + + close(tmp); + count++; + } + + igt_info("Completed %lu cycles\n", count); + close(dmabuf); + + *ctl = 1; + igt_waitchildren(); + munmap(ctl, 4096); +} + static uint64_t atomic_compare_swap_u64(_Atomic(uint64_t) *ptr, uint64_t oldval, uint64_t newval) { @@ -488,6 +549,9 @@ igt_main igt_subtest_f("close-race") close_race(i915, 20); + igt_subtest_f("open-flood") + open_flood(i915, 20); + igt_subtest_f("clear") always_clear(i915, 20); -- 2.25.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx