[igt-dev] [Intel-gfx] [PATCH i-g-t 2/5] gem_wsim: Round mmap to page size

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 28 14:25:53 UTC 2019


Quoting Tvrtko Ursulin (2019-02-28 14:18:25)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> mmap(2) mandates size is page aligned.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  benchmarks/gem_wsim.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
> index 0a5abc08d8c2..57ceb983cf82 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;

You only need to do it for

ww->bb_sz = ALIGN(get_bb_sz(), 4096);

All batch lengths are start = ww->bb_sz - get_bb_sz() and so remain
correct. Right?
-Chris


More information about the igt-dev mailing list