lib: substitute cxt BAN_PERIOD with BANNABLE
PATCH 1/1 lib: substitute cxt BAN_PERIOD with BANNABLE
Context BAN_PERIOD will get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.
--- lib/igt_gt.c | 77 ++++++++++++++++++++++++++++++--------------------- lib/ioctl_wrappers.c | 16 +++++++++-- lib/ioctl_wrappers.h | 3 +- tests/gem_ctx_param.c | 9 ++++-- 4 files changed, 68 insertions(+), 37 deletions(-)
lib/igt_gt.c +46 -31
@@ -119,11 +119,43 @@ void igt_require_hang_ring(int fd, int ring)igt_skip ("hang injection disabled by user" );gem_require_ring (fd, ring); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd)); } +static unsigned igt_get_ban (int fd,unsigned ctx) +{ +struct local_i915_gem_context_param param; + + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + param.value =0 ; + param.size =0 ; + +if (__gem_context_get_param (fd, ¶m)) { +igt_assert (param.value ==0 ); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_get_param (fd, ¶m); + } + +return param.value; +} + +static void igt_set_ban (int fd,unsigned ctx,unsigned ban) +{ +struct local_i915_gem_context_param param; + + param.value = ban; + param.size =0 ; + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + +if (__gem_context_set_param (fd, ¶m)) { +igt_assert (param.value == ban); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_set_param (fd, ¶m); + } +} +igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags) {struct local_i915_gem_context_param param;
@@ -131,7 +163,7 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)if (!igt_check_boolean_env_var ("IGT_HANG" , true))igt_skip ("hang injection disabled by user" ); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd));
@@ -148,16 +180,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; - -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } + ban =igt_get_ban (fd, ctx); +if ((flags &HANG_ALLOW_BAN ) ==0 ) +igt_set_ban (fd, ctx,0 );return (struct igt_hang ){0 , ctx, ban, flags }; }
@@ -166,13 +191,11 @@ void igt_disallow_hang(int fd, igt_hang_t arg) {struct local_i915_gem_context_param param; - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +igt_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
@@ -227,16 +250,10 @@ igt_hang_t igt_hang_ctx(int fd,__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; + ban =igt_get_ban (fd, ctx); -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } +if ((flags &HANG_ALLOW_BAN ) ==0 ) +igt_set_ban (fd, ctx,0 );memset (&reloc,0 ,sizeof (reloc));memset (&exec,0 ,sizeof (exec));
@@ -323,13 +340,11 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);gem_close (fd, arg.handle); - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +igt_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
lib/ioctl_wrappers.c +14 -2
@@ -961,9 +961,21 @@ void gem_context_require_param(int fd, uint64_t param)igt_require (igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ); } -void gem_context_require_ban_period (int fd) +void gem_context_require_bannable (int fd) {static int has_ban_period =-1 ; +static int has_bannable =-1 ; + +if (has_bannable <0 ) { +struct local_i915_gem_context_param p; + + p.context =0 ; + p.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + p.value =0 ; + p.size =0 ; + + has_bannable =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; + }if (has_ban_period <0 ) {struct local_i915_gem_context_param p;
@@ -976,7 +988,7 @@ void gem_context_require_ban_period(int fd) has_ban_period =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; } -igt_require (has_ban_period); +igt_require (has_ban_period || has_bannable); }int __gem_userptr (int fd,void *ptr,int size,int read_only,uint32_t flags,uint32_t *handle)
lib/ioctl_wrappers.h +2 -1
@@ -120,9 +120,10 @@ struct local_i915_gem_context_param {#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2#define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 +#define LOCAL_CONTEXT_PARAM_BANNABLE 0x5uint64_t value; }; -void gem_context_require_ban_period (int fd); +void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param);void gem_context_get_param (int fd,struct local_i915_gem_context_param *p);void gem_context_set_param (int fd,struct local_i915_gem_context_param *p);
tests/gem_ctx_param.c +6 -3
@@ -43,6 +43,11 @@ igt_main arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +/* XXX start to enforce ban period returning -EINVAL when +* transition has been done */ +if (__gem_context_get_param (fd, &arg) == -EINVAL ) + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + igt_subtest("basic") { arg.context = ctx;gem_context_get_param (fd, &arg);
@@ -82,8 +87,6 @@ igt_main arg.size =0 ; } - arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - igt_subtest("non-root-set") { igt_fork(child, 1) {igt_drop_root ();
@@ -137,7 +140,7 @@ igt_main* to catch ABI extensions. Don't "fix" this testcase without adding all * the tests for the new param first. */ - arg.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE +1 ; + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE +1 ; igt_subtest("invalid-param-get") { arg.context = ctx;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 lib: substitute cxt BAN_PERIOD with BANNABLE
Context BAN_PERIOD will get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.
v: check against - EINVAL on get/set ban as it can return -EPERM
--- lib/igt_gt.c | 78 +++++++++++++++++++++++++++++++-------------------- lib/ioctl_wrappers.c | 16 +++++++++-- lib/ioctl_wrappers.h | 3 +- tests/gem_ctx_param.c | 9 ++++-- 4 files changed, 69 insertions(+), 37 deletions(-)
lib/igt_gt.c +47 -31
@@ -119,11 +119,44 @@ void igt_require_hang_ring(int fd, int ring)igt_skip ("hang injection disabled by user" );gem_require_ring (fd, ring); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd)); } +static unsigned igt_get_ban (int fd,unsigned ctx) +{ +struct local_i915_gem_context_param param; + + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + param.value =0 ; + param.size =0 ; + +if (__gem_context_get_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value ==0 ); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_get_param (fd, ¶m); + } + +return param.value; +} + +static void igt_set_ban (int fd,unsigned ctx,unsigned ban) +{ +struct local_i915_gem_context_param param; + + param.value = ban; + param.size =0 ; + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + +if (__gem_context_set_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value == ban); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; + +gem_context_set_param (fd, ¶m); + } +} +igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags) {struct local_i915_gem_context_param param;
@@ -131,7 +164,7 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)if (!igt_check_boolean_env_var ("IGT_HANG" , true))igt_skip ("hang injection disabled by user" ); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd));
@@ -148,16 +181,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; - -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } + ban =igt_get_ban (fd, ctx); +if ((flags &HANG_ALLOW_BAN ) ==0 ) +igt_set_ban (fd, ctx,0 );return (struct igt_hang ){0 , ctx, ban, flags }; }
@@ -166,13 +192,11 @@ void igt_disallow_hang(int fd, igt_hang_t arg) {struct local_i915_gem_context_param param; - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +igt_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
@@ -227,16 +251,10 @@ igt_hang_t igt_hang_ctx(int fd,__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; + ban =igt_get_ban (fd, ctx); -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } +if ((flags &HANG_ALLOW_BAN ) ==0 ) +igt_set_ban (fd, ctx,0 );memset (&reloc,0 ,sizeof (reloc));memset (&exec,0 ,sizeof (exec));
@@ -323,13 +341,11 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);gem_close (fd, arg.handle); - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +igt_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
lib/ioctl_wrappers.c +14 -2
@@ -961,9 +961,21 @@ void gem_context_require_param(int fd, uint64_t param)igt_require (igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ); } -void gem_context_require_ban_period (int fd) +void gem_context_require_bannable (int fd) {static int has_ban_period =-1 ; +static int has_bannable =-1 ; + +if (has_bannable <0 ) { +struct local_i915_gem_context_param p; + + p.context =0 ; + p.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + p.value =0 ; + p.size =0 ; + + has_bannable =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; + }if (has_ban_period <0 ) {struct local_i915_gem_context_param p;
@@ -976,7 +988,7 @@ void gem_context_require_ban_period(int fd) has_ban_period =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; } -igt_require (has_ban_period); +igt_require (has_ban_period || has_bannable); }int __gem_userptr (int fd,void *ptr,int size,int read_only,uint32_t flags,uint32_t *handle)
lib/ioctl_wrappers.h +2 -1
@@ -120,9 +120,10 @@ struct local_i915_gem_context_param {#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2#define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 +#define LOCAL_CONTEXT_PARAM_BANNABLE 0x5uint64_t value; }; -void gem_context_require_ban_period (int fd); +void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param);void gem_context_get_param (int fd,struct local_i915_gem_context_param *p);void gem_context_set_param (int fd,struct local_i915_gem_context_param *p);
tests/gem_ctx_param.c +6 -3
@@ -43,6 +43,11 @@ igt_main arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +/* XXX start to enforce ban period returning -EINVAL when +* transition has been done */ +if (__gem_context_get_param (fd, &arg) == -EINVAL ) + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + igt_subtest("basic") { arg.context = ctx;gem_context_get_param (fd, &arg);
@@ -82,8 +87,6 @@ igt_main arg.size =0 ; } - arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - igt_subtest("non-root-set") { igt_fork(child, 1) {igt_drop_root ();
@@ -137,7 +140,7 @@ igt_main* to catch ABI extensions. Don't "fix" this testcase without adding all * the tests for the new param first. */ - arg.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE +1 ; + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE +1 ; igt_subtest("invalid-param-get") { arg.context = ctx;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 lib: substitute cxt BAN_PERIOD with BANNABLE
In reply to Mika KuoppalaContext BAN_PERIOD will get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.
v2: check against - EINVAL on get/set ban as it can return -EPERM
v3: better naming for get/set (Chris)
--- lib/igt_gt.c | 77 ++++++++++++++++++++++++++++++--------------------- lib/ioctl_wrappers.c | 16 +++++++++-- lib/ioctl_wrappers.h | 3 +- tests/gem_ctx_param.c | 9 ++++-- 4 files changed, 68 insertions(+), 37 deletions(-)
lib/igt_gt.c +46 -31
@@ -119,11 +119,43 @@ void igt_require_hang_ring(int fd, int ring)igt_skip ("hang injection disabled by user" );gem_require_ring (fd, ring); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd)); } +static unsigned context_get_ban (int fd,unsigned ctx) +{ +struct local_i915_gem_context_param param; + + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + param.value =0 ; + param.size =0 ; + +if (__gem_context_get_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value ==0 ); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_get_param (fd, ¶m); + } + +return param.value; +} + +static void context_set_ban (int fd,unsigned ctx,unsigned ban) +{ +struct local_i915_gem_context_param param; + + param.value = ban; + param.size =0 ; + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + +if (__gem_context_set_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value == ban); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_set_param (fd, ¶m); + } +} +igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags) {struct local_i915_gem_context_param param;
@@ -131,7 +163,7 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)if (!igt_check_boolean_env_var ("IGT_HANG" , true))igt_skip ("hang injection disabled by user" ); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd));
@@ -148,16 +180,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; - -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } + ban =context_get_ban (fd, ctx); +if ((flags &HANG_ALLOW_BAN ) ==0 ) +context_set_ban (fd, ctx,0 );return (struct igt_hang ){0 , ctx, ban, flags }; }
@@ -166,13 +191,11 @@ void igt_disallow_hang(int fd, igt_hang_t arg) {struct local_i915_gem_context_param param; - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +context_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
@@ -227,16 +250,10 @@ igt_hang_t igt_hang_ctx(int fd,__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; + ban =context_get_ban (fd, ctx); -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } +if ((flags &HANG_ALLOW_BAN ) ==0 ) +context_set_ban (fd, ctx,0 );memset (&reloc,0 ,sizeof (reloc));memset (&exec,0 ,sizeof (exec));
@@ -323,13 +340,11 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);gem_close (fd, arg.handle); - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +context_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))
lib/ioctl_wrappers.c +14 -2
@@ -961,9 +961,21 @@ void gem_context_require_param(int fd, uint64_t param)igt_require (igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ); } -void gem_context_require_ban_period (int fd) +void gem_context_require_bannable (int fd) {static int has_ban_period =-1 ; +static int has_bannable =-1 ; + +if (has_bannable <0 ) { +struct local_i915_gem_context_param p; + + p.context =0 ; + p.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + p.value =0 ; + p.size =0 ; + + has_bannable =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; + }if (has_ban_period <0 ) {struct local_i915_gem_context_param p;
@@ -976,7 +988,7 @@ void gem_context_require_ban_period(int fd) has_ban_period =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; } -igt_require (has_ban_period); +igt_require (has_ban_period || has_bannable); }int __gem_userptr (int fd,void *ptr,int size,int read_only,uint32_t flags,uint32_t *handle)
lib/ioctl_wrappers.h +2 -1
@@ -120,9 +120,10 @@ struct local_i915_gem_context_param {#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2#define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 +#define LOCAL_CONTEXT_PARAM_BANNABLE 0x5uint64_t value; }; -void gem_context_require_ban_period (int fd); +void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param);void gem_context_get_param (int fd,struct local_i915_gem_context_param *p);void gem_context_set_param (int fd,struct local_i915_gem_context_param *p);
tests/gem_ctx_param.c +6 -3
@@ -43,6 +43,11 @@ igt_main arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +/* XXX start to enforce ban period returning -EINVAL when +* transition has been done */ +if (__gem_context_get_param (fd, &arg) == -EINVAL ) + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + igt_subtest("basic") { arg.context = ctx;gem_context_get_param (fd, &arg);
@@ -82,8 +87,6 @@ igt_main arg.size =0 ; } - arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - igt_subtest("non-root-set") { igt_fork(child, 1) {igt_drop_root ();
@@ -137,7 +140,7 @@ igt_main* to catch ABI extensions. Don't "fix" this testcase without adding all * the tests for the new param first. */ - arg.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE +1 ; + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE +1 ; igt_subtest("invalid-param-get") { arg.context = ctx;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Mika Kuoppala
Context
BAN_PERIODwill get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.v2: check against - EINVAL on get/set ban as it can return
-EPERM
v3: better naming for get/set (Chris)Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>
There's a small assumption of symmetry between the get/set paths, but it looks ok as a transitional patch.
-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
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Mika Kuoppala
Context
BAN_PERIODwill get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.v2: check against - EINVAL on get/set ban as it can return
-EPERM
v3: better naming for get/set (Chris)
Quoted 6 lines
Quoted 2 lines
Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>There's a small assumption of symmetry between the get/set paths, but it looks ok as a transitional patch.
Reviewed-by Chris Wilson <[email protected]>
Pushed. Thanks for review.
-Mika
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 4 lines · Mika Kuoppala
Context
BAN_PERIODwill get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT.
The kernel parts are in:
https://cgit.freedesktop.org/~miku/drm-intel/log/?h=hangcheck
https://cgit.freedesktop.org/~miku/drm-intel/commit/?h=hangcheck&id=9f3c978720a82f3043060b5e43cfd7d4fa79f2bd
-Mika
Quoted 232 lines
v2: check against - EINVAL on get/set ban as it can return
-EPERM
v3: better naming for get/set (Chris)Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- lib/igt_gt.c | 77 ++++++++++++++++++++++++++++++--------------------- lib/ioctl_wrappers.c | 16 +++++++++-- lib/ioctl_wrappers.h | 3 +- tests/gem_ctx_param.c | 9 ++++-- 4 files changed, 68 insertions(+), 37 deletions(-)lib/igt_gt.c +46
-31@@ -119,11 +119,43 @@ void igt_require_hang_ring(int fd, int ring)igt_skip ("hang injection disabled by user" );gem_require_ring (fd, ring); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd)); } +static unsigned context_get_ban (int fd,unsigned ctx) +{ +struct local_i915_gem_context_param param; + + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + param.value =0 ; + param.size =0 ; + +if (__gem_context_get_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value ==0 ); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_get_param (fd, ¶m); + } + +return param.value; +} + +static void context_set_ban (int fd,unsigned ctx,unsigned ban) +{ +struct local_i915_gem_context_param param; + + param.value = ban; + param.size =0 ; + param.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + +if (__gem_context_set_param (fd, ¶m) == -EINVAL ) { +igt_assert (param.value == ban); + param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +gem_context_set_param (fd, ¶m); + } +} +igt_hang_t igt_allow_hang (int fd,unsigned ctx,unsigned flags) {struct local_i915_gem_context_param param;@@ -131,7 +163,7 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)if (!igt_check_boolean_env_var ("IGT_HANG" , true))igt_skip ("hang injection disabled by user" ); -gem_context_require_ban_period (fd); +gem_context_require_bannable (fd);if (!igt_check_boolean_env_var ("IGT_HANG_WITHOUT_RESET" , false))igt_require (has_gpu_reset (fd));@@ -148,16 +180,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags)__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; - -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } + ban =context_get_ban (fd, ctx); +if ((flags &HANG_ALLOW_BAN ) ==0 ) +context_set_ban (fd, ctx,0 );return (struct igt_hang ){0 , ctx, ban, flags }; }@@ -166,13 +191,11 @@ void igt_disallow_hang(int fd, igt_hang_t arg) {struct local_i915_gem_context_param param; - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +context_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))@@ -227,16 +250,10 @@ igt_hang_t igt_hang_ctx(int fd,__gem_context_set_param (fd, ¶m); } - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_get_param (fd, ¶m); - ban = param.value; + ban =context_get_ban (fd, ctx); -if ((flags &HANG_ALLOW_BAN ) ==0 ) { - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value =0 ; -gem_context_set_param (fd, ¶m); - } +if ((flags &HANG_ALLOW_BAN ) ==0 ) +context_set_ban (fd, ctx,0 );memset (&reloc,0 ,sizeof (reloc));memset (&exec,0 ,sizeof (exec));@@ -323,13 +340,11 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);gem_close (fd, arg.handle); - param.context = arg.ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - param.value = arg.ban; -gem_context_set_param (fd, ¶m); +context_set_ban (fd, arg.ctx, arg.ban);if ((arg.flags &HANG_ALLOW_CAPTURE ) ==0 ) { + param.context = arg.ctx; + param.size =0 ; param.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE ; param.value =0 ;if (__gem_context_set_param (fd, ¶m))lib/ioctl_wrappers.c +14
-2@@ -961,9 +961,21 @@ void gem_context_require_param(int fd, uint64_t param)igt_require (igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ); } -void gem_context_require_ban_period (int fd) +void gem_context_require_bannable (int fd) {static int has_ban_period =-1 ; +static int has_bannable =-1 ; + +if (has_bannable <0 ) { +struct local_i915_gem_context_param p; + + p.context =0 ; + p.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + p.value =0 ; + p.size =0 ; + + has_bannable =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; + }if (has_ban_period <0 ) {struct local_i915_gem_context_param p;@@ -976,7 +988,7 @@ void gem_context_require_ban_period(int fd) has_ban_period =igt_ioctl (fd,LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM , &p) ==0 ; } -igt_require (has_ban_period); +igt_require (has_ban_period || has_bannable); }int __gem_userptr (int fd,void *ptr,int size,int read_only,uint32_t flags,uint32_t *handle)lib/ioctl_wrappers.h +2
-1@@ -120,9 +120,10 @@ struct local_i915_gem_context_param {#define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2#define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 +#define LOCAL_CONTEXT_PARAM_BANNABLE 0x5uint64_t value; }; -void gem_context_require_ban_period (int fd); +void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param);void gem_context_get_param (int fd,struct local_i915_gem_context_param *p);void gem_context_set_param (int fd,struct local_i915_gem_context_param *p);tests/gem_ctx_param.c +6
-3@@ -43,6 +43,11 @@ igt_main arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; +/* XXX start to enforce ban period returning -EINVAL when +* transition has been done */ +if (__gem_context_get_param (fd, &arg) == -EINVAL ) + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE ; + igt_subtest("basic") { arg.context = ctx;gem_context_get_param (fd, &arg);@@ -82,8 +87,6 @@ igt_main arg.size =0 ; } - arg.param =LOCAL_CONTEXT_PARAM_BAN_PERIOD ; - igt_subtest("non-root-set") { igt_fork(child, 1) {igt_drop_root ();@@ -137,7 +140,7 @@ igt_main* to catch ABI extensions. Don't "fix" this testcase without adding all * the tests for the new param first. */ - arg.param =LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE +1 ; + arg.param =LOCAL_CONTEXT_PARAM_BANNABLE +1 ; igt_subtest("invalid-param-get") { arg.context = ctx;Signature · 1 line
2.7.4
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx