]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gem: Don't allow changing the engine set on running contexts (v3)
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 8 Jul 2021 15:48:31 +0000 (10:48 -0500)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 8 Jul 2021 17:49:09 +0000 (19:49 +0200)
commit069784e9279a57842dcf55457426d4d422b7c911
tree81cfe7a823e64d7fffb16b106aa8fd6bf9813cc3
parent51c998b7960b8af4ec2d764e1fa2aed1498d2d8a
drm/i915/gem: Don't allow changing the engine set on running contexts (v3)

When the APIs were added to manage the engine set on a GEM context
directly from userspace, the questionable choice was made to allow
changing the engine set on a context at any time.  This is horribly racy
and there's absolutely no reason why any userspace would want to do this
outside of trying to exercise interesting race conditions.  By removing
support for CONTEXT_PARAM_ENGINES from ctx_setparam, we make it
impossible to change the engine set after the context has been fully
created.

This doesn't yet let us delete all the deferred engine clean-up code as
that's still used for handling the case where the client dies or calls
GEM_CONTEXT_DESTROY while work is in flight.  However, moving to an API
where the engine set is effectively immutable gives us more options to
potentially clean that code up a bit going forward.  It also removes a
whole class of ways in which a client can hurt itself or try to get
around kernel context banning.

v2 (Jason Ekstrand):
 - Expand the commit mesage

v3 (Jason Ekstrand):
 - Make it more obvious that I915_CONTEXT_PARAM_ENGINES returns -EINVAL

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210708154835.528166-27-jason@jlekstrand.net
drivers/gpu/drm/i915/gem/i915_gem_context.c