igt_dummyload: Wrap function parameters into struct
PATCH 1/5 igt_dummyload: Wrap function parameters into struct
Cleanup the interface for creating dummyloads by folding its parameters into a struct.
--- lib/igt_dummyload.c | 19 +++++++++++-------- lib/igt_dummyload.h | 16 ++++++++-------- tests/drv_missed_irq.c | 3 ++- tests/gem_busy.c | 18 ++++++++++-------- tests/gem_exec_fence.c | 16 +++++++++------- tests/gem_exec_latency.c | 4 +++- tests/gem_exec_nop.c | 4 +++- tests/gem_exec_reloc.c | 10 +++++++--- tests/gem_exec_schedule.c | 16 ++++++++++++---- tests/gem_exec_suspend.c | 2 +- tests/gem_shrink.c | 5 +++-- tests/gem_spin_batch.c | 5 +++-- tests/gem_sync.c | 7 +++---- tests/gem_wait.c | 4 +++- tests/kms_busy.c | 10 +++++++--- tests/kms_cursor_legacy.c | 7 ++++--- tests/kms_flip.c | 10 ++++++---- tests/perf_pmu.c | 30 +++++++++++++++++++----------- tests/pm_rps.c | 2 +- 19 files changed, 115 insertions(+), 73 deletions(-)
lib/igt_dummyload.c +11 -8
@@ -172,14 +172,14 @@ static void emit_recursive_batch(igt_spin_t *spin, }igt_spin_t * -__igt_spin_batch_new (int fd,uint32_t ctx,unsigned engine,uint32_t dep) +__igt_spin_batch_new (int fd,igt_spin_opt_t opts) {igt_spin_t *spin; spin =calloc (1 ,sizeof (struct igt_spin ));igt_assert (spin); -emit_recursive_batch (spin, fd, ctx, engine, dep); +emit_recursive_batch (spin, fd, opts.ctx, opts.engine, opts.dep);igt_assert (gem_bo_busy (fd, spin->handle));igt_list_add (&spin->link, &spin_list);
@@ -190,10 +190,13 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)/** * igt_spin_batch_new: * @fd: open i915 drm file descriptor -* @engine: Ring to execute batch OR'd with execbuf flags. If value is less -* than 0, execute on all available rings. -* @dep: handle to a buffer object dependency. If greater than 0, add a -* relocation entry to this buffer within the batch. +* @opt: structure containing the parameters used by the call: +* - ctx: Context that will be used to submit spinning batch. Provide 0 +* to use default context. +* - engine: Ring to execute batch OR'd with execbuf flags. If value +* is less than 0, execute on all available rings. +* - dep: handle to a buffer object dependency. If greater than 0, add a +* relocation entry to this buffer within the batch. * * Start a recursive batch on a ring. Immediately returns a #igt_spin_t that * contains the batch's handle that can be waited upon. The returned structure
@@ -203,11 +206,11 @@ __igt_spin_batch_new(int fd, uint32_t ctx, unsigned engine, uint32_t dep)* Structure with helper internal state for igt_spin_batch_free(). */ igt_spin_t * -igt_spin_batch_new (int fd,uint32_t ctx,unsigned engine,uint32_t dep) +igt_spin_batch_new (int fd,igt_spin_opt_t opts) {igt_require_gem (fd); -return __igt_spin_batch_new (fd, ctx, engine, dep); +return __igt_spin_batch_new (fd, opts); }static void notify (union sigval arg)
lib/igt_dummyload.h +8 -8
@@ -37,14 +37,14 @@ typedef struct igt_spin {uint32_t *batch; } igt_spin_t; -igt_spin_t *__igt_spin_batch_new (int fd, -uint32_t ctx, -unsigned engine, -uint32_t dep); -igt_spin_t *igt_spin_batch_new (int fd, -uint32_t ctx, -unsigned engine, -uint32_t dep); +typedef struct igt_spin_opt { +uint32_t ctx; +unsigned engine; +uint32_t dep; +}igt_spin_opt_t ; + +igt_spin_t *__igt_spin_batch_new (int fd,igt_spin_opt_t opts); +igt_spin_t *igt_spin_batch_new (int fd,igt_spin_opt_t opts);void igt_spin_batch_set_timeout (igt_spin_t *spin,int64_t ns);void igt_spin_batch_end (igt_spin_t *spin);void igt_spin_batch_free (int fd,igt_spin_t *spin);
tests/drv_missed_irq.c +2 -1
@@ -33,7 +33,8 @@ IGT_TEST_DESCRIPTION("Inject missed interrupts and make sure they are caught");static void trigger_missed_interrupt (int fd,unsigned ring) { -igt_spin_t *spin =__igt_spin_batch_new (fd,0 , ring,0 ); +igt_spin_t *spin =__igt_spin_batch_new (fd, + (igt_spin_opt_t ){.engine = ring}); igt_fork(child, 1) {/* We are now a low priority child on the *same* CPU as the
tests/gem_busy.c +10 -8
@@ -113,7 +113,9 @@ static void semaphore(int fd, unsigned ring, uint32_t flags)/* Create a long running batch which we can use to hog the GPU */ handle[BUSY ] =gem_create (fd,4096 ); - spin =igt_spin_batch_new (fd,0 , ring, handle[BUSY ]); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = ring, + .dep = handle[BUSY ]});/* Queue a batch after the busy, it should block and remain "busy" */ igt_assert (exec_noop (fd, handle, ring | flags, false));
@@ -459,17 +461,16 @@ static void close_race(int fd)igt_assert (sched_setscheduler (getpid (),SCHED_RR , &rt) ==0 );for (i =0 ; i < nhandles; i++) { - spin[i] =igt_spin_batch_new (fd,0 , - engines[rand () % nengine],0 ); + spin[i] =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine =engines[rand () % nengine]}); handles[i] = spin[i]->handle; } igt_until_timeout(20) {for (i =0 ; i < nhandles; i++) {igt_spin_batch_free (fd, spin[i]); - spin[i] =igt_spin_batch_new (fd,0 , - engines[rand () % nengine], -0 ); + spin[i] =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engines[rand () % nengine]}); handles[i] = spin[i]->handle;__sync_synchronize (); }
@@ -511,7 +512,8 @@ static bool has_semaphores(int fd)static bool has_extended_busy_ioctl (int fd) { -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,I915_EXEC_RENDER ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.engine =I915_EXEC_RENDER });uint32_t read, write;__gem_busy (fd, spin->handle, &read, &write);
@@ -522,7 +524,7 @@ static bool has_extended_busy_ioctl(int fd)static void basic (int fd,unsigned ring,unsigned flags) { -igt_spin_t *spin =igt_spin_batch_new (fd,0 , ring,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = ring});struct timespec tv;int timeout;bool busy;
tests/gem_exec_fence.c +9 -7
@@ -438,7 +438,9 @@ static void test_parallel(int fd, unsigned int master)/* Fill the queue with many requests so that the next one has to * wait before it can be executed by the hardware. */ - spin =igt_spin_batch_new (fd,0 , master, c.handle); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = master, + .dep = c.handle});resubmit (fd, spin->handle, master,16 );/* Now queue the master request and its secondaries */
@@ -961,7 +963,7 @@ static void test_syncobj_unused_fence(int fd)struct local_gem_exec_fence fence = { .handle =syncobj_create (fd), }; -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,0 ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });/* sanity check our syncobj_to_sync_file interface */ igt_assert_eq (__syncobj_to_sync_file (fd,0 ), -ENOENT );
@@ -1053,7 +1055,7 @@ static void test_syncobj_signal(int fd)struct local_gem_exec_fence fence = { .handle =syncobj_create (fd), }; -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,0 ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });/* Check that the syncobj is signaled only when our request/fence is */
@@ -1103,7 +1105,7 @@ static void test_syncobj_wait(int fd)gem_quiescent_gpu (fd); - spin =igt_spin_batch_new (fd,0 ,0 ,0 ); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&obj);
@@ -1173,7 +1175,7 @@ static void test_syncobj_export(int fd) .handle = syncobj_create(fd), };int export[2 ]; -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,0 ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });/* Check that if we export the syncobj prior to use it picks up * the later fence. This allows a syncobj to establish a channel
@@ -1231,7 +1233,7 @@ static void test_syncobj_repeat(int fd)struct drm_i915_gem_execbuffer2 execbuf;struct local_gem_exec_fence *fence;int export; -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,0 ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });/* Check that we can wait on the same fence multiple times */ fence =calloc (nfences,sizeof (*fence));
@@ -1286,7 +1288,7 @@ static void test_syncobj_import(int fd)const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_exec_object2 obj;struct drm_i915_gem_execbuffer2 execbuf; -igt_spin_t *spin =igt_spin_batch_new (fd,0 ,0 ,0 ); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ });uint32_t sync =syncobj_create (fd);int fence;
tests/gem_exec_latency.c +3 -1
@@ -344,7 +344,9 @@ static void latency_from_ring(int fd, I915_GEM_DOMAIN_GTT);if (flags &PREEMPT ) - spin =igt_spin_batch_new (fd, ctx[0 ], ring,0 ); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .ctx = ctx[0 ], + .engine = ring});if (flags &CORK ) {plug (fd, &c);
tests/gem_exec_nop.c +3 -1
@@ -620,7 +620,9 @@ static void preempt(int fd, uint32_t handle,clock_gettime (CLOCK_MONOTONIC , &start); do { igt_spin_t *spin = - __igt_spin_batch_new(fd, ctx[0], ring_id, 0); + __igt_spin_batch_new(fd, (igt_spin_opt_t){ + .ctx = ctx[0], + .engine = ring_id}); for (int loop = 0; loop < 1024; loop++) gem_execbuf(fd, &execbuf);
tests/gem_exec_reloc.c +7 -3
@@ -388,7 +388,9 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) }if (flags &ACTIVE ) { - spin =igt_spin_batch_new (fd,0 ,I915_EXEC_DEFAULT , obj.handle); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine =I915_EXEC_DEFAULT , + .dep = obj.handle});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj.handle));
@@ -454,7 +456,9 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags) }if (flags &ACTIVE ) { - spin =igt_spin_batch_new (fd,0 ,I915_EXEC_DEFAULT , obj.handle); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine =I915_EXEC_DEFAULT , + .dep = obj.handle});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj.handle));
@@ -581,7 +585,7 @@ static void basic_range(int fd, unsigned flags) execbuf.buffer_count = n +1 ;if (flags &ACTIVE ) { - spin =igt_spin_batch_new (fd,0 ,0 , obj[n].handle); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.dep = obj[n].handle});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj[n].handle));
tests/gem_exec_schedule.c +12 -4
@@ -147,7 +147,9 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)for (int n =0 ; n <ARRAY_SIZE (spin); n++) {uint32_t ctx =create_highest_priority (fd); - spin[n] =__igt_spin_batch_new (fd, ctx, engine,0 ); + spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .ctx = ctx, + .engine = engine});gem_context_destroy (fd, ctx); }
@@ -376,7 +378,9 @@ static void preempt(int fd, unsigned ring, unsigned flags) ctx[LO ] =gem_context_create (fd);gem_context_set_priority (fd, ctx[LO ],MIN_PRIO ); } - spin[n] =__igt_spin_batch_new (fd, ctx[LO ], ring,0 ); + spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .ctx = ctx[LO ], + .engine = ring});igt_debug ("spin[%d].handle=%d\n" , n, spin[n]->handle);store_dword (fd, ctx[HI ], ring, result,0 , n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
@@ -425,7 +429,9 @@ static void preempt_other(int fd, unsigned ring) n =0 ;for_each_engine (fd, other) { - spin[n] =__igt_spin_batch_new (fd, ctx[NOISE ], other,0 ); + spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .ctx = ctx[NOISE ], + .engine = other});store_dword (fd, ctx[LO ], other, result, (n +1 )*sizeof (uint32_t ), n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
@@ -478,7 +484,9 @@ static void preempt_self(int fd, unsigned ring) n =0 ;gem_context_set_priority (fd, ctx[HI ],MIN_PRIO );for_each_engine (fd, other) { - spin[n] =__igt_spin_batch_new (fd, ctx[NOISE ], other,0 ); + spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .ctx = ctx[NOISE ], + .engine = other});store_dword (fd, ctx[HI ], other, result, (n +1 )*sizeof (uint32_t ), n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
tests/gem_exec_suspend.c +1 -1
@@ -201,7 +201,7 @@ static void run_test(int fd, unsigned engine, unsigned flags) }if (flags &HANG ) - spin =igt_spin_batch_new (fd,0 , engine,0 ); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine});switch (mode (flags)) {case NOSLEEP :
tests/gem_shrink.c +3 -2
@@ -311,9 +311,10 @@ static void reclaim(unsigned engine, int timeout) }while (!*shared); } - spin =igt_spin_batch_new (fd,0 , engine,0 ); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine});igt_until_timeout (timeout) { -igt_spin_t *next =__igt_spin_batch_new (fd,0 , engine,0 ); +igt_spin_t *next =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine});igt_spin_batch_set_timeout (spin, timeout_100ms);gem_sync (fd, spin->handle);
tests/gem_spin_batch.c +3 -2
@@ -41,9 +41,10 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec)struct timespec itv = { };uint64_t elapsed; - spin =igt_spin_batch_new (fd,0 , engine,0 ); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine});while ((elapsed =igt_nsec_elapsed (&tv)) >>30 < timeout_sec) { -igt_spin_t *next =__igt_spin_batch_new (fd,0 , engine,0 ); +igt_spin_t *next =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine});igt_spin_batch_set_timeout (spin, timeout_100ms -igt_nsec_elapsed (&itv));
tests/gem_sync.c +3 -4
@@ -756,10 +756,9 @@ preempt(int fd, unsigned ring, int num_children, int timeout) cycles =0 ; do { igt_spin_t *spin = - __igt_spin_batch_new(fd, - ctx[0], - execbuf.flags, - 0); + __igt_spin_batch_new(fd, (igt_spin_opt_t){ + .ctx = ctx[0], + .engine = execbuf.flags}); do { gem_execbuf(fd, &execbuf);
tests/gem_wait.c +3 -1
@@ -110,7 +110,9 @@ static void unplug(struct cork *c)static void basic (int fd,unsigned engine,unsigned flags) {struct cork cork =plug (fd, flags); -igt_spin_t *spin =igt_spin_batch_new (fd,0 , engine, cork.handle); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine, + .dep = cork.handle});struct drm_i915_gem_wait wait = { flags &WRITE ? cork.handle : spin->handle };
tests/kms_busy.c +7 -3
@@ -92,7 +92,7 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,struct drm_event_vblank ev;igt_spin_t *t =igt_spin_batch_new (dpy->drm_fd, -0 , ring, fb->gem_handle); + (igt_spin_opt_t ){.engine = ring, .dep = fb->gem_handle});if (modeset) {/*
@@ -208,7 +208,9 @@ static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary, struct igt_fb *busy_fb, unsigned ring) {igt_spin_t *t =igt_spin_batch_new (dpy->drm_fd, -0 , ring, busy_fb->gem_handle); + (igt_spin_opt_t ){ + .engine = ring, + .dep = busy_fb->gem_handle});struct pollfd pfd = { .fd = dpy->drm_fd, .events =POLLIN };unsigned flags =0 ;struct drm_event_vblank ev;
@@ -295,7 +297,9 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy,igt_display_commit2 (dpy, dpy->is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY ); - t =igt_spin_batch_new (dpy->drm_fd,0 , ring, fb.gem_handle); + t =igt_spin_batch_new (dpy->drm_fd, (igt_spin_opt_t ){ + .engine = ring, + .dep = fb.gem_handle});do_or_die (drmModePageFlip (dpy->drm_fd, dpy->pipes[pipe].crtc_id, fb.fb_id,DRM_MODE_PAGE_FLIP_EVENT , &fb));
tests/kms_cursor_legacy.c +4 -3
@@ -532,7 +532,8 @@ static void basic_flip_cursor(igt_display_t *display, spin =NULL ;if (flags &BASIC_BUSY ) - spin =igt_spin_batch_new (display->drm_fd,0 ,0 , fb_info.gem_handle); + spin =igt_spin_batch_new (display->drm_fd, + (igt_spin_opt_t ){.dep = fb_info.gem_handle});/* Start with a synchronous query to align with the vblank */ vblank_start =get_vblank (display->drm_fd, pipe,DRM_VBLANK_NEXTONMISS );
@@ -1298,8 +1299,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)int ncrcs;static const int max_crcs =8 ; - spin =igt_spin_batch_new (display->drm_fd,0 ,0 , - fb_info[1 ].gem_handle); + spin =igt_spin_batch_new (display->drm_fd, (igt_spin_opt_t ){ + .dep = fb_info[1 ].gem_handle}); vblank_start =get_vblank (display->drm_fd, pipe,DRM_VBLANK_NEXTONMISS );
tests/kms_flip.c +6 -4
@@ -692,15 +692,17 @@ static unsigned int run_test_step(struct test_output *o) o->current_fb_id = !o->current_fb_id;if (o->flags &TEST_WITH_DUMMY_BCS ) { - spin_bcs =igt_spin_batch_new (drm_fd,0 ,I915_EXEC_BLT , - o->fb_info[o->current_fb_id].gem_handle); + spin_bcs =igt_spin_batch_new (drm_fd, (igt_spin_opt_t ){ + .engine =I915_EXEC_BLT , + .dep = o->fb_info[o->current_fb_id].gem_handle});igt_spin_batch_set_timeout (spin_bcs,NSEC_PER_SEC ); }if (o->flags &TEST_WITH_DUMMY_RCS ) { - spin_rcs =igt_spin_batch_new (drm_fd,0 ,I915_EXEC_RENDER , - o->fb_info[o->current_fb_id].gem_handle); + spin_rcs =igt_spin_batch_new (drm_fd, (igt_spin_opt_t ){ + .engine =I915_EXEC_RENDER , + .dep = o->fb_info[o->current_fb_id].gem_handle});igt_spin_batch_set_timeout (spin_rcs,NSEC_PER_SEC ); }
tests/perf_pmu.c +19 -11
@@ -141,7 +141,8 @@ single(int gem_fd, const struct intel_execution_engine2 *e, bool busy) fd =open_pmu (I915_PMU_ENGINE_BUSY (e->class, e->instance));if (busy) { - spin =igt_spin_batch_new (gem_fd,0 ,e2ring (gem_fd, e),0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e)});igt_spin_batch_set_timeout (spin, batch_duration_ns); }else {usleep (batch_duration_ns /1000 );
@@ -203,7 +204,8 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,igt_assert_eq (i, num_engines); - spin =igt_spin_batch_new (gem_fd,0 ,e2ring (gem_fd, e),0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e)});igt_spin_batch_set_timeout (spin, batch_duration_ns);gem_sync (gem_fd, spin->handle);
@@ -248,8 +250,8 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,if (e == e_) { idle_idx = i; }else { - spin[i] =igt_spin_batch_new (gem_fd,0 , -e2ring (gem_fd, e_),0 ); + spin[i] =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e_)});igt_spin_batch_set_timeout (spin[i], batch_duration_ns); }
@@ -297,7 +299,8 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines) fd[i] =open_group (I915_PMU_ENGINE_BUSY (e->class, e->instance), fd[0 ]); - spin[i] =igt_spin_batch_new (gem_fd,0 ,e2ring (gem_fd, e),0 ); + spin[i] =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e)});igt_spin_batch_set_timeout (spin[i], batch_duration_ns); i++;
@@ -328,7 +331,8 @@ no_sema(int gem_fd, const struct intel_execution_engine2 *e, bool busy)open_group (I915_PMU_ENGINE_WAIT (e->class, e->instance), fd);if (busy) { - spin =igt_spin_batch_new (gem_fd,0 ,e2ring (gem_fd, e),0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e)});igt_spin_batch_set_timeout (spin, batch_duration_ns); }else {usleep (batch_duration_ns /1000 );
@@ -647,7 +651,8 @@ multi_client(int gem_fd, const struct intel_execution_engine2 *e)*/ fd[1 ] =open_pmu (config); - spin =igt_spin_batch_new (gem_fd,0 ,e2ring (gem_fd, e),0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =e2ring (gem_fd, e)});igt_spin_batch_set_timeout (spin,2 * batch_duration_ns); slept =measured_usleep (batch_duration_ns /1000 );
@@ -752,7 +757,8 @@ static void cpu_hotplug(int gem_fd) fd =perf_i915_open (I915_PMU_ENGINE_BUSY (I915_ENGINE_CLASS_RENDER ,0 ));igt_assert (fd >=0 ); - spin =igt_spin_batch_new (gem_fd,0 ,I915_EXEC_RENDER ,0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =I915_EXEC_RENDER });igt_nsec_elapsed (&start);
@@ -865,7 +871,7 @@ test_interrupts(int gem_fd)gem_quiescent_gpu (gem_fd); fd =open_pmu (I915_PMU_INTERRUPTS ); - spin =igt_spin_batch_new (gem_fd,0 ,0 ,0 ); + spin =igt_spin_batch_new (gem_fd, (igt_spin_opt_t ){/* All 0s */ }); obj.handle =gem_create (gem_fd, sz);gem_write (gem_fd, obj.handle, sz -sizeof (bbe), &bbe,sizeof (bbe));
@@ -947,7 +953,8 @@ test_frequency(int gem_fd)pmu_read_multi (fd,2 , start); - spin =igt_spin_batch_new (gem_fd,0 ,I915_EXEC_RENDER ,0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =I915_EXEC_RENDER });igt_spin_batch_set_timeout (spin, duration_ns);gem_sync (gem_fd, spin->handle);
@@ -972,7 +979,8 @@ test_frequency(int gem_fd)pmu_read_multi (fd,2 , start); - spin =igt_spin_batch_new (gem_fd,0 ,I915_EXEC_RENDER ,0 ); + spin =igt_spin_batch_new (gem_fd, + (igt_spin_opt_t ){.engine =I915_EXEC_RENDER });igt_spin_batch_set_timeout (spin, duration_ns);gem_sync (gem_fd, spin->handle);
tests/pm_rps.c +1 -1
@@ -588,7 +588,7 @@ static void boost_freq(int fd, int *boost_freqs) engine =I915_EXEC_RENDER ;if (intel_gen (lh.devid) >=6 ) engine =I915_EXEC_BLT ; - load =igt_spin_batch_new (fd,0 , engine,0 ); + load =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine});/* Waiting will grant us a boost to maximum */ gem_wait (fd, load->handle, &timeout);
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 igt_hang_ctx: Wrap hang_ctx parameters into struct
Cleanup the interface to create a hang on a context by folding its parameters into a struct.
--- lib/igt_dummyload.c | 25 ++++++++++++------------- lib/igt_gt.c | 41 +++++++++++++++++++---------------------- lib/igt_gt.h | 14 +++++++++----- tests/drv_hangman.c | 5 ++++- tests/gem_reset_stats.c | 7 +++++-- tests/gem_softpin.c | 2 +- 6 files changed, 50 insertions(+), 44 deletions(-)
lib/igt_dummyload.c +12 -13
@@ -70,8 +70,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc, }static void emit_recursive_batch (igt_spin_t *spin, -int fd,uint32_t ctx,unsigned engine, -uint32_t dep) +int fd,igt_spin_opt_t opts) {#define SCRATCH 0#define BATCH 1
@@ -85,13 +84,13 @@ static void emit_recursive_batch(igt_spin_t *spin,int i; nengine =0 ; -if (engine ==-1 ) { -for_each_engine (fd, engine) -if (engine) - engines[nengine++] = engine; +if (opts.engine ==-1 ) { +for_each_engine (fd, opts.engine) +if (opts.engine) + engines[nengine++] = opts.engine; }else { -gem_require_ring (fd, engine); - engines[nengine++] = engine; +gem_require_ring (fd, opts.engine); + engines[nengine++] = opts.engine; }igt_require (nengine);
@@ -109,11 +108,11 @@ static void emit_recursive_batch(igt_spin_t *spin, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); execbuf.buffer_count++; -if (dep) { +if (opts.dep) {/* dummy write to dependency */ - obj[SCRATCH ].handle = dep; + obj[SCRATCH ].handle = opts.dep;fill_reloc (&relocs[obj[BATCH ].relocation_count++], - dep,1020 , + opts.dep,1020 ,I915_GEM_DOMAIN_RENDER ,I915_GEM_DOMAIN_RENDER ); execbuf.buffer_count++;
@@ -162,7 +161,7 @@ static void emit_recursive_batch(igt_spin_t *spin, obj[BATCH ].relocs_ptr =to_user_pointer (relocs); execbuf.buffers_ptr =to_user_pointer (obj + (2 - execbuf.buffer_count)); - execbuf.rsvd1 = ctx; + execbuf.rsvd1 = opts.ctx;for (i =0 ; i < nengine; i++) { execbuf.flags &= ~ENGINE_MASK ;
@@ -179,7 +178,7 @@ __igt_spin_batch_new(int fd, igt_spin_opt_t opts) spin =calloc (1 ,sizeof (struct igt_spin ));igt_assert (spin); -emit_recursive_batch (spin, fd, opts.ctx, opts.engine, opts.dep); +emit_recursive_batch (spin, fd, opts);igt_assert (gem_bo_busy (fd, spin->handle));igt_list_add (&spin->link, &spin_list);
lib/igt_gt.c +19 -22
86 lines not on this page · raw message
lib/igt_gt.h +9 -5
@@ -36,16 +36,20 @@ typedef struct igt_hang {unsigned flags; } igt_hang_t; +typedef struct igt_hang_opt { +uint32_t ctx; +int ring; +unsigned flags; +uint64_t *offset; +}igt_hang_opt_t ; +igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags);void igt_disallow_hang (int fd,igt_hang_t arg);#define HANG_POISON 0xc5c5c5c5 -igt_hang_t igt_hang_ctx (int fd, -uint32_t ctx, -int ring, -unsigned flags, -uint64_t *offset); +igt_hang_t igt_hang_ctx (int fd,igt_hang_opt_t opts); +#define HANG_ALLOW_BAN 1#define HANG_ALLOW_CAPTURE 2
tests/drv_hangman.c +4 -1
@@ -187,7 +187,10 @@ static void test_error_state_capture(unsigned ring_id,clear_error_state (); - hang =igt_hang_ctx (device,0 , ring_id,HANG_ALLOW_CAPTURE , &offset); + hang =igt_hang_ctx (device, (igt_hang_opt_t ){ + .ring = ring_id, + .flags =HANG_ALLOW_CAPTURE , + .offset = &offset}); batch =gem_mmap__cpu (device, hang.handle,0 ,4096 ,PROT_READ );gem_set_domain (device, hang.handle,I915_GEM_DOMAIN_CPU ,0 );igt_post_hang_ring (device, hang);
tests/gem_reset_stats.c +5 -2
@@ -161,7 +161,10 @@ static void inject_hang(int fd, uint32_t ctx,clock_gettime (CLOCK_MONOTONIC , &ts_injected); - hang =igt_hang_ctx (fd, ctx, e->exec_id | e->flags, flags &BAN ,NULL ); + hang =igt_hang_ctx (fd, (igt_hang_opt_t ){ + .ctx = ctx, + .ring = e->exec_id | e->flags, + .flags = flags &BAN });if ((flags &ASYNC ) ==0 )igt_post_hang_ring (fd, hang); }
@@ -543,7 +546,7 @@ static void test_close_pending_fork(const struct intel_execution_engine *e,assert_reset_status (fd, fd,0 ,RS_NO_ERROR ); - hang =igt_hang_ctx (fd,0 , e->exec_id | e->flags,0 ,NULL ); + hang =igt_hang_ctx (fd, (igt_hang_opt_t ){.ring = e->exec_id | e->flags});sleep (1 );/* Avoid helpers as we need to kill the child
tests/gem_softpin.c +1 -1
@@ -359,7 +359,7 @@ static void test_evict_hang(int fd) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; - hang =igt_hang_ctx (fd,0 ,0 ,0 , (uint64_t *)&expected); + hang =igt_hang_ctx (fd, (igt_hang_opt_t ){.offset = (uint64_t *)&expected}); object.offset = expected; object.flags =EXEC_OBJECT_PINNED ;
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 lib/igt_hang_ctx: Use recursive batch to hang ctx.
In reply to Antonio ArgenzianoTo hang a context we were effectively reimplementing a spinning batch and never stopping it. This patch reuses the recursive batch from igt_dummyload to hang a context.
--- lib/igt_dummyload.c | 4 +++- lib/igt_dummyload.h | 2 ++ lib/igt_gt.c | 40 ++++++---------------------------------- lib/igt_gt.h | 1 + 4 files changed, 12 insertions(+), 35 deletions(-)
lib/igt_dummyload.c +3 -1
@@ -69,7 +69,7 @@ fill_reloc(struct drm_i915_gem_relocation_entry *reloc, reloc->write_domain = write_domains; } -static void emit_recursive_batch (igt_spin_t *spin, +void emit_recursive_batch (igt_spin_t *spin,int fd,igt_spin_opt_t opts) {#define SCRATCH 0
@@ -168,6 +168,8 @@ static void emit_recursive_batch(igt_spin_t *spin, execbuf.flags = engines[i];gem_execbuf (fd, &execbuf); } + + spin->spinning_offset = obj->offset; } igt_spin_t *
lib/igt_dummyload.h +2 -0
@@ -35,6 +35,7 @@ typedef struct igt_spin {timer_t timer;struct igt_list link;uint32_t *batch; +uint64_t spinning_offset; } igt_spin_t; typedef struct igt_spin_opt {
@@ -43,6 +44,7 @@ typedef struct igt_spin_opt {uint32_t dep; } igt_spin_opt_t; +void emit_recursive_batch (igt_spin_t *spin,int fd,igt_spin_opt_t opts);igt_spin_t *__igt_spin_batch_new (int fd,igt_spin_opt_t opts);igt_spin_t *igt_spin_batch_new (int fd,igt_spin_opt_t opts);void igt_spin_batch_set_timeout (igt_spin_t *spin,int64_t ns);
lib/igt_gt.c +6 -34
@@ -266,13 +266,9 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx)*/ igt_hang_t igt_hang_ctx (int fd,igt_hang_opt_t opts) { -struct drm_i915_gem_relocation_entry reloc; -struct drm_i915_gem_execbuffer2 execbuf; -struct drm_i915_gem_exec_object2 exec;struct drm_i915_gem_context_param param; -uint32_t b[16 ];unsigned ban; -unsigned len; +igt_spin_t spin;igt_require_hang_ring (fd, opts.ring);
@@ -297,38 +293,14 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)if ((opts.flags &HANG_ALLOW_BAN ) ==0 )context_set_ban (fd, opts.ctx,0 ); -memset (&reloc,0 ,sizeof (reloc)); -memset (&exec,0 ,sizeof (exec)); -memset (&execbuf,0 ,sizeof (execbuf)); - - exec.handle =gem_create (fd,4096 ); - exec.relocation_count =1 ; - exec.relocs_ptr =to_user_pointer (&reloc); - -memset (b,0xc5 ,sizeof (b)); - - len =2 ; -if (intel_gen (intel_get_drm_devid (fd)) >=8 ) - len++; - b[0 ] =MI_BATCH_BUFFER_START | (len -2 ); - b[len] =MI_BATCH_BUFFER_END ; - b[len+1 ] =MI_NOOP ; -gem_write (fd, exec.handle,0 , b,sizeof (b)); - - reloc.offset =sizeof (uint32_t ); - reloc.target_handle = exec.handle; - reloc.read_domains =I915_GEM_DOMAIN_COMMAND ; - - execbuf.buffers_ptr =to_user_pointer (&exec); - execbuf.buffer_count =1 ; - execbuf.flags = opts.ring; -i915_execbuffer2_set_context_id (execbuf, opts.ctx); -gem_execbuf (fd, &execbuf); +emit_recursive_batch (&spin, fd, (igt_spin_opt_t ){ + .ctx = opts.ctx, + .engine = opts.ring});if (opts.offset) - *opts.offset = exec.offset; + *opts.offset = spin.spinning_offset; -return (igt_hang_t ){ exec.handle, opts.ctx, ban, opts.flags }; +return (igt_hang_t ){ spin.handle, opts.ctx, ban, opts.flags }; }/**
lib/igt_gt.h +1 -0
@@ -26,6 +26,7 @@#include "igt_debugfs.h" #include "igt_core.h" +#include "igt_dummyload.h" void igt_require_hang_ring (int fd,int ring);
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 igt_dummyload: Add preemptible parameter to recursive batch
In reply to Antonio ArgenzianoThis patch adds a parameter that allows to make the spinning batch pre-emptible by conditionally adding an arbitration point to the spinning loop.
From RFC:
- Implicitly initialize struct members to zero. (Chris)
--- lib/igt_dummyload.c | 6 +++--- lib/igt_dummyload.h | 3 ++- lib/igt_gt.c | 5 +++-- tests/drv_missed_irq.c | 2 +- tests/gem_busy.c | 18 ++++++++++++------ tests/gem_exec_fence.c | 20 +++++++++++++------- tests/gem_exec_latency.c | 3 ++- tests/gem_exec_nop.c | 3 ++- tests/gem_exec_reloc.c | 10 +++++++--- tests/gem_exec_schedule.c | 12 ++++++++---- tests/gem_exec_suspend.c | 4 +++- tests/gem_shrink.c | 7 +++++-- tests/gem_spin_batch.c | 3 ++- tests/gem_wait.c | 3 ++- tests/kms_busy.c | 12 ++++++++---- tests/kms_cursor_legacy.c | 7 +++++-- tests/perf_pmu.c | 46 ++++++++++++++++++++++++++++------------------ tests/pm_rps.c | 5 ++++- 18 files changed, 110 insertions(+), 59 deletions(-)
lib/igt_dummyload.c +3 -3
@@ -121,8 +121,8 @@ void emit_recursive_batch(igt_spin_t *spin, spin->batch = batch; spin->handle = obj[BATCH ].handle; -/* Allow ourselves to be preempted */ - *batch++ =MI_ARB_CHK ; +if (opts.preemptible) + *batch++ =MI_ARB_CHK ;/* Allow ourselves to be preempted */ /* Pad with a few nops so that we do not completely hog the system. *
@@ -169,7 +169,7 @@ void emit_recursive_batch(igt_spin_t *spin,gem_execbuf (fd, &execbuf); } - spin->spinning_offset = obj->offset; + spin->gtt_offset = obj[BATCH ].offset; } igt_spin_t *
lib/igt_dummyload.h +2 -1
@@ -35,13 +35,14 @@ typedef struct igt_spin {timer_t timer;struct igt_list link;uint32_t *batch; -uint64_t spinning_offset; +uint64_t gtt_offset; } igt_spin_t;typedef struct igt_spin_opt {uint32_t ctx;unsigned engine;uint32_t dep; +bool preemptible; }igt_spin_opt_t ;void emit_recursive_batch (igt_spin_t *spin,int fd,igt_spin_opt_t opts);
lib/igt_gt.c +3 -2
@@ -295,10 +295,11 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)emit_recursive_batch (&spin, fd, (igt_spin_opt_t ){ .ctx = opts.ctx, - .engine = opts.ring}); + .engine = opts.ring, + .preemptible = false});if (opts.offset) - *opts.offset = spin.spinning_offset; + *opts.offset = spin.gtt_offset;return (igt_hang_t ){ spin.handle, opts.ctx, ban, opts.flags }; }
tests/drv_missed_irq.c +1 -1
@@ -34,7 +34,7 @@ IGT_TEST_DESCRIPTION("Inject missed interrupts and make sure they are caught");static void trigger_missed_interrupt (int fd,unsigned ring) {igt_spin_t *spin =__igt_spin_batch_new (fd, - (igt_spin_opt_t ){.engine = ring}); + (igt_spin_opt_t ){.engine = ring, .preemptible = true}); igt_fork(child, 1) {/* We are now a low priority child on the *same* CPU as the
tests/gem_busy.c +12 -6
@@ -115,7 +115,8 @@ static void semaphore(int fd, unsigned ring, uint32_t flags) handle[BUSY ] =gem_create (fd,4096 ); spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .engine = ring, - .dep = handle[BUSY ]}); + .dep = handle[BUSY ], + .preemptible = true});/* Queue a batch after the busy, it should block and remain "busy" */ igt_assert (exec_noop (fd, handle, ring | flags, false));
@@ -462,7 +463,8 @@ static void close_race(int fd)for (i =0 ; i < nhandles; i++) { spin[i] =igt_spin_batch_new (fd, (igt_spin_opt_t ){ - .engine =engines[rand () % nengine]}); + .engine =engines[rand () % nengine], + .preemptible = true}); handles[i] = spin[i]->handle; }
@@ -470,7 +472,8 @@ static void close_race(int fd)for (i =0 ; i < nhandles; i++) {igt_spin_batch_free (fd, spin[i]); spin[i] =igt_spin_batch_new (fd, (igt_spin_opt_t ){ - .engine = engines[rand () % nengine]}); + .engine = engines[rand () % nengine], + .preemptible = true}); handles[i] = spin[i]->handle;__sync_synchronize (); }
@@ -512,8 +515,9 @@ static bool has_semaphores(int fd)static bool has_extended_busy_ioctl (int fd) { -igt_spin_t *spin =igt_spin_batch_new (fd, - (igt_spin_opt_t ){.engine =I915_EXEC_RENDER }); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine =I915_EXEC_RENDER , + .preemptible = true});uint32_t read, write;__gem_busy (fd, spin->handle, &read, &write);
@@ -524,7 +528,9 @@ static bool has_extended_busy_ioctl(int fd)static void basic (int fd,unsigned ring,unsigned flags) { -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = ring}); +igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = ring, + .preemptible = true});struct timespec tv;int timeout;bool busy;
tests/gem_exec_fence.c +13 -7
@@ -440,7 +440,8 @@ static void test_parallel(int fd, unsigned int master)*/ spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .engine = master, - .dep = c.handle}); + .dep = c.handle, + .preemptible = true});resubmit (fd, spin->handle, master,16 );/* Now queue the master request and its secondaries */
@@ -963,7 +964,8 @@ static void test_syncobj_unused_fence(int fd)struct local_gem_exec_fence fence = { .handle =syncobj_create (fd), }; -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.preemptible = true});/* sanity check our syncobj_to_sync_file interface */ igt_assert_eq (__syncobj_to_sync_file (fd,0 ), -ENOENT );
@@ -1055,7 +1057,8 @@ static void test_syncobj_signal(int fd)struct local_gem_exec_fence fence = { .handle =syncobj_create (fd), }; -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.preemptible = true});/* Check that the syncobj is signaled only when our request/fence is */
@@ -1105,7 +1108,7 @@ static void test_syncobj_wait(int fd)gem_quiescent_gpu (fd); - spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.preemptible = true});memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&obj);
@@ -1175,7 +1178,8 @@ static void test_syncobj_export(int fd) .handle = syncobj_create(fd), };int export[2 ]; -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.preemptible = true});/* Check that if we export the syncobj prior to use it picks up * the later fence. This allows a syncobj to establish a channel
@@ -1233,7 +1237,8 @@ static void test_syncobj_repeat(int fd)struct drm_i915_gem_execbuffer2 execbuf;struct local_gem_exec_fence *fence;int export; -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.preemptible = true});/* Check that we can wait on the same fence multiple times */ fence =calloc (nfences,sizeof (*fence));
@@ -1288,7 +1293,8 @@ static void test_syncobj_import(int fd)const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_exec_object2 obj;struct drm_i915_gem_execbuffer2 execbuf; -igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){/* All 0s */ }); +igt_spin_t *spin =igt_spin_batch_new (fd, + (igt_spin_opt_t ){.preemptible = true});uint32_t sync =syncobj_create (fd);int fence;
tests/gem_exec_latency.c +2 -1
@@ -346,7 +346,8 @@ static void latency_from_ring(int fd,if (flags &PREEMPT ) spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx[0 ], - .engine = ring}); + .engine = ring, + .preemptible = true});if (flags &CORK ) {plug (fd, &c);
tests/gem_exec_nop.c +2 -1
@@ -622,7 +622,8 @@ static void preempt(int fd, uint32_t handle,igt_spin_t *spin =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx[0 ], - .engine = ring_id}); + .engine = ring_id, + .preemptible = true});for (int loop =0 ; loop <1024 ; loop++)gem_execbuf (fd, &execbuf);
tests/gem_exec_reloc.c +7 -3
@@ -390,7 +390,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)if (flags &ACTIVE ) { spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .engine =I915_EXEC_DEFAULT , - .dep = obj.handle}); + .dep = obj.handle, + .preemptible = true});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj.handle));
@@ -458,7 +459,8 @@ static void basic_reloc(int fd, unsigned before, unsigned after, unsigned flags)if (flags &ACTIVE ) { spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .engine =I915_EXEC_DEFAULT , - .dep = obj.handle}); + .dep = obj.handle, + .preemptible = true});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj.handle));
@@ -585,7 +587,9 @@ static void basic_range(int fd, unsigned flags) execbuf.buffer_count = n +1 ;if (flags &ACTIVE ) { - spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.dep = obj[n].handle}); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .dep = obj[n].handle, + .preemptible = true});if (!(flags &HANG ))igt_spin_batch_set_timeout (spin,NSEC_PER_SEC /100 );igt_assert (gem_bo_busy (fd, obj[n].handle));
tests/gem_exec_schedule.c +8 -4
@@ -149,7 +149,8 @@ static void unplug_show_queue(int fd, struct cork *c, unsigned int engine)uint32_t ctx =create_highest_priority (fd); spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx, - .engine = engine}); + .engine = engine, + .preemptible = true});gem_context_destroy (fd, ctx); }
@@ -380,7 +381,8 @@ static void preempt(int fd, unsigned ring, unsigned flags) } spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx[LO ], - .engine = ring}); + .engine = ring, + .preemptible = true});igt_debug ("spin[%d].handle=%d\n" , n, spin[n]->handle);store_dword (fd, ctx[HI ], ring, result,0 , n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
@@ -431,7 +433,8 @@ static void preempt_other(int fd, unsigned ring)for_each_engine (fd, other) { spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx[NOISE ], - .engine = other}); + .engine = other, + .preemptible = true});store_dword (fd, ctx[LO ], other, result, (n +1 )*sizeof (uint32_t ), n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
@@ -486,7 +489,8 @@ static void preempt_self(int fd, unsigned ring)for_each_engine (fd, other) { spin[n] =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ .ctx = ctx[NOISE ], - .engine = other}); + .engine = other, + .preemptible = true});store_dword (fd, ctx[HI ], other, result, (n +1 )*sizeof (uint32_t ), n +1 ,0 ,I915_GEM_DOMAIN_RENDER );
tests/gem_exec_suspend.c +3 -1
@@ -201,7 +201,9 @@ static void run_test(int fd, unsigned engine, unsigned flags) }if (flags &HANG ) - spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine}); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine, + .preemptible = true});switch (mode (flags)) {case NOSLEEP :
tests/gem_shrink.c +5 -2
@@ -311,10 +311,13 @@ static void reclaim(unsigned engine, int timeout) }while (!*shared); } - spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine}); + spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine, + .preemptible = true});igt_until_timeout (timeout) {igt_spin_t *next =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ - .engine = engine}); + .engine = engine, + .preemptible = true});igt_spin_batch_set_timeout (spin, timeout_100ms);gem_sync (fd, spin->handle);
tests/gem_spin_batch.c +2 -1
@@ -44,7 +44,8 @@ static void spin(int fd, unsigned int engine, unsigned int timeout_sec) spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine});while ((elapsed =igt_nsec_elapsed (&tv)) >>30 < timeout_sec) {igt_spin_t *next =__igt_spin_batch_new (fd, (igt_spin_opt_t ){ - .engine = engine}); + .engine = engine, + .preemptible = true});igt_spin_batch_set_timeout (spin, timeout_100ms -igt_nsec_elapsed (&itv));
tests/gem_wait.c +2 -1
@@ -112,7 +112,8 @@ static void basic(int fd, unsigned engine, unsigned flags)struct cork cork =plug (fd, flags);igt_spin_t *spin =igt_spin_batch_new (fd, (igt_spin_opt_t ){ .engine = engine, - .dep = cork.handle}); + .dep = cork.handle, + .preemptible = true});struct drm_i915_gem_wait wait = { flags &WRITE ? cork.handle : spin->handle };
tests/kms_busy.c +8 -4
@@ -91,8 +91,10 @@ static void flip_to_fb(igt_display_t *dpy, int pipe,struct timespec tv = {1 ,0 };struct drm_event_vblank ev; -igt_spin_t *t =igt_spin_batch_new (dpy->drm_fd, - (igt_spin_opt_t ){.engine = ring, .dep = fb->gem_handle}); +igt_spin_t *t =igt_spin_batch_new (dpy->drm_fd, (igt_spin_opt_t ){ + .engine = ring, + .dep = fb->gem_handle, + .preemptible = true});if (modeset) {/*
@@ -210,7 +212,8 @@ static void test_atomic_commit_hang(igt_display_t *dpy, igt_plane_t *primary,igt_spin_t *t =igt_spin_batch_new (dpy->drm_fd, (igt_spin_opt_t ){ .engine = ring, - .dep = busy_fb->gem_handle}); + .dep = busy_fb->gem_handle, + .preemptible = true});struct pollfd pfd = { .fd = dpy->drm_fd, .events =POLLIN };unsigned flags =0 ;struct drm_event_vblank ev;
@@ -299,7 +302,8 @@ static void test_pageflip_modeset_hang(igt_display_t *dpy, t =igt_spin_batch_new (dpy->drm_fd, (igt_spin_opt_t ){ .engine = ring, - .dep = fb.gem_handle}); + .dep = fb.gem_handle, + .preemptible = true});do_or_die (drmModePageFlip (dpy->drm_fd, dpy->pipes[pipe].crtc_id, fb.fb_id,DRM_MODE_PAGE_FLIP_EVENT , &fb));
tests/kms_cursor_legacy.c +5 -2
@@ -533,7 +533,9 @@ static void basic_flip_cursor(igt_display_t *display, spin =NULL ;if (flags &BASIC_BUSY ) spin =igt_spin_batch_new (display->drm_fd, - (igt_spin_opt_t ){.dep = fb_info.gem_handle}); + (igt_spin_opt_t ){ + .dep = fb_info.gem_handle, + .preemptible = true});/* Start with a synchronous query to align with the vblank */ vblank_start =get_vblank (display->drm_fd, pipe,DRM_VBLANK_NEXTONMISS );
@@ -1300,7 +1302,8 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)static const int max_crcs =8 ; spin =igt_spin_batch_new (display->drm_fd, (igt_spin_opt_t ){ - .dep = fb_info[1 ].gem_handle}); + .dep = fb_info[1 ].gem_handle, + .preemptible = true}); vblank_start =get_vblank (display->drm_fd, pipe,DRM_VBLANK_NEXTONMISS );
tests/perf_pmu.c +28 -18
106 lines not on this page · raw message
tests/pm_rps.c +4 -1
@@ -588,7 +588,10 @@ static void boost_freq(int fd, int *boost_freqs) engine =I915_EXEC_RENDER ;if (intel_gen (lh.devid) >=6 ) engine =I915_EXEC_BLT ; - load =igt_spin_batch_new (fd, (igt_spin_opt_t ){.engine = engine}); + load =igt_spin_batch_new (fd, (igt_spin_opt_t ){ + .engine = engine, + .preemptible = true}); +/* Waiting will grant us a boost to maximum */ gem_wait (fd, load->handle, &timeout);
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 igt_hang_ctx: Add preemptible parameter
In reply to Antonio ArgenzianoThis patch adds a parameter to make the hanging context conditionally pre-emptible.
--- lib/igt_gt.c | 2 +- lib/igt_gt.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
lib/igt_gt.c +1 -1
@@ -296,7 +296,7 @@ igt_hang_t igt_hang_ctx(int fd, igt_hang_opt_t opts)emit_recursive_batch (&spin, fd, (igt_spin_opt_t ){ .ctx = opts.ctx, .engine = opts.ring, - .preemptible = false}); + .preemptible = opts.preemptible});if (opts.offset) *opts.offset = spin.gtt_offset;
lib/igt_gt.h +1 -0
@@ -42,6 +42,7 @@ typedef struct igt_hang_opt {int ring;unsigned flags;uint64_t *offset; +bool preemptible; } igt_hang_opt_t;igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags);
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/5] igt_dummyload: Wrap function parameters into struct
In reply to Antonio Argenziano== Series Details ==
== Series Details ==
Series: series starting with [1/5] igt_dummyload: Wrap function parameters into struct
URL : https://patchwork.freedesktop.org/series/35059/
State : success
== Summary ==
IGT patchset tested on top of latest successful build 2fc64acf8a4465d5eab3d6cfec9b3c1b5df30d73 igt/perf_pmu: Tweak wait_for_rc6, yet again
with latest DRM-Tip kernel build CI_DRM_3476fb6aa7cd0d6b drm-tip: 2017y-12m-07d-17h-43m-29s UTC integration manifest
No testlist changes.
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:446s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:390s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:524s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:283s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:508s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:515s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:501s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:488s fi-elk-e7500 total:224 pass:163 dwarn:14 dfail:1 fail:0 skip:45 fi-gdg-551 total:288 pass:178 dwarn:1 dfail:0 fail:1 skip:108 time:271s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:546s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:402s fi-hsw-4770r total:288 pass:224 dwarn:0 dfail:0 fail:0 skip:64 time:266s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:405s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:489s fi-ivb-3770 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:453s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:496s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:529s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:488s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:536s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:599s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:460s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:544s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:574s fi-skl-6700k total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:528s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:510s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:453s fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:425s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:629s fi-cnl-y total:232 pass:207 dwarn:0 dfail:0 fail:0 skip:24 fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:499s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_619/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/5] igt_dummyload: Wrap function parameters into struct
In reply to Antonio Argenziano== Series Details ==
== Series Details ==
Series: series starting with [1/5] igt_dummyload: Wrap function parameters into struct
URL : https://patchwork.freedesktop.org/series/35059/
State : success
== Summary ==
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
fail -> PASS (shard-snb) fdo#101623
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-b:
incomplete -> PASS (shard-hsw)
Test gem_tiled_swapping:
Subgroup non-threaded:
pass -> INCOMPLETE (shard-hsw) fdo#104009
Test perf:
Subgroup polling:
pass -> FAIL (shard-hsw) fdo#102252
Test kms_flip:
Subgroup flip-vs-panning:
incomplete -> PASS (shard-hsw)fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#104009 https://bugs.freedesktop.org/show_bug.cgi?id=104009
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2547 pass:1469 dwarn:1 dfail:0 fail:9 skip:1067 time:9417s shard-snb total:2679 pass:1308 dwarn:1 dfail:0 fail:12 skip:1358 time:8337s
Blacklisted hosts:
shard-kbl total:2604 pass:1743 dwarn:2 dfail:0 fail:23 skip:836 time:10722s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_619/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx