From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3] tests/gem_userptr_blits: Refresh map-fixed-invalidate* subtests
Date: Wed, 26 Feb 2020 13:57:46 +0100 [thread overview]
Message-ID: <20200226125746.12249-1-janusz.krzysztofik@linux.intel.com> (raw)
map-fixed-invalidate* subtests utilize gem_set_tiling() which may fail,
e.g. on hardware with no mappable aperture, due to missing fences.
Skip those subtests if fences are not available.
Moreover, those subtests use GEM_MMAP_GTT IOCTL which has been replaced
by GEM_MMAP_OFFSET that supports other mapping types, not only GTT.
Use the new IOCTL and dynamically examine all MMAP_OFFSET types
supported by hardware.
v2: Examine all supported MMAP_OFFSET types, not only the first one
that works,
- add subtest description.
v3: Refresh on top of commit 384e7ecb7464 ("lib/i915: Restrict mmap
types to GTT if no MMAP_OFFSET support").
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
---
tests/i915/gem_userptr_blits.c | 43 +++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index fcad374ef..28a18c03d 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -722,7 +722,8 @@ static void test_forked_access(int fd)
MAP_FIXED_INVALIDATE_BUSY | \
MAP_FIXED_INVALIDATE_GET_PAGES)
-static int test_map_fixed_invalidate(int fd, uint32_t flags)
+static int test_map_fixed_invalidate(int fd, uint32_t flags,
+ const struct mmap_offset *t)
{
const size_t ptr_size = sizeof(linear) + 2*PAGE_SIZE;
const int num_handles = (flags & MAP_FIXED_INVALIDATE_OVERLAP) ? 2 : 1;
@@ -741,7 +742,7 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
for (char *fixed = (char *)ptr, *end = fixed + ptr_size;
fixed + 2*PAGE_SIZE <= end;
fixed += PAGE_SIZE) {
- struct drm_i915_gem_mmap_gtt mmap_gtt;
+ struct drm_i915_gem_mmap_offset mmap_offset;
uint32_t *map;
map = mmap(ptr, ptr_size, PROT_READ | PROT_WRITE,
@@ -750,9 +751,13 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
igt_assert(map != MAP_FAILED);
igt_assert(map == ptr);
- memset(&mmap_gtt, 0, sizeof(mmap_gtt));
- mmap_gtt.handle = gem_create(fd, 2*PAGE_SIZE);
- do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_gtt);
+ memset(&mmap_offset, 0, sizeof(mmap_offset));
+ mmap_offset.handle = gem_create(fd, 2 * PAGE_SIZE);
+ mmap_offset.flags = t->type;
+ igt_skip_on_f(igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET,
+ &mmap_offset),
+ "HW & kernel support for mmap_offset(%s)\n",
+ t->name);
if (flags & MAP_FIXED_INVALIDATE_GET_PAGES)
igt_assert_eq(__gem_set_domain(fd, handle[0],
@@ -766,11 +771,11 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
map = mmap(fixed, 2*PAGE_SIZE,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED,
- fd, mmap_gtt.offset);
+ fd, mmap_offset.offset);
igt_assert(map != MAP_FAILED);
igt_assert(map == (uint32_t *)fixed);
- gem_set_tiling(fd, mmap_gtt.handle, I915_TILING_NONE, 0);
+ gem_set_tiling(fd, mmap_offset.handle, I915_TILING_NONE, 0);
*map = 0xdead;
if (flags & MAP_FIXED_INVALIDATE_GET_PAGES) {
@@ -784,10 +789,10 @@ static int test_map_fixed_invalidate(int fd, uint32_t flags)
handle[0] = create_userptr(fd, 0, ptr + PAGE_SIZE/sizeof(*ptr));
}
- gem_set_tiling(fd, mmap_gtt.handle, I915_TILING_Y, 512 * 4);
+ gem_set_tiling(fd, mmap_offset.handle, I915_TILING_Y, 512 * 4);
*(uint32_t*)map = 0xbeef;
- gem_close(fd, mmap_gtt.handle);
+ gem_close(fd, mmap_offset.handle);
}
for (int i = 0; i < num_handles; i++)
@@ -2162,11 +2167,21 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
test_invalidate_close_race(fd, true, 2);
for (unsigned flags = 0; flags < ALL_MAP_FIXED_INVALIDATE + 1; flags++) {
- igt_subtest_f("map-fixed-invalidate%s%s%s",
- flags & MAP_FIXED_INVALIDATE_OVERLAP ? "-overlap" : "",
- flags & MAP_FIXED_INVALIDATE_BUSY ? "-busy" : "",
- flags & MAP_FIXED_INVALIDATE_GET_PAGES ? "-gup" : "") {
- test_map_fixed_invalidate(fd, flags);
+ igt_describe("Try to anger lockdep with MMU notifier still active after MAP_FIXED remap");
+ igt_subtest_with_dynamic_f("map-fixed-invalidate%s%s%s",
+ flags & MAP_FIXED_INVALIDATE_OVERLAP ?
+ "-overlap" : "",
+ flags & MAP_FIXED_INVALIDATE_BUSY ?
+ "-busy" : "",
+ flags & MAP_FIXED_INVALIDATE_GET_PAGES ?
+ "-gup" : "") {
+ igt_require_f(gem_available_fences(fd),
+ "HW & kernel support for tiling\n");
+
+ for_each_mmap_offset_type(fd, t)
+ igt_dynamic_f("%s", t->name)
+ test_map_fixed_invalidate(fd,
+ flags, t);
}
}
--
2.21.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2020-02-26 12:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 12:57 Janusz Krzysztofik [this message]
2020-02-26 14:49 ` [igt-dev] [PATCH i-g-t v3] tests/gem_userptr_blits: Refresh map-fixed-invalidate* subtests Chris Wilson
2020-02-26 16:11 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_userptr_blits: Refresh map-fixed-invalidate* subtests (rev3) Patchwork
2020-02-27 3:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-02-27 17:08 ` Janusz Krzysztofik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200226125746.12249-1-janusz.krzysztofik@linux.intel.com \
--to=janusz.krzysztofik@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox