Message ID | 1455269934-7586-4-git-send-email-derek.j.morton@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 12/02/16 09:38, Derek Morton wrote: > From: John Harrison <John.C.Harrison@Intel.com> > > The GPU scheduler has added an execution priority level to the context > object. There is an IOCTL interface to allow user apps/libraries to > set this priority. This patch updates the context paramter IOCTL test > to include the new interface. > > For: VIZ-1587 > Signed-off-by: John Harrison <John.C.Harrison@Intel.com> > --- > lib/ioctl_wrappers.h | 1 + > tests/gem_ctx_param_basic.c | 34 +++++++++++++++++++++++++++++++++- > 2 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h > index 4d913c5..f1ef739 100644 > --- a/lib/ioctl_wrappers.h > +++ b/lib/ioctl_wrappers.h > @@ -106,6 +106,7 @@ struct local_i915_gem_context_param { > #define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1 > #define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2 > #define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3 > +#define LOCAL_CONTEXT_PARAM_PRIORITY 0x4 > uint64_t value; > }; > void gem_context_require_ban_period(int fd); > diff --git a/tests/gem_ctx_param_basic.c b/tests/gem_ctx_param_basic.c > index b75800c..585a1a8 100644 > --- a/tests/gem_ctx_param_basic.c > +++ b/tests/gem_ctx_param_basic.c > @@ -147,10 +147,42 @@ igt_main > TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); > } > > + ctx_param.param = LOCAL_CONTEXT_PARAM_PRIORITY; > + > + igt_subtest("priority-root-set") { > + ctx_param.context = ctx; > + ctx_param.value = 2048; > + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EINVAL); > + ctx_param.value = -2048; > + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EINVAL); > + ctx_param.value = 512; > + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); > + ctx_param.value = -512; > + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); in the latest scheduler patchset I've looked at the max and min priority values were exported through debugfs via i915_scheduler_priority_<min/max>, so instead of using 512 and 2048 as valid and invalid priority values we could use the values returned by the debugfs forTEST_SUCCESS and the same values +/-1 for TEST_FAIL. The patch as it is still LGTM, so with or without my suggested change: Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Regards, Daniele > + ctx_param.value = 0; > + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); > + } > + > + igt_subtest("priority-non-root-set") { > + igt_fork(child, 1) { > + igt_drop_root(); > + > + ctx_param.context = ctx; > + ctx_param.value = 512; > + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EPERM); > + ctx_param.value = -512; > + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); > + ctx_param.value = 0; > + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); > + } > + > + 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. */ > - ctx_param.param = LOCAL_CONTEXT_PARAM_GTT_SIZE + 1; > + ctx_param.param = LOCAL_CONTEXT_PARAM_PRIORITY + 1; > > igt_subtest("invalid-param-get") { > ctx_param.context = ctx;
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h index 4d913c5..f1ef739 100644 --- a/lib/ioctl_wrappers.h +++ b/lib/ioctl_wrappers.h @@ -106,6 +106,7 @@ struct local_i915_gem_context_param { #define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1 #define LOCAL_CONTEXT_PARAM_NO_ZEROMAP 0x2 #define LOCAL_CONTEXT_PARAM_GTT_SIZE 0x3 +#define LOCAL_CONTEXT_PARAM_PRIORITY 0x4 uint64_t value; }; void gem_context_require_ban_period(int fd); diff --git a/tests/gem_ctx_param_basic.c b/tests/gem_ctx_param_basic.c index b75800c..585a1a8 100644 --- a/tests/gem_ctx_param_basic.c +++ b/tests/gem_ctx_param_basic.c @@ -147,10 +147,42 @@ igt_main TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); } + ctx_param.param = LOCAL_CONTEXT_PARAM_PRIORITY; + + igt_subtest("priority-root-set") { + ctx_param.context = ctx; + ctx_param.value = 2048; + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EINVAL); + ctx_param.value = -2048; + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EINVAL); + ctx_param.value = 512; + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); + ctx_param.value = -512; + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); + ctx_param.value = 0; + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); + } + + igt_subtest("priority-non-root-set") { + igt_fork(child, 1) { + igt_drop_root(); + + ctx_param.context = ctx; + ctx_param.value = 512; + TEST_FAIL(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, EPERM); + ctx_param.value = -512; + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); + ctx_param.value = 0; + TEST_SUCCESS(LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM); + } + + 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. */ - ctx_param.param = LOCAL_CONTEXT_PARAM_GTT_SIZE + 1; + ctx_param.param = LOCAL_CONTEXT_PARAM_PRIORITY + 1; igt_subtest("invalid-param-get") { ctx_param.context = ctx;