tests/gem_ctx_param: Update invalid param
PATCH 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.
--- tests/gem_ctx_param.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-)
tests/gem_ctx_param.c +76 -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,85 @@ igt_maingem_context_set_param (fd, &arg); } +#define MAX_PRIO 1023 +#define MIN_PRIO -MAX_PRIO +#define DEF_PRIO 0 + + arg.param =I915_CONTEXT_PARAM_PRIORITY ; + + igt_subtest("root-set-priority") { + arg.ctx_id = ctx; + arg.size =0 ; + +for (int i =MIN_PRIO ; i <=MAX_PRIO ; i +=1023 ) { + arg.value = i; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */ + } + } + + igt_subtest("root-set-priority-invalid-value") { +int prio_levels[] = {INT_MIN ,MIN_PRIO -1 ,MAX_PRIO +1 ,INT_MAX }; +int old_value; + arg.ctx_id = ctx; + +gem_context_get_param (fd, &arg); + old_value = arg.value; + +for (int i =0 ; i < (sizeof (prio_levels) /sizeof (int )); i++) { + arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == old_value);/* Verify prio was not set */ + } + } + + igt_subtest("user-set-priority") { + arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); +for (int i =MIN_PRIO ; i <=DEF_PRIO ; i +=1023 ) { + arg.value = i; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */ + } + } + +igt_waitchildren (); + } + + igt_subtest("user-set-priority-invalid-value") { +int prio_levels[] = {DEF_PRIO +1 ,MAX_PRIO }; + arg.ctx_id = ctx; + arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); + +for (int i =0 ; i < (sizeof (prio_levels) /sizeof (int )); i++) { + arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EPERM ); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value ==DEF_PRIO );/* 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
Patchwork
CI✓ Fi.CI.BAT: success for tests/gem_ctx_param: Update invalid param
== Series Details ==
== Series Details ==
Series: tests/gem_ctx_param: Update invalid param
URL : https://patchwork.freedesktop.org/series/35438/
State : success
== Summary ==
IGT patchset tested on top of latest successful build c0be3310715e2f744b892c51f09e62273bcc8e57 tests/kms_frontbuffer_tracking: Correctly handle debugfs errors
with latest DRM-Tip kernel build CI_DRM_3524d4fa2d8c0c1d drm-tip: 2017y-12m-15d-18h-22m-22s UTC integration manifest
Testlist changes:
+igt@gem_ctx_param@root-set-priority +igt@gem_ctx_param@root-set-priority-invalid-value +igt@gem_ctx_param@user-set-priority +igt@gem_ctx_param@user-set-priority-invalid-value
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
fail -> PASS (fi-gdg-551) fdo#102575
Test gem_sync:
Subgroup basic-all:
dmesg-fail -> FAIL (fi-blb-e6850) fdo#104259
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
incomplete -> PASS (fi-snb-2520m) fdo#103713
Test kms_psr_sink_crc:
Subgroup psr_basic:
pass -> DMESG-WARN (fi-skl-6700hq) fdo#101144fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104259 https://bugs.freedesktop.org/show_bug.cgi?id=104259
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:435s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:442s fi-blb-e6850 total:288 pass:222 dwarn:1 dfail:0 fail:1 skip:64 time:389s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:507s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:278s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:495s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:498s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:490s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:470s fi-elk-e7500 total:224 pass:163 dwarn:15 dfail:0 fail:0 skip:45 fi-gdg-551 total:288 pass:179 dwarn:1 dfail:0 fail:0 skip:108 time:264s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:537s 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:413s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:472s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:428s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:481s fi-kbl-7560u total:288 pass:268 dwarn:1 dfail:0 fail:0 skip:19 time:520s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:474s fi-kbl-r total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:523s fi-pnv-d510 total:288 pass:221 dwarn:1 dfail:0 fail:1 skip:65 time:594s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:453s fi-skl-6600u total:288 pass:260 dwarn:1 dfail:0 fail:0 skip:27 time:531s fi-skl-6700hq total:288 pass:261 dwarn:1 dfail:0 fail:0 skip:26 time:557s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:507s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:448s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:556s 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:588s fi-cnl-y total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:624s fi-glk-dsi total:288 pass:257 dwarn:0 dfail:0 fail:1 skip:30 time:489s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:509s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_688/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
In reply to Antonio Argenziano== Series Details ==
== Series Details ==
Series: tests/gem_ctx_param: Update invalid param
URL : https://patchwork.freedesktop.org/series/35438/
State : success
== Summary ==
Warning: bzip CI_DRM_3524/shard-glkb6/results10.json.bz2 wasn't in correct JSON format Test gem_ctx_param:
Subgroup invalid-param-set:
fail -> PASS (shard-snb) fdo#103107 +3
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912
Test gem_eio:
Subgroup in-flight-contexts:
pass -> DMESG-WARN (shard-snb) fdo#104058
Test drv_module_reload:
Subgroup basic-reload-inject:
pass -> DMESG-WARN (shard-snb) fdo#102707 +1
Test pm_rc6_residency:
Subgroup rc6-accuracy:
skip -> PASS (shard-snb)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
fail -> PASS (shard-snb) fdo#101623 +1
Test perf:
Subgroup blocking:
pass -> FAIL (shard-hsw) fdo#102252
Test kms_flip:
Subgroup dpms-vs-vblank-race:
fail -> PASS (shard-hsw) fdo#103060
Test gem_softpin:
Subgroup noreloc-s3:
skip -> PASS (shard-snb) fdo#102365
skip -> PASS (shard-hsw) fdo#103540
Test drv_selftest:
Subgroup live_hangcheck:
pass -> INCOMPLETE (shard-snb) fdo#103880fdo#103107 https://bugs.freedesktop.org/show_bug.cgi?id=103107
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103880 https://bugs.freedesktop.org/show_bug.cgi?id=103880
shard-hsw total:2700 pass:1529 dwarn:2 dfail:0 fail:13 skip:1155 time:9349s shard-snb total:2698 pass:1290 dwarn:3 dfail:0 fail:14 skip:1390 time:7969s
Blacklisted hosts:
shard-kbl total:2676 pass:1772 dwarn:5 dfail:0 fail:27 skip:871 time:10795s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_688/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Antonio Argenziano (2017-12-15 19:01:11)
Quoted 24 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.
Signed-off-by Antonio Argenziano <[email protected]>Cc Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>--- tests/gem_ctx_param.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-)tests/gem_ctx_param.c +1
-0@@ -25,6 +25,7 @@*/ #include "igt.h" +#include <limits.h> IGT_TEST_DESCRIPTION ("Basic test for context set/get param input validation." );
tests/gem_ctx_param.c igt_main · line 142
Quoted 6 lines
tests/gem_ctx_param.c +3
-0@@ -136,11 +137,85 @@ igt_maingem_context_set_param (fd, &arg); } +#define MAX_PRIO 1023 +#define MIN_PRIO -MAX_PRIO +#define DEF_PRIO 0
Take these from the uapi header.
tests/gem_ctx_param.c igt_main · line 149
Quoted 7 lines
tests/gem_ctx_param.c +7
-0+ + arg.param =I915_CONTEXT_PARAM_PRIORITY ; + + igt_subtest("root-set-priority") { + arg.ctx_id = ctx; + arg.size =0 ; +
Bonus points for CAP_SYS_NICE checking.
arg.size validation checking.
arg.value > u32 (checking for overflows)
gem_context_get_param() of a new context should return DEF_PRIO
set_param on older machines returns -ENODEV
And that's not even trying to fuzz bad values beyond the sanity checks of I915_CONTEXT_PARAM_PRIORITY.
tests/gem_ctx_param.c igt_main · line 150
Quoted 1 line
tests/gem_ctx_param.c +1
-0+for (int i =MIN_PRIO ; i <=MAX_PRIO ; i +=1023 ) {
It's a couple of ioctls, do all 1024. Do them in a random order, trust no one.
tests/gem_ctx_param.c igt_main · line 155
Quoted 5 lines
tests/gem_ctx_param.c +5
-0+ arg.value = i; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */
igt_assert_eq(arg.value, i);
But doesn't verify the priority does anything. Just the RTT in the API, which is a nice verification nevertheless.
tests/gem_ctx_param.c igt_main · line 167
Quoted 12 lines
tests/gem_ctx_param.c +12
-0+ } + } + + igt_subtest("root-set-priority-invalid-value") { +int prio_levels[] = {INT_MIN ,MIN_PRIO -1 ,MAX_PRIO +1 ,INT_MAX }; +int old_value; + arg.ctx_id = ctx; + +gem_context_get_param (fd, &arg); + old_value = arg.value; + +for (int i =0 ; i < (sizeof (prio_levels) /sizeof (int )); i++) {
ARRAY_SIZE(prio_levels);
Quoted 9 lines
tests/gem_ctx_param.c +9
-0+ arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == old_value);/* Verify prio was not set */ + } + } + + igt_subtest("user-set-priority") {
tests/gem_ctx_param.c igt_main · line 186
Quoted 10 lines
tests/gem_ctx_param.c +10
-0+ arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); +for (int i =MIN_PRIO ; i <=DEF_PRIO ; i +=1023 ) { + arg.value = i; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */
I wonder if the CAP_SYS_NICE limit might be adjusted in the future. Certainly preemption rules are flexible, as we haven't told anyone about them yet.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 44 lines · Chris Wilson
Quoting Antonio Argenziano (2017-12-15 19:01:11)
Quoted 24 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.
Signed-off-by Antonio Argenziano <[email protected]>Cc Chris Wilson <[email protected]>Cc Michal Winiarski <[email protected]>--- tests/gem_ctx_param.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-)tests/gem_ctx_param.c +1
-0@@ -25,6 +25,7 @@*/ #include "igt.h" +#include <limits.h> IGT_TEST_DESCRIPTION ("Basic test for context set/get param input validation." );tests/gem_ctx_param.c igt_main · line 142
Quoted 6 lines
tests/gem_ctx_param.c +3
-0@@ -136,11 +137,85 @@ igt_maingem_context_set_param (fd, &arg); } +#define MAX_PRIO 1023 +#define MIN_PRIO -MAX_PRIO +#define DEF_PRIO 0Take these from the uapi header.
tests/gem_ctx_param.c igt_main · line 149
Quoted 7 lines
tests/gem_ctx_param.c +7
-0+ + arg.param =I915_CONTEXT_PARAM_PRIORITY ; + + igt_subtest("root-set-priority") { + arg.ctx_id = ctx; + arg.size =0 ; +Bonus points for
CAP_SYS_NICEchecking.
Quoted 1 line
arg.size validation checking. > arg.value > u32 (checking for overflows)
What is the expectation for overflows? It looks like we only cast value to int.
Quoted 5 lines
gem_context_get_param()of a new context should returnDEF_PRIO
set_paramon older machines returns-ENODEV
Quoted 7 lines
And that's not even trying to fuzz bad values beyond the sanity checks of
I915_CONTEXT_PARAM_PRIORITY.tests/gem_ctx_param.c igt_main · line 150
Quoted 1 line
tests/gem_ctx_param.c +1
-0+for (int i =MIN_PRIO ; i <=MAX_PRIO ; i +=1023 ) {It's a couple of ioctls, do all 1024. Do them in a random order, trust no one.
Do we have a lib for doing that (generate a random permutation) already?
Quoted 42 lines
tests/gem_ctx_param.c igt_main · line 155
Quoted 6 lines
tests/gem_ctx_param.c +5
-0+ arg.value = i; +gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */
igt_assert_eq(arg.value, i);But doesn't verify the priority does anything. Just the RTT in the API, which is a nice verification nevertheless.
tests/gem_ctx_param.c igt_main · line 167
Quoted 12 lines
tests/gem_ctx_param.c +12
-0+ } + } + + igt_subtest("root-set-priority-invalid-value") { +int prio_levels[] = {INT_MIN ,MIN_PRIO -1 ,MAX_PRIO +1 ,INT_MAX }; +int old_value; + arg.ctx_id = ctx; + +gem_context_get_param (fd, &arg); + old_value = arg.value; + +for (int i =0 ; i < (sizeof (prio_levels) /sizeof (int )); i++) {
ARRAY_SIZE(prio_levels);Quoted 15 lines
tests/gem_ctx_param.c +15
-0+ arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == old_value);/* Verify prio was not set */ + } + } + + igt_subtest("user-set-priority") { + arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); +for (int i =MIN_PRIO ; i <=DEF_PRIO ; i +=1023 ) { + arg.value = i;
Quoted 8 lines
tests/gem_ctx_param.c igt_main · line 155
Quoted 4 lines
tests/gem_ctx_param.c +4
-0+gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */ I wonder if the
CAP_SYS_NICElimit might be adjusted in the future. Certainly preemption rules are flexible, as we haven't told anyone about them yet.
I guess when the change comes we will have a new constant we could swap DEF_PRIO with.
-Antonio
Quoted 2 lines
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Antonio Argenziano (2017-12-18 18:15:35)
Quoted 13 lines · Chris Wilson
Quoted 10 lines
Quoting Antonio Argenziano (2017-12-15 19:01:11)
tests/gem_ctx_param.c igt_main · line 149
Quoted 6 lines
tests/gem_ctx_param.c +6
-0+ arg.param =I915_CONTEXT_PARAM_PRIORITY ; + + igt_subtest("root-set-priority") { + arg.ctx_id = ctx; + arg.size =0 ; +Bonus points for
CAP_SYS_NICEchecking.
Quoted 4 lines
Quoted 1 line
arg.size validation checking. > arg.value > u32 (checking for overflows)
What is the expectation for overflows? It looks like we only cast value to int.
That was my point. We could create 1<<32 + prio, so we really should be failing with -EINVAL rather than setting the parameter to prio. Trust nothing, least of all the kernel.
Quoted 7 lines
Quoted 7 lines
gem_context_get_param()of a new context should returnDEF_PRIO
set_paramon older machines returns-ENODEVAnd that's not even trying to fuzz bad values beyond the sanity checks of
I915_CONTEXT_PARAM_PRIORITY.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
+ for (int i =
MIN_PRIO; i <=MAX_PRIO; i += 1023) {It's a couple of ioctls, do all 1024. Do them in a random order, trust no one.
Do we have a lib for doing that (generate a random permutation) already?
See igt_permute_array. Maybe igt_random_array(count, prng_state).
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
tests/gem_ctx_param.c +15
-0+ arg.value = prio_levels[i]; +igt_assert_eq (__gem_context_set_param (fd, &arg), -EINVAL ); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == old_value);/* Verify prio was not set */ + } + } + + igt_subtest("user-set-priority") { + arg.size =0 ; + + igt_fork(child, 1) { +igt_drop_root (); +for (int i =MIN_PRIO ; i <=DEF_PRIO ; i +=1023 ) { + arg.value = i;Quoted 8 lines
tests/gem_ctx_param.c igt_main · line 155
Quoted 4 lines
tests/gem_ctx_param.c +4
-0+gem_context_set_param (fd, &arg); + +gem_context_get_param (fd, &arg); +igt_assert (arg.value == i);/* Verify prio was set */ I wonder if the
CAP_SYS_NICElimit might be adjusted in the future. Certainly preemption rules are flexible, as we haven't told anyone about them yet.
Quoted 2 lines
I guess when the change comes we will have a new constant we could swap
DEF_PRIOwith.
The question is whether it is ABI, as it may be changed. If its not, don't enshrine it into law.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx