tests/gem_reset_stats: Change pending/active assertions
PATCH 1/3 tests/gem_reset_stats: Change pending/active assertions
Now that we replay the non guilty contexts and always replay the default ctx, even when guilty, the assumptions of how many active and pending batches there was in the time of reset has changed.
Driver doesn't increment pending counts for contexts that it considered unaffected by reset. Because it can now replay the queued requests.
For contexts, guilty of reset, we replay the request envelopes, but nop the batchbuffer starts. This changes of how many 'hangs' we think there were queued. As future queued hangs are now NOPed out, we need to change the assumption of active counts also.
Adapt to these changes of how the replaying of batches affect the assertions in pending/active counting and banning tests. While doing this, throw out the retrying to be more strict about the determinism we want to achieve.
--- tests/gem_reset_stats.c | 154 ++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 98 deletions(-)
tests/gem_reset_stats.c +56 -98
@@ -152,7 +152,7 @@ static struct timespec ts_injected;#define BAN HANG_ALLOW_BAN#define ASYNC 2 -static void inject_hang (int fd,uint32_t ctx, +static bool inject_hang (int fd,uint32_t ctx,const struct intel_execution_engine *e,unsigned flags) {
@@ -163,6 +163,8 @@ static void inject_hang(int fd, uint32_t ctx, hang =igt_hang_ctx (fd, ctx, e->exec_id | e->flags, flags &BAN ,NULL );if ((flags &ASYNC ) ==0 )igt_post_hang_ring (fd, hang); + +return hang.handle >=0 ; }static const char *status_to_string (int x)
@@ -239,7 +241,7 @@ static void test_rs(const struct intel_execution_engine *e,if (i == hang_index)assert_reset_status (i, fd[i],0 ,RS_BATCH_ACTIVE );if (i > hang_index) -assert_reset_status (i, fd[i],0 ,RS_BATCH_PENDING ); +assert_reset_status (i, fd[i],0 ,RS_NO_ERROR ); }igt_assert (igt_seconds_elapsed (&ts_injected) <=30 );
@@ -312,10 +314,10 @@ static void test_rs_ctx(const struct intel_execution_engine *e, RS_BATCH_ACTIVE);if (i == hang_index && j > hang_context)assert_reset_status (i, fd[i], ctx[i][j], -RS_BATCH_PENDING ); +RS_NO_ERROR );if (i > hang_index)assert_reset_status (i, fd[i], ctx[i][j], -RS_BATCH_PENDING ); +RS_NO_ERROR ); } }
@@ -325,128 +327,84 @@ static void test_rs_ctx(const struct intel_execution_engine *e, } } -static void test_ban (const struct intel_execution_engine *e) +static void test_ban_ctx (const struct intel_execution_engine *e, +const bool ban_default) {struct local_drm_i915_reset_stats rs_bad, rs_good; -int fd_bad, fd_good; -int ban, retry =10 ; +int fd_bad, fd_good, i; +uint32_t ctx_good, ctx_bad;int active_count =0 , pending_count =0 ; fd_bad =drm_open_driver (DRIVER_INTEL ); fd_good =drm_open_driver (DRIVER_INTEL ); -assert_reset_status (fd_bad, fd_bad,0 ,RS_NO_ERROR ); + ctx_good =gem_context_create (fd_bad); +if (!ban_default) + ctx_bad =gem_context_create (fd_bad); +else + ctx_bad =0 ; + +assert_reset_status (fd_bad, fd_bad, ctx_bad,RS_NO_ERROR ); +assert_reset_status (fd_bad, fd_bad, ctx_good,RS_NO_ERROR );assert_reset_status (fd_good, fd_good,0 ,RS_NO_ERROR ); -noop (fd_bad,0 , e); -noop (fd_good,0 , e); +igt_assert_lt (0 ,noop (fd_bad, ctx_bad, e)); +igt_assert_lt (0 ,noop (fd_bad, ctx_good, e)); +igt_assert_lt (0 ,noop (fd_good,0 , e)); -assert_reset_status (fd_bad, fd_bad,0 ,RS_NO_ERROR ); +assert_reset_status (fd_bad, fd_bad, ctx_bad,RS_NO_ERROR ); +assert_reset_status (fd_bad, fd_bad, ctx_good,RS_NO_ERROR );assert_reset_status (fd_good, fd_good,0 ,RS_NO_ERROR ); -inject_hang (fd_bad,0 , e,BAN |ASYNC ); - active_count++; +inject_hang (fd_bad, ctx_bad, e,BAN |ASYNC ); +/* The next synced ban below ban will get nopped if default ctx */ +if (!ctx_bad) + active_count++; -noop (fd_good,0 , e); -noop (fd_good,0 , e); +igt_assert_lt (0 ,noop (fd_good,0 , e)); +/* We don't skip requests for default ctx, so no +* pending change as they will be replayed */ +igt_assert_lt (0 ,noop (fd_bad,0 , e)); +igt_assert_lt (0 ,noop (fd_bad, ctx_good, e)); -/* The second hang will count as pending and be discarded */ - active_count--; - pending_count +=1 ;/* inject hang does 1 real exec + 1 dummy */ -while (retry--) { -inject_hang (fd_bad,0 , e,BAN ); - active_count++; + i =0 ; +do { +/* Check if we are already kicked out */ +if (noop (fd_bad, ctx_bad, e) <0 ) +break ; - ban =noop (fd_bad,0 , e); -if (ban == -EIO ) +if (inject_hang (fd_bad, ctx_bad, e,BAN )) + active_count++; +else break ; -/* Should not happen often but sometimes hang is declared too -* slow due to our way of faking hang using loop */ -gem_close (fd_bad, ban); + i++; + }while (i <15 ); + +/* ctx case needs more as default one will get one nopped */ +if (ctx_bad) +igt_assert_eq (i,5 ); +else +igt_assert_eq (i,4 ); -igt_info ("retrying for ban (%d)\n" , retry); - } -igt_assert_eq (ban, -EIO );igt_assert_lt (0 ,noop (fd_good,0 , e)); +igt_assert_eq (-EIO ,noop (fd_bad, ctx_bad, e)); +igt_assert_lt (0 ,noop (fd_bad, ctx_good, e)); -assert_reset_status (fd_bad, fd_bad,0 ,RS_BATCH_ACTIVE ); -igt_assert_eq (gem_reset_stats (fd_bad,0 , &rs_bad),0 ); +assert_reset_status (fd_bad, fd_bad, ctx_bad,RS_BATCH_ACTIVE ); +igt_assert_eq (gem_reset_stats (fd_bad, ctx_bad, &rs_bad),0 );igt_assert_eq (rs_bad.batch_active, active_count);igt_assert_eq (rs_bad.batch_pending, pending_count); -assert_reset_status (fd_good, fd_good,0 ,RS_BATCH_PENDING ); +assert_reset_status (fd_good, fd_good,0 ,RS_NO_ERROR );igt_assert_eq (gem_reset_stats (fd_good,0 , &rs_good),0 );igt_assert_eq (rs_good.batch_active,0 ); -igt_assert_eq (rs_good.batch_pending,2 ); +igt_assert_eq (rs_good.batch_pending,0 );close (fd_bad);close (fd_good); } -static void test_ban_ctx (const struct intel_execution_engine *e) -{ -struct local_drm_i915_reset_stats rs_bad, rs_good; -int fd, ban, retry =10 ; -uint32_t ctx_good, ctx_bad; -int active_count =0 , pending_count =0 ; - - fd =drm_open_driver (DRIVER_INTEL ); - -assert_reset_status (fd, fd,0 ,RS_NO_ERROR ); - - ctx_good =gem_context_create (fd); - ctx_bad =gem_context_create (fd); - -assert_reset_status (fd, fd,0 ,RS_NO_ERROR ); -assert_reset_status (fd, fd, ctx_good,RS_NO_ERROR ); -assert_reset_status (fd, fd, ctx_bad,RS_NO_ERROR ); - -noop (fd, ctx_bad, e); -noop (fd, ctx_good, e); - -assert_reset_status (fd, fd, ctx_good,RS_NO_ERROR ); -assert_reset_status (fd, fd, ctx_bad,RS_NO_ERROR ); - -inject_hang (fd, ctx_bad, e,BAN |ASYNC ); - active_count++; - -noop (fd, ctx_good, e); -noop (fd, ctx_good, e); - -/* This second hang will count as pending and be discarded */ - active_count--; - pending_count++; -while (retry--) { -inject_hang (fd, ctx_bad, e,BAN ); - active_count++; - - ban =noop (fd, ctx_bad, e); -if (ban == -EIO ) -break ; - -/* Should not happen often but sometimes hang is declared too -* slow due to our way of faking hang using loop */ -gem_close (fd, ban); - -igt_info ("retrying for ban (%d)\n" , retry); - } -igt_assert_eq (ban, -EIO ); -igt_assert_lt (0 ,noop (fd, ctx_good, e)); - -assert_reset_status (fd, fd, ctx_bad,RS_BATCH_ACTIVE ); -igt_assert_eq (gem_reset_stats (fd, ctx_bad, &rs_bad),0 ); -igt_assert_eq (rs_bad.batch_active, active_count); -igt_assert_eq (rs_bad.batch_pending, pending_count); - -assert_reset_status (fd, fd, ctx_good,RS_BATCH_PENDING ); -igt_assert_eq (gem_reset_stats (fd, ctx_good, &rs_good),0 ); -igt_assert_eq (rs_good.batch_active,0 ); -igt_assert_eq (rs_good.batch_pending,2 ); - -close (fd); -} -static void test_unrelated_ctx (const struct intel_execution_engine *e) {int fd1,fd2;
@@ -812,10 +770,10 @@ igt_mainRUN_CTX_TEST (test_rs_ctx (e,4 ,4 ,1 ,2 )); igt_subtest_f("ban-%s", e->name) -RUN_TEST (test_ban (e)); +RUN_TEST (test_ban_ctx (e, true)); igt_subtest_f("ban-ctx-%s", e->name) -RUN_CTX_TEST (test_ban_ctx (e)); +RUN_CTX_TEST (test_ban_ctx (e, false)); igt_subtest_f("reset-count-%s", e->name)RUN_TEST (test_reset_count (e, false));
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 tests/gem_reset_stats: test no progress detection
If seqno is not incrementing but head is moving, we declare hang but much slower. Add test to check that this mechanism is working properly.
--- tests/gem_reset_stats.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
tests/gem_reset_stats.c +75 -0
@@ -711,6 +711,75 @@ static void defer_hangcheck(const struct intel_execution_engine *engine)close (fd); } +static void test_no_seqno_progress (const struct intel_execution_engine *engine, +const bool use_ctx) +{ +struct drm_i915_gem_relocation_entry reloc; +struct drm_i915_gem_execbuffer2 eb; +struct drm_i915_gem_exec_object2 exec; +struct local_drm_i915_reset_stats before, after; +int len =0 , ctx, fd; +uint32_t batch[16 *1024 ]; +struct timespec ts_start; + + fd =drm_open_driver (DRIVER_INTEL ); + +memset (&reloc,0 ,sizeof (reloc)); +memset (&exec,0 ,sizeof (exec)); +memset (&eb,0 ,sizeof (eb)); +memset (&batch,0 ,sizeof (batch)); + + exec.handle =gem_create (fd,sizeof (batch)); + exec.relocation_count =1 ; + exec.relocs_ptr = (uintptr_t )&reloc; + +igt_assert ((int )exec.handle >0 ); + +if (use_ctx) + ctx =gem_context_create (fd); +else + ctx =0 ; + + len =2 ; +if (intel_gen (intel_get_drm_devid (fd)) >=8 ) + len++; + + batch[sizeof (batch)/sizeof (uint32_t ) - len] =MI_BATCH_BUFFER_START | (len -2 ); +gem_write (fd, exec.handle,0 , batch,sizeof (batch)); + + reloc.offset =sizeof (batch) - ((len-1 ) *4 ); + reloc.delta =0 ; + reloc.target_handle = exec.handle; + reloc.read_domains =I915_GEM_DOMAIN_COMMAND ; + + eb.buffers_ptr = (uintptr_t )&exec; + eb.buffer_count =1 ; + eb.flags = engine->exec_id; +if (ctx) +i915_execbuffer2_set_context_id (eb, ctx); + +igt_assert_eq (gem_reset_stats (fd, ctx, &before),0 ); + +clock_gettime (CLOCK_MONOTONIC , &ts_start); + +igt_assert_eq (0 ,__gem_execbuf (fd, &eb)); +igt_assert_lte (0 ,noop (fd, ctx, engine)); +gem_sync (fd, exec.handle); + +igt_assert_lte (0 ,noop (fd, ctx, engine)); +igt_assert_eq (gem_reset_stats (fd, ctx, &after),0 ); + +sync_gpu (); + +igt_assert (after.batch_active == before.batch_active +1 ); + +gem_close (fd, exec.handle); +close (fd); + +igt_assert (igt_seconds_elapsed (&ts_start) >5 ); +igt_assert (igt_seconds_elapsed (&ts_start) <15 ); +} +static bool gem_has_reset_stats (int fd) {struct local_drm_i915_reset_stats rs;
@@ -798,5 +867,11 @@ igt_main igt_subtest_f("defer-hangcheck-%s", e->name)RUN_TEST (defer_hangcheck (e)); + + igt_subtest_f("no-progress-%s", e->name) +RUN_TEST (test_no_seqno_progress (e, false)); + + igt_subtest_f("no-progress-ctx-%s", e->name) +RUN_CTX_TEST (test_no_seqno_progress (e, true)); } }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/3] tests/gem_reset_stats: test no progress detection
Quoted 14 lines · Mika Kuoppala
If seqno is not incrementing but head is moving, we declare hang but much slower. Add test to check that this mechanism is working properly.
Signed-off-by Mika Kuoppala <[email protected]>--- tests/gem_reset_stats.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)tests/gem_reset_stats.c +0
-0
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 719
Quoted 9 lines
tests/gem_reset_stats.c +6
-0@@ -711,6 +711,75 @@ static void defer_hangcheck(const struct intel_execution_engine *engine)close (fd); } +static void test_no_seqno_progress (const struct intel_execution_engine *engine, +const bool use_ctx) +{ +struct drm_i915_gem_relocation_entry reloc; +struct drm_i915_gem_execbuffer2 eb; +struct drm_i915_gem_exec_object2 exec;
I would advise using obj instead of exec
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 722
Quoted 3 lines
tests/gem_reset_stats.c +3
-0+struct local_drm_i915_reset_stats before, after; +int len =0 , ctx, fd; +uint32_t batch[16 *1024 ];
Not needed, see later.
#define BATCH_SIZE (16 << 10)
Quoted 5 lines
tests/gem_reset_stats.c +5
-0+struct timespec ts_start; + + fd =drm_open_driver (DRIVER_INTEL ); + +memset (&reloc,0 ,sizeof (reloc));
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 736
Quoted 10 lines
tests/gem_reset_stats.c +9
-0+memset (&exec,0 ,sizeof (exec)); +memset (&eb,0 ,sizeof (eb)); +memset (&batch,0 ,sizeof (batch)); + + exec.handle =gem_create (fd,sizeof (batch)); + exec.relocation_count =1 ; + exec.relocs_ptr = (uintptr_t )&reloc; + +igt_assert ((int )exec.handle >0 );
Already asserted for you.
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 748
Quoted 12 lines
tests/gem_reset_stats.c +12
-0+ +if (use_ctx) + ctx =gem_context_create (fd); +else + ctx =0 ; + + len =2 ; +if (intel_gen (intel_get_drm_devid (fd)) >=8 ) + len++; + + batch[sizeof (batch)/sizeof (uint32_t ) - len] =MI_BATCH_BUFFER_START | (len -2 ); +gem_write (fd, exec.handle,0 , batch,sizeof (batch));
gem_write(fd, exec.handle, BATCH_SIZE - 16, &cmd, sizeof(cmd));
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 751
Quoted 2 lines
tests/gem_reset_stats.c +2
-0+ + reloc.offset =sizeof (batch) - ((len-1 ) *4 );
reloc.offset = BATCH_SIZE - 16 + sizeof(cmd);
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 759
Quoted 9 lines
tests/gem_reset_stats.c +8
-0+ reloc.delta =0 ; + reloc.target_handle = exec.handle; + reloc.read_domains =I915_GEM_DOMAIN_COMMAND ; + eb.buffers_ptr = (uintptr_t )&exec; + eb.buffer_count =1 ; + eb.flags = engine->exec_id; +if (ctx) +i915_execbuffer2_set_context_id (eb, ctx);
eb.rsvd1 = ctx; It's perfectly fine to set it to zero.
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 763
Quoted 3 lines
tests/gem_reset_stats.c +3
-0+igt_assert_eq (gem_reset_stats (fd, ctx, &before),0 ); + +clock_gettime (CLOCK_MONOTONIC , &ts_start);
struct timespec ts = {};igt_seconds_elapsed(&ts_start)
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 765
Quoted 2 lines
tests/gem_reset_stats.c +2
-0+ +igt_assert_eq (0 ,__gem_execbuf (fd, &eb));
gem_execbuf();
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 766
Quoted 1 line
tests/gem_reset_stats.c +1
-0+igt_assert_lte (0 ,noop (fd, ctx, engine));
See earlier comments about noop.
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 774
Quoted 8 lines
tests/gem_reset_stats.c +8
-0+gem_sync (fd, exec.handle); + +igt_assert_lte (0 ,noop (fd, ctx, engine)); +igt_assert_eq (gem_reset_stats (fd, ctx, &after),0 ); + +sync_gpu (); + +igt_assert (after.batch_active == before.batch_active +1 );
igt_assert_eq(after, before + 1);
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 779
Quoted 4 lines
tests/gem_reset_stats.c +4
-0+gem_close (fd, exec.handle); +close (fd); + +igt_assert (igt_seconds_elapsed (&ts_start) >5 );
You really want to demand a minimum time?
tests/gem_reset_stats.c static void defer_hangcheck(const struct intel_execution_engine *engine) · line 780
Quoted 1 line
tests/gem_reset_stats.c +1
-0+igt_assert (igt_seconds_elapsed (&ts_start) <15 );
Play state thy sources. Upper bound should be closer to 120s. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 tests/gem_reset_stats: Add test to check client bans
In reply to Mika KuoppalaClient will get banned from creating new context
if it has managed to get > 3 context banned.
--- tests/gem_reset_stats.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-)
tests/gem_reset_stats.c +42 -5
@@ -327,15 +327,15 @@ static void test_rs_ctx(const struct intel_execution_engine *e, } } -static void test_ban_ctx (const struct intel_execution_engine *e, -const bool ban_default) +static void __test_ban_ctx (int fd_bad, +const struct intel_execution_engine *e, +const bool ban_default) {struct local_drm_i915_reset_stats rs_bad, rs_good; -int fd_bad, fd_good, i; +int fd_good, i;uint32_t ctx_good, ctx_bad;int active_count =0 , pending_count =0 ; - fd_bad =drm_open_driver (DRIVER_INTEL ); fd_good =drm_open_driver (DRIVER_INTEL ); ctx_good =gem_context_create (fd_bad);
@@ -401,10 +401,44 @@ static void test_ban_ctx(const struct intel_execution_engine *e,igt_assert_eq (rs_good.batch_active,0 );igt_assert_eq (rs_good.batch_pending,0 ); -close (fd_bad);close (fd_good); } +static void test_ban_ctx (const struct intel_execution_engine *e,bool ban_default) +{ +int fd; + fd =drm_open_driver (DRIVER_INTEL ); + +__test_ban_ctx (fd, e, ban_default); + +close (fd); +} + +static void test_ban_client (const struct intel_execution_engine *e) +{ +struct drm_i915_gem_context_create create; +int fd; + fd =drm_open_driver (DRIVER_INTEL ); + +__test_ban_ctx (fd, e, false); +igt_assert_lt (0 ,noop (fd,0 , e)); + +__test_ban_ctx (fd, e, false); +igt_assert_lt (0 ,noop (fd,0 , e)); + +__test_ban_ctx (fd, e, false); +igt_assert_lt (0 ,noop (fd,0 , e)); + +__test_ban_ctx (fd, e, false); + +memset (&create,0 ,sizeof (create)); +igt_assert_eq (-1 ,igt_ioctl (fd,DRM_IOCTL_I915_GEM_CONTEXT_CREATE , &create)); +igt_assert_eq (-EIO , -errno); +igt_assert_lt (0 ,noop (fd,0 , e)); + +close (fd); +} +static void test_unrelated_ctx (const struct intel_execution_engine *e) {int fd1,fd2;
@@ -844,6 +878,9 @@ igt_main igt_subtest_f("ban-ctx-%s", e->name)RUN_CTX_TEST (test_ban_ctx (e, false)); + igt_subtest_f("ban-client-%s", e->name) +RUN_CTX_TEST (test_ban_client (e)); + igt_subtest_f("reset-count-%s", e->name)RUN_TEST (test_reset_count (e, false));
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/3] tests/gem_reset_stats: Add test to check client bans
Quoted 2 lines · Mika Kuoppala
Client will get banned from creating new context
if it has managed to get > 3 context banned.
I'm not thrilled about baking that magic number into an ABI requirement.
Just make it N bans, test timing out after say 120s of happiness (with skip)?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
How about a patch 0 to enable hang testing contexts on all rings now? Then exploration of how one ring affects another...
You will want to use busy batches to load the engines without hanging, that will be tricky...
Quoted 39 lines · Mika Kuoppala
Now that we replay the non guilty contexts and always replay the default ctx, even when guilty, the assumptions of how many active and pending batches there was in the time of reset has changed.
Driver doesn't increment pending counts for contexts that it considered unaffected by reset. Because it can now replay the queued requests.
For contexts, guilty of reset, we replay the request envelopes, but nop the batchbuffer starts. This changes of how many 'hangs' we think there were queued. As future queued hangs are now NOPed out, we need to change the assumption of active counts also.
Adapt to these changes of how the replaying of batches affect the assertions in pending/active counting and banning tests. While doing this, throw out the retrying to be more strict about the determinism we want to achieve.
Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- tests/gem_reset_stats.c | 154 ++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 98 deletions(-)tests/gem_reset_stats.c +1
-1@@ -152,7 +152,7 @@ static struct timespec ts_injected;#define BAN HANG_ALLOW_BAN#define ASYNC 2 -static void inject_hang (int fd,uint32_t ctx, +static bool inject_hang (int fd,uint32_t ctx,const struct intel_execution_engine *e,unsigned flags) {
tests/gem_reset_stats.c static void inject_hang(int fd, uint32_t ctx, · line 167
Quoted 5 lines
tests/gem_reset_stats.c +2
-0@@ -163,6 +163,8 @@ static void inject_hang(int fd, uint32_t ctx, hang =igt_hang_ctx (fd, ctx, e->exec_id | e->flags, flags &BAN ,NULL );if ((flags &ASYNC ) ==0 )igt_post_hang_ring (fd, hang); + +return hang.handle >=0 ;
Never returns false. Future patch?
Quoted 47 lines
tests/gem_reset_stats.c +12
-7static const char *status_to_string (int x)@@ -239,7 +241,7 @@ static void test_rs(const struct intel_execution_engine *e,if (i == hang_index)assert_reset_status (i, fd[i],0 ,RS_BATCH_ACTIVE );if (i > hang_index) -assert_reset_status (i, fd[i],0 ,RS_BATCH_PENDING ); +assert_reset_status (i, fd[i],0 ,RS_NO_ERROR ); }igt_assert (igt_seconds_elapsed (&ts_injected) <=30 );@@ -312,10 +314,10 @@ static void test_rs_ctx(const struct intel_execution_engine *e, RS_BATCH_ACTIVE);if (i == hang_index && j > hang_context)assert_reset_status (i, fd[i], ctx[i][j], -RS_BATCH_PENDING ); +RS_NO_ERROR );if (i > hang_index)assert_reset_status (i, fd[i], ctx[i][j], -RS_BATCH_PENDING ); +RS_NO_ERROR ); } }@@ -325,128 +327,84 @@ static void test_rs_ctx(const struct intel_execution_engine *e, } } -static void test_ban (const struct intel_execution_engine *e) +static void test_ban_ctx (const struct intel_execution_engine *e, +const bool ban_default) {struct local_drm_i915_reset_stats rs_bad, rs_good; -int fd_bad, fd_good; -int ban, retry =10 ; +int fd_bad, fd_good, i; +uint32_t ctx_good, ctx_bad;int active_count =0 , pending_count =0 ; fd_bad =drm_open_driver (DRIVER_INTEL ); fd_good =drm_open_driver (DRIVER_INTEL ); -assert_reset_status (fd_bad, fd_bad,0 ,RS_NO_ERROR ); + ctx_good =gem_context_create (fd_bad); +if (!ban_default) + ctx_bad =gem_context_create (fd_bad); +else + ctx_bad =0 ;
tests/gem_reset_stats.c static void test_rs_ctx(const struct intel_execution_engine *e, · line 353
Quoted 10 lines
tests/gem_reset_stats.c +6
-2+ +assert_reset_status (fd_bad, fd_bad, ctx_bad,RS_NO_ERROR ); +assert_reset_status (fd_bad, fd_bad, ctx_good,RS_NO_ERROR );assert_reset_status (fd_good, fd_good,0 ,RS_NO_ERROR ); -noop (fd_bad,0 , e); -noop (fd_good,0 , e); +igt_assert_lt (0 ,noop (fd_bad, ctx_bad, e)); +igt_assert_lt (0 ,noop (fd_bad, ctx_good, e)); +igt_assert_lt (0 ,noop (fd_good,0 , e));
Yuck.
__noop();noop() { igt_assert_eq(__noop, 0));
(Or better names than noop? )
Otherwise, lgtm. R-b if you feel so inclined.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx