All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org, matthew.auld@intel.com,
	mika.kuoppala@intel.com
Subject: [PATCH i-g-t 1/3] i915/gem_userptr_blits: Only mlock the memfd once, not the arena
Date: Wed, 16 Jan 2019 09:35:07 +0000	[thread overview]
Message-ID: <20190116093509.30195-1-chris@chris-wilson.co.uk> (raw)

We multiply the memfd 64k to create a 2G arena which we then attempt to
write into after marking read-only. Howver, when it comes to unlock the
arena after the test, performance tanks as the kernel tries to resolve
the 64k repeated mappings onto the same set of pages. (Must not be a
very common operation!) We can get away with just mlocking the backing
store to prevent its eviction, which should prevent the arena mapping
from being freed as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=108887
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_userptr_blits.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 909dd19df..c4e60ba92 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1124,7 +1124,7 @@ static void test_readonly(int i915)
 		*(uint32_t *)(space + offset) = offset;
 	}
 	igt_assert_eq_u32(*(uint32_t *)pages, (uint32_t)(total - sz));
-	igt_assert(mlock(space, total) == 0);
+	igt_assert(mlock(pages, sz) == 0);
 	close(memfd);
 
 	/* Check we can create a normal userptr bo wrapping the wrapper */
@@ -1176,6 +1176,7 @@ static void test_readonly(int i915)
 	}
 	igt_waitchildren();
 
+	munlock(pages, sz);
 	munmap(space, total);
 	munmap(pages, sz);
 }
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: tvrtko.ursulin@intel.com, igt-dev@lists.freedesktop.org,
	matthew.auld@intel.com, mika.kuoppala@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/3] i915/gem_userptr_blits: Only mlock the memfd once, not the arena
Date: Wed, 16 Jan 2019 09:35:07 +0000	[thread overview]
Message-ID: <20190116093509.30195-1-chris@chris-wilson.co.uk> (raw)

We multiply the memfd 64k to create a 2G arena which we then attempt to
write into after marking read-only. Howver, when it comes to unlock the
arena after the test, performance tanks as the kernel tries to resolve
the 64k repeated mappings onto the same set of pages. (Must not be a
very common operation!) We can get away with just mlocking the backing
store to prevent its eviction, which should prevent the arena mapping
from being freed as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=108887
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_userptr_blits.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index 909dd19df..c4e60ba92 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1124,7 +1124,7 @@ static void test_readonly(int i915)
 		*(uint32_t *)(space + offset) = offset;
 	}
 	igt_assert_eq_u32(*(uint32_t *)pages, (uint32_t)(total - sz));
-	igt_assert(mlock(space, total) == 0);
+	igt_assert(mlock(pages, sz) == 0);
 	close(memfd);
 
 	/* Check we can create a normal userptr bo wrapping the wrapper */
@@ -1176,6 +1176,7 @@ static void test_readonly(int i915)
 	}
 	igt_waitchildren();
 
+	munlock(pages, sz);
 	munmap(space, total);
 	munmap(pages, sz);
 }
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-01-16  9:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  9:35 Chris Wilson [this message]
2019-01-16  9:35 ` [igt-dev] [PATCH i-g-t 1/3] i915/gem_userptr_blits: Only mlock the memfd once, not the arena Chris Wilson
2019-01-16  9:35 ` [PATCH i-g-t 2/3] i915/gem_cpu_reloc: Use a self-modifying chained batch Chris Wilson
2019-01-16  9:35   ` [igt-dev] " Chris Wilson
2019-01-16 14:22   ` Mika Kuoppala
2019-01-16 14:22     ` [igt-dev] [Intel-gfx] " Mika Kuoppala
2019-01-16 14:30     ` Chris Wilson
2019-01-16 14:30       ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-01-16 14:49       ` Mika Kuoppala
2019-01-16 14:49         ` [igt-dev] [Intel-gfx] " Mika Kuoppala
2019-01-16  9:35 ` [PATCH i-g-t 3/3] igt/drv_missed_irq: Skip if the kernel reports no rings available to test Chris Wilson
2019-01-16  9:35   ` [igt-dev] " Chris Wilson
2019-01-16 14:30   ` Mika Kuoppala
2019-01-16 14:30     ` [igt-dev] [Intel-gfx] " Mika Kuoppala
2019-01-16  9:47 ` [PATCH i-g-t 1/3] i915/gem_userptr_blits: Only mlock the memfd once, not the arena Mika Kuoppala
2019-01-16  9:47   ` [igt-dev] [Intel-gfx] " Mika Kuoppala
2019-01-16  9:58   ` Chris Wilson
2019-01-16  9:58     ` [Intel-gfx] " Chris Wilson
2019-01-16 10:35     ` Mika Kuoppala
2019-01-16 10:35       ` [igt-dev] [Intel-gfx] " Mika Kuoppala
2019-01-16 10:46       ` Chris Wilson
2019-01-16 10:46         ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-01-16 10:27 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2019-01-16 11:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20190116093509.30195-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=mika.kuoppala@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.