diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-15 09:16:30 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-15 09:18:31 +0000 |
commit | 488dc3b1acf825c1db9750b1158de56b50e7b4ff (patch) | |
tree | 62ada48b0e21b8498b01b5e6df2e01f95518a83c /tests/gem_exec_whisper.c | |
parent | 1430eb065f110c899ce7f097a002cb1efe33212d (diff) |
igt/gem_exec_whisper: Beware PIN_HIGH
Certain kernels/gen like to move execbuf around for relocations,
disrupting our prewritten batches. Be more careful and try and keep the
relocation/execobjects accurate.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_exec_whisper.c')
-rw-r--r-- | tests/gem_exec_whisper.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/gem_exec_whisper.c b/tests/gem_exec_whisper.c index d434b89c..3da2cfd9 100644 --- a/tests/gem_exec_whisper.c +++ b/tests/gem_exec_whisper.c @@ -117,6 +117,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) unsigned nengine; uint32_t batch[16]; int i, n, pass, loc; + unsigned int reloc_migrations = 0; + unsigned int eb_migrations = 0; nengine = 0; if (engine == -1) { @@ -212,6 +214,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) write_seqno(pass); + reloc.presumed_offset = scratch.offset; reloc.delta = 4*pass; offset = reloc.presumed_offset + reloc.delta; @@ -233,6 +236,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) verify_reloc(fd, store.handle, &reloc); execbuf.buffers_ptr = (uintptr_t)tmp; gem_execbuf(fd, &execbuf); + reloc_migrations += reloc.presumed_offset == -1; + igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); scratch = tmp[0]; gem_write(fd, batches[1023].handle, loc, &pass, sizeof(pass)); @@ -263,6 +268,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) if (flags & CONTEXTS) execbuf.rsvd1 = contexts[rand() % 64]; gem_execbuf(this_fd, &execbuf); + reloc_migrations += inter[n].presumed_offset == -1; + inter[n].presumed_offset = batches[n-1].offset; batches[n-1].relocation_count = 1; batches[n-1].flags &= ~EXEC_OBJECT_WRITE; @@ -282,21 +289,30 @@ static void whisper(int fd, unsigned engine, unsigned flags) tmp[0] = tmp[1]; tmp[0].relocation_count = 0; tmp[0].flags = EXEC_OBJECT_WRITE; + tmp[0].offset = inter[0].presumed_offset; tmp[1] = batches[0]; verify_reloc(fd, batches[0].handle, &inter[0]); gem_execbuf(fd, &execbuf); + reloc_migrations += inter[0].presumed_offset == -1; batches[0] = tmp[1]; tmp[1] = tmp[0]; tmp[0] = scratch; + igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); igt_assert(tmp[1].relocs_ptr == (uintptr_t)&reloc); tmp[1].relocation_count = 1; tmp[1].flags &= ~EXEC_OBJECT_WRITE; verify_reloc(fd, store.handle, &reloc); gem_execbuf(fd, &execbuf); + eb_migrations += tmp[0].offset != scratch.offset; + eb_migrations += tmp[1].offset != store.offset; + reloc_migrations += reloc.presumed_offset == -1; + igt_assert_eq_u64(reloc.presumed_offset, tmp[0].offset); store = tmp[1]; scratch = tmp[0]; } + igt_info("Number of migrations for execbuf: %d\n", eb_migrations); + igt_info("Number of migrations for reloc: %d\n", reloc_migrations); check_bo(fd, scratch.handle); gem_close(fd, scratch.handle); |