All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] i915/gem_exec_fence: Replace customer spinner with igt_spin
@ 2022-11-08  8:56 Vikas Srivastava
  2022-11-08  9:17 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork
  0 siblings, 1 reply; 2+ messages in thread
From: Vikas Srivastava @ 2022-11-08  8:56 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris.p.wilson@intel.com>

Replace the customer spinner with igt_spin, possible now that igt_spin
can provide the out-fence. This has a major advantage, such as able to run
on any platform, including over the cmdparser.

Signed-off-by: Chris Wilson <chris.p.wilson@intel.com>
Acked-by: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
---
 tests/i915/gem_exec_fence.c | 101 ++++++++----------------------------
 1 file changed, 23 insertions(+), 78 deletions(-)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index e8d51a732..80cf7adb2 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -29,6 +29,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_dummyload.h"
 #include "igt_store.h"
 #include "igt_syncobj.h"
 #include "igt_sysfs.h"
@@ -72,104 +73,48 @@ static void test_fence_busy(int fd, const intel_ctx_t *ctx,
 			    const struct intel_execution_engine2 *e,
 			    unsigned flags)
 {
-	const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
-	struct drm_i915_gem_exec_object2 obj;
-	struct drm_i915_gem_relocation_entry reloc;
-	struct drm_i915_gem_execbuffer2 execbuf;
-	struct timespec tv;
-	uint32_t *batch;
 	uint64_t ahnd = get_reloc_ahnd(fd, ctx->id);
-	int fence, i, timeout;
-
-	if ((flags & HANG) == 0)
-		igt_require(gem_class_has_mutable_submission(fd, e->class));
+	struct timespec tv;
+	int fence, timeout;
+	igt_spin_t *spin;
 
 	gem_quiescent_gpu(fd);
 
-	memset(&execbuf, 0, sizeof(execbuf));
-	execbuf.buffers_ptr = to_user_pointer(&obj);
-	execbuf.buffer_count = 1;
-	execbuf.flags = e->flags | I915_EXEC_FENCE_OUT;
-	execbuf.rsvd1 = ctx->id;
-
-	memset(&obj, 0, sizeof(obj));
-	obj.handle = gem_create(fd, 4096);
-	obj.offset = get_offset(ahnd, obj.handle, 4096, 0);
-
-	batch = gem_mmap__device_coherent(fd, obj.handle, 0, 4096, PROT_WRITE);
-	gem_set_domain(fd, obj.handle,
-		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
-	i = 0;
-	if ((flags & HANG) == 0)
-		batch[i++] = 0x5 << 23;
-
-	if (!ahnd) {
-		obj.relocs_ptr = to_user_pointer(&reloc);
-		obj.relocation_count = 1;
-		memset(&reloc, 0, sizeof(reloc));
-		reloc.target_handle = obj.handle; /* recurse */
-		reloc.presumed_offset = obj.offset;
-		reloc.offset = (i + 1) * sizeof(uint32_t);
-		reloc.delta = 0;
-		reloc.read_domains = I915_GEM_DOMAIN_COMMAND;
-		reloc.write_domain = 0;
-	} else {
-		obj.flags |= EXEC_OBJECT_PINNED;
-	}
-
-	batch[i] = MI_BATCH_BUFFER_START;
-	if (gen >= 8) {
-		batch[i] |= 1 << 8 | 1;
-		batch[++i] = obj.offset;
-		batch[++i] = obj.offset >> 32;
-	} else if (gen >= 6) {
-		batch[i] |= 1 << 8;
-		batch[++i] = obj.offset;
-	} else {
-		batch[i] |= 2 << 6;
-		batch[++i] = obj.offset;
-		if (gen < 4) {
-			batch[i] |= 1;
-			reloc.delta = 1;
-		}
-	}
-	i++;
-
-	execbuf.rsvd2 = -1;
-	gem_execbuf_wr(fd, &execbuf);
-	fence = execbuf.rsvd2 >> 32;
-	igt_assert(fence != -1);
+	spin = igt_spin_new(fd, .ahnd = ahnd, .ctx = ctx, .engine = e->flags,
+			    .flags = IGT_SPIN_FENCE_OUT |
+			    ((flags & HANG) ? IGT_SPIN_NO_PREEMPTION : 0));
 
-	igt_assert(gem_bo_busy(fd, obj.handle));
+	fence = spin->out_fence;
+	igt_assert(gem_bo_busy(fd, spin->handle));
 	igt_assert(fence_busy(fence));
 
 	timeout = 120;
 	if ((flags & HANG) == 0) {
-		*batch = MI_BATCH_BUFFER_END;
-		__sync_synchronize();
-		timeout = 1;
+                igt_spin_end(spin);
+                timeout = ! igt_run_in_simulation()?1:120;
+                if (is_sriov_enabled(fd)) timeout *= 4;
 	}
-	munmap(batch, 4096);
 
 	if (flags & WAIT) {
 		struct pollfd pfd = { .fd = fence, .events = POLLIN };
 		igt_assert(poll(&pfd, 1, timeout*1000) == 1);
 	} else {
 		memset(&tv, 0, sizeof(tv));
-		while (fence_busy(fence))
-			igt_assert(igt_seconds_elapsed(&tv) < timeout);
-	}
-
-	igt_assert(!gem_bo_busy(fd, obj.handle));
+		while (fence_busy(fence)) {
+                        elapsed_time = igt_seconds_elapsed(&tv);
+                        if (elapsed_time >= timeout) {
+                                igt_info("Elapsed time (%ds)\n", elapsed_time);
+                        }
+                        igt_assert(igt_seconds_elapsed(&tv) < timeout);
+                }
+		igt_info("Elapsed time (%ds)\n", igt_seconds_elapsed(&tv));
+	}
+	igt_assert(!gem_bo_busy(fd, spin->handle));
 	igt_assert_eq(sync_fence_status(fence),
 		      flags & HANG ? -EIO : SYNC_FENCE_OK);
 
-	close(fence);
-	gem_close(fd, obj.handle);
-	put_offset(ahnd, obj.handle);
+	igt_spin_free(fd, spin);
 	put_ahnd(ahnd);
-
 	gem_quiescent_gpu(fd);
 }
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [igt-dev] ✗ Fi.CI.BUILD: failure for i915/gem_exec_fence: Replace customer spinner with igt_spin
  2022-11-08  8:56 [igt-dev] [PATCH i-g-t] i915/gem_exec_fence: Replace customer spinner with igt_spin Vikas Srivastava
@ 2022-11-08  9:17 ` Patchwork
  0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2022-11-08  9:17 UTC (permalink / raw)
  To: Vikas Srivastava; +Cc: igt-dev

== Series Details ==

Series: i915/gem_exec_fence: Replace customer spinner with igt_spin
URL   : https://patchwork.freedesktop.org/series/110655/
State : failure

== Summary ==

IGT patchset build failed on latest successful build
9cea1d05f492429a6d793995b87081e87a94b492 tests/prime_vgem: Fix timeout/incomplete issue in MTL simulation

[180/706] Linking target tests/api_intel_allocator.
[181/706] Linking target tests/api_intel_bb.
[182/706] Linking target tests/gem_bad_reloc.
[183/706] Linking target tests/gen3_mixed_blits.
[184/706] Linking target tests/gen3_render_linear_blits.
[185/706] Linking target tests/gen3_render_mixed_blits.
[186/706] Linking target tests/gen3_render_tiledx_blits.
[187/706] Linking target tests/gen3_render_tiledy_blits.
[188/706] Linking target tests/gem_basic.
[189/706] Linking target tests/gem_blits.
[190/706] Linking target tests/gem_ccs.
[191/706] Linking target tests/gem_busy.
[192/706] Linking target tests/gem_caching.
[193/706] Linking target tests/gem_close.
[194/706] Linking target tests/gem_close_race.
[195/706] Linking target tests/gem_cs_tlb.
[196/706] Linking target tests/gem_concurrent_blit.
[197/706] Linking target tests/gem_ctx_bad_destroy.
[198/706] Linking target tests/gem_ctx_exec.
[199/706] Linking target tests/gem_ctx_create.
[200/706] Linking target tests/gem_ctx_engines.
[201/706] Linking target tests/gem_ctx_isolation.
[202/706] Linking target tests/gem_ctx_param.
[203/706] Linking target tests/gem_ctx_persistence.
[204/706] Linking target tests/gem_ctx_shared.
[205/706] Linking target tests/gem_ctx_switch.
[206/706] Linking target tests/gem_evict_alignment.
[207/706] Linking target tests/gem_evict_everything.
[208/706] Linking target tests/gem_exec_alignment.
[209/706] Linking target tests/gem_exec_async.
[210/706] Linking target tests/gem_exec_await.
[211/706] Linking target tests/gem_exec_basic.
[212/706] Linking target tests/gem_exec_big.
[213/706] Linking target tests/gem_exec_endless.
[214/706] Linking target tests/gem_exec_capture.
[215/706] Linking target tests/gem_exec_create.
[216/706] Compiling C object 'tests/59830eb@@gem_exec_fence@exe/i915_gem_exec_fence.c.o'.
FAILED: tests/59830eb@@gem_exec_fence@exe/i915_gem_exec_fence.c.o 
cc -Itests/59830eb@@gem_exec_fence@exe -Itests -I../../../usr/src/igt-gpu-tools/tests -I../../../usr/src/igt-gpu-tools/include/drm-uapi -I../../../usr/src/igt-gpu-tools/include/linux-uapi -Ilib -I../../../usr/src/igt-gpu-tools/lib -I../../../usr/src/igt-gpu-tools/lib/stubs/syscalls -I. -I../../../usr/src/igt-gpu-tools/ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/x86_64-linux-gnu -I/usr/include/valgrind -I/usr/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/59830eb@@gem_exec_fence@exe/i915_gem_exec_fence.c.o' -MF 'tests/59830eb@@gem_exec_fence@exe/i915_gem_exec_fence.c.o.d' -o 'tests/59830eb@@gem_exec_fence@exe/i915_gem_exec_fence.c.o' -c ../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c
../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c: In function ‘test_fence_busy’:
../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c:95:21: error: implicit declaration of function ‘is_sriov_enabled’ [-Werror=implicit-function-declaration]
   95 |                 if (is_sriov_enabled(fd)) timeout *= 4;
      |                     ^~~~~~~~~~~~~~~~
../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c:95:21: warning: nested extern declaration of ‘is_sriov_enabled’ [-Wnested-externs]
../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c:104:25: error: ‘elapsed_time’ undeclared (first use in this function)
  104 |                         elapsed_time = igt_seconds_elapsed(&tv);
      |                         ^~~~~~~~~~~~
../../../usr/src/igt-gpu-tools/tests/i915/gem_exec_fence.c:104:25: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-08  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  8:56 [igt-dev] [PATCH i-g-t] i915/gem_exec_fence: Replace customer spinner with igt_spin Vikas Srivastava
2022-11-08  9:17 ` [igt-dev] ✗ Fi.CI.BUILD: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.