All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 5/7] gem_wsim: Make batches preemptable by default
Date: Tue, 14 Aug 2018 16:05:17 +0100	[thread overview]
Message-ID: <20180814150519.20204-6-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

MI_NOOP cannot be preempted which means up to now gem_wsim workloads were
preemptable on batch buffer granularity only.

Add MI_ARB_CHK every 100us so the new default is mid-batch preemption.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 24f518a7770f..f60c086a3f1e 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -683,6 +683,25 @@ static unsigned long get_bb_sz(unsigned int duration)
 		     nop_calibration_us, sizeof(uint32_t));
 }
 
+static void
+init_bb(struct w_step *w, unsigned int flags)
+{
+	/* Preemption point every 100us. */
+	const unsigned int arb_period = get_bb_sz(100) / sizeof(uint32_t);
+	unsigned int i;
+	uint32_t *ptr;
+
+	gem_set_domain(fd, w->bb_handle,
+		       I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
+
+	ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_sz, PROT_WRITE);
+
+	for (i = arb_period; i < w->bb_sz / sizeof(uint32_t); i += arb_period)
+		ptr[i] = 0x5 << 23; /* MI_ARB_CHK */
+
+	munmap(ptr, w->bb_sz);
+}
+
 static void
 terminate_bb(struct w_step *w, unsigned int flags)
 {
@@ -836,6 +855,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
 
 	w->bb_sz = get_bb_sz(w->duration.max);
 	w->bb_handle = w->obj[j].handle = gem_create(fd, w->bb_sz);
+	init_bb(w, flags);
 	terminate_bb(w, flags);
 
 	if (flags & SEQNO) {
-- 
2.17.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: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t 5/7] gem_wsim: Make batches preemptable by default
Date: Tue, 14 Aug 2018 16:05:17 +0100	[thread overview]
Message-ID: <20180814150519.20204-6-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

MI_NOOP cannot be preempted which means up to now gem_wsim workloads were
preemptable on batch buffer granularity only.

Add MI_ARB_CHK every 100us so the new default is mid-batch preemption.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 24f518a7770f..f60c086a3f1e 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -683,6 +683,25 @@ static unsigned long get_bb_sz(unsigned int duration)
 		     nop_calibration_us, sizeof(uint32_t));
 }
 
+static void
+init_bb(struct w_step *w, unsigned int flags)
+{
+	/* Preemption point every 100us. */
+	const unsigned int arb_period = get_bb_sz(100) / sizeof(uint32_t);
+	unsigned int i;
+	uint32_t *ptr;
+
+	gem_set_domain(fd, w->bb_handle,
+		       I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
+
+	ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_sz, PROT_WRITE);
+
+	for (i = arb_period; i < w->bb_sz / sizeof(uint32_t); i += arb_period)
+		ptr[i] = 0x5 << 23; /* MI_ARB_CHK */
+
+	munmap(ptr, w->bb_sz);
+}
+
 static void
 terminate_bb(struct w_step *w, unsigned int flags)
 {
@@ -836,6 +855,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
 
 	w->bb_sz = get_bb_sz(w->duration.max);
 	w->bb_handle = w->obj[j].handle = gem_create(fd, w->bb_sz);
+	init_bb(w, flags);
 	terminate_bb(w, flags);
 
 	if (flags & SEQNO) {
-- 
2.17.1

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

  parent reply	other threads:[~2018-08-14 15:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 15:05 [PATCH i-g-t 0/7] gem_wsim fixes and new features Tvrtko Ursulin
2018-08-14 15:05 ` [Intel-gfx] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 1/7] gem_wsim: Check sleep times Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:09   ` Chris Wilson
2018-08-14 15:09     ` Chris Wilson
2018-08-14 15:21     ` Tvrtko Ursulin
2018-08-14 15:21       ` Tvrtko Ursulin
2018-08-14 15:27       ` Chris Wilson
2018-08-14 15:27         ` Chris Wilson
2018-08-14 18:27         ` Tvrtko Ursulin
2018-08-14 18:27           ` Tvrtko Ursulin
2018-08-14 18:34           ` Chris Wilson
2018-08-14 18:34             ` Chris Wilson
2018-08-14 15:05 ` [PATCH i-g-t 2/7] gem_wsim: Make workload commands case sensitive Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 3/7] gem_wsim: Context priority support Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 4/7] gem_wsim: Stop keeping batches mapped Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:13   ` Chris Wilson
2018-08-14 15:13     ` Chris Wilson
2018-08-14 15:16     ` Tvrtko Ursulin
2018-08-14 15:16       ` Tvrtko Ursulin
2018-08-14 15:05 ` Tvrtko Ursulin [this message]
2018-08-14 15:05   ` [igt-dev] [PATCH i-g-t 5/7] gem_wsim: Make batches preemptable by default Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 6/7] gem_wsim: Per context preemption point control Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 7/7] gem_wsim: Fix BCS usage under VCS2 remap warning Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 16:27 ` [igt-dev] ✓ Fi.CI.BAT: success for gem_wsim fixes and new features Patchwork
2018-08-14 22:29 ` [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=20180814150519.20204-6-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@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 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.