tests/gem_ctx_param: Update invalid param
PATCH v2 1/1 tests/gem_ctx_param: Update invalid param
Since commit: drm/i915/scheduler: Support user-defined priorities, the driver support an extra context param to set context's priority. Add tests for that interface and update invalid tests.
v2:
- Add arg size validation test. (Chris)
- Add arg value overflow test. (Chris)
- Add test for unsupported platforms. (Chris)
- Feed interface with all priority values and in random order. (Chris)
--- tests/gem_ctx_param.c | 143 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 1 deletion(-)
tests/gem_ctx_param.c +142 -1
@@ -25,6 +25,7 @@*/ #include "igt.h" +#include <limits.h> IGT_TEST_DESCRIPTION ("Basic test for context set/get param input validation." );
@@ -136,11 +137,151 @@ igt_maingem_context_set_param (fd, &arg); } + arg.param =I915_CONTEXT_PARAM_PRIORITY ; + +#define MAX_USER_SET_PRIO I915_CONTEXT_DEFAULT_PRIORITY/* Current max prio for non-root users */ +#define PRIO_RANGE (I915_CONTEXT_MAX_USER_PRIORITY - I915_CONTEXT_MIN_USER_PRIORITY) +#define USER_PRIO_RANGE (MAX_USER_SET_PRIO - I915_CONTEXT_MIN_USER_PRIORITY) + + igt_subtest("set-priority-not-supported") { +igt_require (!gem_scheduler_has_ctx_priority (fd)); + + arg.ctx_id = ctx; + arg.size =0 ; + +igt_assert_eq (__gem_context_set_param (fd, &arg), -ENODEV ); + } + + igt_subtest_group { + igt_fixture { +igt_require (gem_scheduler_has_ctx_priority (fd)); + } + + igt_subtest("get-priority-new-ctx") { + arg.ctx_id =gem_context_create (fd); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value,0 ); + } + + igt_subtest("set-priority-invalid-size") { + arg.ctx_id = ctx; + arg.value =0 ; + arg.size = ~0 ; + +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + } + + igt_subtest("root-set-priority") { +int prio_values[PRIO_RANGE +1 ]; +for (int i =0 ; i <PRIO_RANGE +1 ; i++) + prio_values[i] = i +I915_CONTEXT_MIN_USER_PRIORITY ; +igt_permute_array (prio_values,ARRAY_SIZE (prio_values), igt_exchange_int); + + arg.ctx_id = ctx; + arg.size =0 ; + +for (int i =0 ; i <PRIO_RANGE +1 ; i++) { + arg.value = prio_values[i]; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value, prio_values[i]);/* Verify prio was set */ + } + } + + igt_subtest("root-set-priority-invalid-value") { +int prio_levels[] + = {INT_MIN , +I915_CONTEXT_MIN_USER_PRIORITY -1 , +I915_CONTEXT_MAX_USER_PRIORITY +1 , +INT_MAX };/* Test space too big pick significant values */ +int old_value; + arg.ctx_id = ctx; + +gem_context_get_param (fd, &arg); + old_value = arg.value; + +for (int i =0 ; i <ARRAY_SIZE (prio_levels); i++) { + arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value, old_value);/* Verify prio was not set */ + } + } + + igt_subtest("root-set-priority-overflow-value") { +uint64_t prio_values[PRIO_RANGE +1 ]; +for (int i =0 ; i <PRIO_RANGE +1 ; i++) + prio_values[i] = (0x1 <<32 ) + (i +I915_CONTEXT_MIN_USER_PRIORITY ); +igt_permute_array (prio_values,ARRAY_SIZE (prio_values), igt_exchange_int); + + arg.ctx_id =gem_context_create (fd); + arg.size =0 ; + +for (int i =0 ; i <PRIO_RANGE +1 ; i++) { + arg.value = prio_values[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value,I915_CONTEXT_DEFAULT_PRIORITY );/* Verify prio was set */ + } + } + + igt_subtest("user-set-priority") { +int prio_values[USER_PRIO_RANGE +1 ]; +for (int i =0 ; i <USER_PRIO_RANGE +1 ; i++) + prio_values[i] = i +I915_CONTEXT_MIN_USER_PRIORITY ; +igt_permute_array (prio_values,ARRAY_SIZE (prio_values), igt_exchange_int); + + igt_fork(child, 1) { +igt_drop_root (); +for (int i =0 ; i <USER_PRIO_RANGE ; i++) { + arg.size =0 ; + arg.value = prio_values[i]; + +igt_debug ("Setting prio: %d\n" , prio_values[i]); +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value, prio_values[i]);/* Verify prio was set */ + } + } + +igt_waitchildren (); + } + + igt_subtest("user-set-priority-invalid-value") { +int prio_values[PRIO_RANGE -USER_PRIO_RANGE ]; +for (int i =0 ; i < (PRIO_RANGE -USER_PRIO_RANGE ); i++) + prio_values[i] = i + (MAX_USER_SET_PRIO +1 ); +igt_permute_array (prio_values,ARRAY_SIZE (prio_values), igt_exchange_int); + + arg.ctx_id =gem_context_create (fd); + arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); + +for (int i =0 ; i <ARRAY_SIZE (prio_values); i++) { + arg.value = prio_values[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EPERM ); + +gem_context_get_param (fd, &arg); +igt_assert_eq (arg.value,I915_CONTEXT_DEFAULT_PRIORITY );/* Verify prio was not set */ + } + } + +igt_waitchildren (); + } + } +/* NOTE: This testcase intentionally tests for the next free parameter * to catch ABI extensions. Don't "fix" this testcase without adding all * the tests for the new param first. */ - arg.param =I915_CONTEXT_PARAM_BANNABLE +1 ; + arg.param =I915_CONTEXT_PARAM_PRIORITY +1 ; igt_subtest("invalid-param-get") { arg.ctx_id = ctx;
Signature · 6 lines
2.14.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Antonio Argenziano (2017-12-19 21:16:40)
Quoted 14 lines
Since commit: drm/i915/scheduler: Support user-defined priorities, the driver support an extra context param to set context's priority. Add tests for that interface and update invalid tests.
v2:
- Add arg size validation test. (Chris)
- Add arg value overflow test. (Chris)
- Add test for unsupported platforms. (Chris)
- Feed interface with all priority values and in random order. (Chris)Signed-off-by Antonio Argenziano <[email protected]>Cc Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>---
tests/gem_ctx_param.c igt_main · line 261
Quoted 7 lines
tests/gem_ctx_param.c +7
-0+ igt_subtest("user-set-priority-invalid-value") { +int prio_values[PRIO_RANGE -USER_PRIO_RANGE ]; +for (int i =0 ; i < (PRIO_RANGE -USER_PRIO_RANGE ); i++) + prio_values[i] = i + (MAX_USER_SET_PRIO +1 ); +igt_permute_array (prio_values,ARRAY_SIZE (prio_values), igt_exchange_int); + + arg.ctx_id =gem_context_create (fd);
So arg.ctx_id points to different contexts depending on which subtests are run, beside the context leak. But that does also make a good suggestion that you do want to check both the default context (0) and a user created context for handling (it may matter not today, but we do already depend on the equivalence, i.e. that we can probe the default context to determine support for user contexts). Do you feel like parameterising the tests yet? :)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for tests/gem_ctx_param: Update invalid param (rev2)
In reply to Antonio Argenziano== Series Details ==
== Series Details ==
Series: tests/gem_ctx_param: Update invalid param (rev2)
URL : https://patchwork.freedesktop.org/series/35438/
State : success
== Summary ==
IGT patchset tested on top of latest successful buildda0889bfacff106fb3ecb7049a7a21f78b4b301b igt/kms_frontbuffer_tracking: Access via GGTT is not guaranteed to be tracked
with latest DRM-Tip kernel build CI_DRM_3549cd7e14499b1d drm-tip: 2017y-12m-19d-15h-09m-52s UTC integration manifest
Testlist changes:
+igt@gem_ctx_param@get-priority-new-ctx +igt@gem_ctx_param@root-set-priority +igt@gem_ctx_param@root-set-priority-invalid-value +igt@gem_ctx_param@root-set-priority-overflow-value +igt@gem_ctx_param@set-priority-invalid-size +igt@gem_ctx_param@set-priority-not-supported +igt@gem_ctx_param@user-set-priority +igt@gem_ctx_param@user-set-priority-invalid-value
Test debugfs_test:
Subgroup read_all_entries:
dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> DMESG-WARN (fi-kbl-r) fdo#104172 +1fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:436s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:439s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:385s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:499s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:279s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:494s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:501s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:483s 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:266s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:531s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:406s fi-hsw-4770r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:425s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:395s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:476s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:423s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:476s fi-kbl-7560u total:288 pass:268 dwarn:1 dfail:0 fail:0 skip:19 time:524s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:466s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:526s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:585s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:443s fi-skl-6600u total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:532s fi-skl-6700hq total:288 pass:261 dwarn:1 dfail:0 fail:0 skip:26 time:557s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:509s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:496s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:445s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:540s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:414s Blacklisted hosts: fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:594s fi-cnl-y total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:628s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_708/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for tests/gem_ctx_param: Update invalid param (rev2)
In reply to Antonio Argenziano== Series Details ==
== Series Details ==
Series: tests/gem_ctx_param: Update invalid param (rev2)
URL : https://patchwork.freedesktop.org/series/35438/
State : success
== Summary ==
Test kms_flip:
Subgroup vblank-vs-modeset-suspend:
skip -> PASS (shard-snb) fdo#102365
Test gem_ctx_param:
Subgroup invalid-param-get:
fail -> PASS (shard-snb) fdo#103107 +3
Test kms_atomic_transition:
Subgroup 1x-modeset-transitions-nonblocking:
skip -> PASS (shard-snb)
Test kms_cursor_crc:
Subgroup cursor-256x256-suspend:
pass -> SKIP (shard-snb) fdo#103375
Test kms_busy:
Subgroup extended-pageflip-hang-oldfb-render-b:
skip -> PASS (shard-snb)
Test kms_draw_crc:
Subgroup draw-method-xrgb2101010-mmap-gtt-untiled:
skip -> PASS (shard-snb)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
pass -> FAIL (shard-snb) fdo#101623
Test perf:
Subgroup blocking:
fail -> PASS (shard-hsw) fdo#102252fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#103107 https://bugs.freedesktop.org/show_bug.cgi?id=103107
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2720 pass:1540 dwarn:1 dfail:0 fail:8 skip:1171 time:9411s shard-snb total:2720 pass:1311 dwarn:1 dfail:0 fail:9 skip:1399 time:8061s Blacklisted hosts: shard-apl total:2698 pass:1670 dwarn:1 dfail:0 fail:23 skip:1002 time:13346s shard-kbl total:2673 pass:1764 dwarn:9 dfail:0 fail:23 skip:875 time:10633s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_708/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx