From patchwork Wed Mar 4 09:58:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11419707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB684921 for ; Wed, 4 Mar 2020 09:58:54 +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 A3F9C2072D for ; Wed, 4 Mar 2020 09:58:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3F9C2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 143246E148; Wed, 4 Mar 2020 09:58:52 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3E7689A14; Wed, 4 Mar 2020 09:58:50 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:50 -0800 X-IronPort-AV: E=Sophos;i="5.70,513,1574150400"; d="scan'208";a="240408672" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:49 -0800 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 4 Mar 2020 10:58:39 +0100 Message-Id: <20200304095841.8781-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> References: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/3] tests/gem_userptr_blits: More effectively set pages before invalidation 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: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" It has been observed that mmap-offset-invalidate@wb subtest has never triggered a lockdep loop complain. To fix it, don't use the ->domain field of a mapping type being examined, always set read and write domains to I915_GEM_DOMAIN_GTT instead. Signed-off-by: Janusz Krzysztofik --- tests/i915/gem_userptr_blits.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c index cd1a3af27..8148d7d76 100644 --- a/tests/i915/gem_userptr_blits.c +++ b/tests/i915/gem_userptr_blits.c @@ -821,7 +821,7 @@ static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t) igt_require_f(map, "mmap-offset banned, lockdep loop prevention\n"); /* set object pages in order to activate MMU notifier for it */ - gem_set_domain(fd, handle, t->domain, t->domain); + gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); /* trigger the notifier */ munmap(ptr, PAGE_SIZE); From patchwork Wed Mar 4 09:58:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11419709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98DDA921 for ; Wed, 4 Mar 2020 09:58: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 816712072D for ; Wed, 4 Mar 2020 09:58:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 816712072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 903806E149; Wed, 4 Mar 2020 09:58:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9FEE06EB05; Wed, 4 Mar 2020 09:58:52 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:52 -0800 X-IronPort-AV: E=Sophos;i="5.70,513,1574150400"; d="scan'208";a="240408675" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:50 -0800 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 4 Mar 2020 10:58:40 +0100 Message-Id: <20200304095841.8781-3-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> References: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/3] tests/gem_userptr_blits: More exact detection of lockdep loop prevention 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: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If mmap-offset over userptr fails, skip with respective message about lockdep loop preventive failure occurrence only if ENODEV, fail otherwise. Signed-off-by: Janusz Krzysztofik --- tests/i915/gem_userptr_blits.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c index 8148d7d76..95e90c40a 100644 --- a/tests/i915/gem_userptr_blits.c +++ b/tests/i915/gem_userptr_blits.c @@ -818,7 +818,10 @@ static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t) /* set up mmap-offset mapping on top of the object, skip if refused */ map = __gem_mmap_offset(fd, handle, 0, PAGE_SIZE, PROT_READ | PROT_WRITE, t->type); - igt_require_f(map, "mmap-offset banned, lockdep loop prevention\n"); + igt_skip_on_f(!map && errno == ENODEV, + "mmap-offset(%s) banned, lockdep loop prevention\n", + t->name); + igt_assert(map); /* set object pages in order to activate MMU notifier for it */ gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); From patchwork Wed Mar 4 09:58:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11419711 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A874F921 for ; Wed, 4 Mar 2020 09:58:57 +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 911EF2072D for ; Wed, 4 Mar 2020 09:58:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 911EF2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 4F8766EB05; Wed, 4 Mar 2020 09:58:55 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C0C36EB09; Wed, 4 Mar 2020 09:58:54 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:53 -0800 X-IronPort-AV: E=Sophos;i="5.70,513,1574150400"; d="scan'208";a="240408677" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 01:58:52 -0800 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 4 Mar 2020 10:58:41 +0100 Message-Id: <20200304095841.8781-4-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> References: <20200304095841.8781-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 3/3] tests/gem_userptr_blits: Add active variant of mmap-offset-invalidate 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: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add a variant that also attaches a igt_spin_t to the userptr, waits for it to start executing, call igt_spin_set_timeout and then do the munmap. Suggested-by: Chris Wilson Signed-off-by: Janusz Krzysztofik --- tests/i915/gem_userptr_blits.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c index 95e90c40a..68fc6aee4 100644 --- a/tests/i915/gem_userptr_blits.c +++ b/tests/i915/gem_userptr_blits.c @@ -797,10 +797,13 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags) return 0; } -static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t) +static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t, + int flags) +#define MMOI_ACTIVE 0x1 { void *ptr, *map; uint32_t handle; + igt_spin_t *spin; /* check if mmap_offset type is supported by hardware, skip if not */ handle = gem_create(fd, PAGE_SIZE); @@ -823,13 +826,26 @@ static void test_mmap_offset_invalidate(int fd, const struct mmap_offset *t) t->name); igt_assert(map); - /* set object pages in order to activate MMU notifier for it */ - gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); + /* activate MMU notifier for the object */ + if (flags & MMOI_ACTIVE) { + /* attach a time limited dummy load to the object */ + spin = igt_spin_new(fd, .dependency = handle); + usleep(USEC_PER_SEC/MSEC_PER_SEC); + igt_spin_set_timeout(spin, NSEC_PER_SEC); + } else { + /* just set object pages */ + gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, + I915_GEM_DOMAIN_GTT); + } /* trigger the notifier */ + igt_set_timeout(3, "deadlock"); munmap(ptr, PAGE_SIZE); + igt_reset_timeout(); /* cleanup */ + if (flags & MMOI_ACTIVE) + igt_spin_free(fd, spin); munmap(map, PAGE_SIZE); gem_close(fd, handle); } @@ -2207,11 +2223,18 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL) } } - igt_describe("Invalidate pages of userptr with mmap-offset on top"); + igt_describe("Invalidate pages of idle userptr with mmap-offset on top"); igt_subtest_with_dynamic("mmap-offset-invalidate") for_each_mmap_offset_type(fd, t) igt_dynamic_f("%s", t->name) - test_mmap_offset_invalidate(fd, t); + test_mmap_offset_invalidate(fd, t, 0); + + igt_describe("Invalidate pages of active userptr with mmap-offset on top"); + igt_subtest_with_dynamic("mmap-offset-invalidate-active") + for_each_mmap_offset_type(fd, t) + igt_dynamic_f("%s", t->name) + test_mmap_offset_invalidate(fd, t, + MMOI_ACTIVE); igt_subtest("coherency-sync") test_coherency(fd, count);