summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-04-27 09:57:46 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-04-28 10:10:17 +0100
commitd095827add11d4e8158b87683971ee659749d9a4 (patch)
tree3e5a56216fca1dae2b772614f7c838b1ab93d9fc /benchmarks
parenta66326d0c01f88d12deb1e5c8bd42fd3aaacfbdd (diff)
gem_wsim: Fix preempt period assert
Recently added assert in a common helper used for calculating batch duration and preemption period is harmful when preemption is disabled on a context. Split out into low level and high level helper and use the former for preemption period queries. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/gem_wsim.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 81f47b86..ad4edb93 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -1151,7 +1151,7 @@ __get_ctx(struct workload *wrk, const struct w_step *w)
}
static unsigned long
-get_bb_sz(const struct w_step *w, unsigned int duration)
+__get_bb_sz(const struct w_step *w, unsigned int duration)
{
enum intel_engine_id engine = w->engine;
struct ctx *ctx = __get_ctx(w->wrk, w);
@@ -1165,6 +1165,15 @@ get_bb_sz(const struct w_step *w, unsigned int duration)
d = ALIGN(duration * engine_calib_map[engine] * sizeof(uint32_t) /
nop_calibration_us,
sizeof(uint32_t));
+
+ return d;
+}
+
+static unsigned long
+get_bb_sz(const struct w_step *w, unsigned int duration)
+{
+ unsigned long d = __get_bb_sz(w, duration);
+
igt_assert(d);
return d;
@@ -1174,7 +1183,7 @@ static void
init_bb(struct w_step *w, unsigned int flags)
{
const unsigned int arb_period =
- get_bb_sz(w, w->preempt_us) / sizeof(uint32_t);
+ __get_bb_sz(w, w->preempt_us) / sizeof(uint32_t);
const unsigned int mmap_len = ALIGN(w->bb_sz, 4096);
unsigned int i;
uint32_t *ptr;
@@ -1395,7 +1404,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags)
if (w->unbound_duration)
/* nops + MI_ARB_CHK + MI_BATCH_BUFFER_START */
- w->bb_sz = max(PAGE_SIZE, get_bb_sz(w, w->preempt_us)) +
+ w->bb_sz = max(PAGE_SIZE, __get_bb_sz(w, w->preempt_us)) +
(1 + 3) * sizeof(uint32_t);
else
w->bb_sz = get_bb_sz(w, w->duration.max);