• Jason Ekstrand's avatar
    drm/i915/gem: Don't allow changing the engine set on running contexts (v3) · d9d29c74
    Jason Ekstrand authored
    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: default avatarJason Ekstrand <jason@jlekstrand.net>
    Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210708154835.528166-27-jason@jlekstrand.net
    d9d29c74
i915_gem_context.c 57 KB