[igt-dev] [PATCH i-g-t v2 2/2] tests/gem_exec_whisper: Fix offsets handling and separate allocators

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Dec 19 11:58:34 UTC 2022


For multiprocess scenarios where drm fds are reopened new contexts
created will have same ctx id. Since reloc allocator started
tracking allocations we have ensure it will be opened on separate
<fd, ctx> pair. Previously reloc simply incremented offsets (even in
multiprocess scenarios) so there were no risk to reuse/rebind offsets
from another process. Also fix bug in offset release - put_offset()
should contain handle, not offset.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/i915/gem_exec_whisper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_exec_whisper.c b/tests/i915/gem_exec_whisper.c
index c3fc5ba804..616231aa96 100644
--- a/tests/i915/gem_exec_whisper.c
+++ b/tests/i915/gem_exec_whisper.c
@@ -106,10 +106,10 @@ static void init_hang(struct hang *h, int fd, const intel_ctx_cfg_t *cfg)
 	if (gem_has_contexts(fd)) {
 		h->ctx = intel_ctx_create(h->fd, cfg);
 		h->execbuf.rsvd1 = h->ctx->id;
-		h->ahnd = get_reloc_ahnd(fd, h->ctx->id);
+		h->ahnd = get_reloc_ahnd(h->fd, h->ctx->id);
 	} else {
 		h->ctx = NULL;
-		h->ahnd = get_reloc_ahnd(fd, 0);
+		h->ahnd = get_reloc_ahnd(h->fd, 0);
 	}
 
 	memset(&h->execbuf, 0, sizeof(h->execbuf));
@@ -174,7 +174,8 @@ static void submit_hang(struct hang *h, unsigned *engines, int nengine, unsigned
 
 static void fini_hang(struct hang *h)
 {
-	put_offset(h->ahnd, h->bb_offset);
+	gem_close(h->fd, h->obj.handle);
+	put_offset(h->ahnd, h->obj.handle);
 	put_ahnd(h->ahnd);
 	intel_ctx_destroy(h->fd, h->ctx);
 	close(h->fd);
-- 
2.34.1



More information about the igt-dev mailing list