]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gem: Don't allow changing the VM on running contexts (v4)
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 8 Jul 2021 15:48:30 +0000 (10:48 -0500)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 8 Jul 2021 17:49:02 +0000 (19:49 +0200)
commit51c998b7960b8af4ec2d764e1fa2aed1498d2d8a
treefc82140a11ddc0d57f2e501b4105e63c631cac41
parent2b4986786fb3b26a9b05acd0cc4546fc54a302e9
drm/i915/gem: Don't allow changing the VM on running contexts (v4)

When the APIs were added to manage VMs more directly from userspace, the
questionable choice was made to allow changing out the VM 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 testing that exact race.
By removing support for CONTEXT_PARAM_VM from ctx_setparam, we make it
impossible to change out the VM after the context has been fully
created.  This lets us delete a bunch of deferred task code as well as a
duplicated (and slightly different) copy of the code which programs the
PPGTT registers.

v2 (Jason Ekstrand):
 - Expand the commit message

v3 (Daniel Vetter):
 - Don't drop the __rcu on the vm pointer

v4 (Jason Ekstrand):
 - Make it more obvious that I915_CONTEXT_PARAM_VM 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-26-jason@jlekstrand.net
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
drivers/gpu/drm/i915/selftests/i915_mock_selftests.h