summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2019-02-26 12:17:25 +0000
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2019-03-01 09:39:35 +0000
commit24366f0868c6a33f9f246446c9f322163429ee01 (patch)
tree120ccad96d4f1f21792dce5e20ac6e29d8327ef6 /benchmarks
parentb26530c4c678ab1df7d7fd1ec963f7624dff2245 (diff)
gem_wsim: Round mmap to page size
mmap(2) mandates size is page aligned. 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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 0a5abc08..57ceb983 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -737,6 +737,7 @@ init_bb(struct w_step *w, unsigned int flags)
{
const unsigned int arb_period =
get_bb_sz(w->preempt_us) / sizeof(uint32_t);
+ const unsigned int mmap_len = ALIGN(w->bb_sz, 4096);
unsigned int i;
uint32_t *ptr;
@@ -746,12 +747,12 @@ init_bb(struct w_step *w, unsigned int flags)
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);
+ ptr = gem_mmap__wc(fd, w->bb_handle, 0, mmap_len, 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);
+ munmap(ptr, mmap_len);
}
static void
@@ -771,7 +772,7 @@ terminate_bb(struct w_step *w, unsigned int flags)
batch_start -= 12 * sizeof(uint32_t);
mmap_start = rounddown(batch_start, PAGE_SIZE);
- mmap_len = w->bb_sz - mmap_start;
+ mmap_len = ALIGN(w->bb_sz - mmap_start, PAGE_SIZE);
gem_set_domain(fd, w->bb_handle,
I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);