lkml.org 
[lkml]   [2020]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.7 231/244] drm/i915/gt: Only swap to a random sibling once upon creation
    Date
    From: Chris Wilson <chris@chris-wilson.co.uk>

    commit 110f9efa858f584c6bed177cd48d0c0f526940e1 upstream.

    The danger in switching at random upon intel_context_pin is that the
    context may still actually be inflight, as it will not be scheduled out
    until a context switch after it is complete -- that may be a long time
    after we do a final intel_context_unpin.

    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2118
    Fixes: 6d06779e8672 ("drm/i915: Load balancing across a virtual engine")
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: <stable@vger.kernel.org> # v5.3+
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200713160549.17344-1-chris@chris-wilson.co.uk
    (cherry picked from commit 90a987205c6cf74116a102ed446d22d92cdaf915)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/gpu/drm/i915/gt/intel_lrc.c | 18 ++++--------------
    1 file changed, 4 insertions(+), 14 deletions(-)

    --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
    +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
    @@ -4897,13 +4897,8 @@ static void virtual_engine_initial_hint(
    * typically be the first we inspect for submission.
    */
    swp = prandom_u32_max(ve->num_siblings);
    - if (!swp)
    - return;
    -
    - swap(ve->siblings[swp], ve->siblings[0]);
    - if (!intel_engine_has_relative_mmio(ve->siblings[0]))
    - virtual_update_register_offsets(ve->context.lrc_reg_state,
    - ve->siblings[0]);
    + if (swp)
    + swap(ve->siblings[swp], ve->siblings[0]);
    }

    static int virtual_context_alloc(struct intel_context *ce)
    @@ -4916,15 +4911,9 @@ static int virtual_context_alloc(struct
    static int virtual_context_pin(struct intel_context *ce)
    {
    struct virtual_engine *ve = container_of(ce, typeof(*ve), context);
    - int err;

    /* Note: we must use a real engine class for setting up reg state */
    - err = __execlists_context_pin(ce, ve->siblings[0]);
    - if (err)
    - return err;
    -
    - virtual_engine_initial_hint(ve);
    - return 0;
    + return __execlists_context_pin(ce, ve->siblings[0]);
    }

    static void virtual_context_enter(struct intel_context *ce)
    @@ -5270,6 +5259,7 @@ intel_execlists_create_virtual(struct in

    ve->base.flags |= I915_ENGINE_IS_VIRTUAL;

    + virtual_engine_initial_hint(ve);
    return &ve->context;

    err_put:

    \
     
     \ /
      Last update: 2020-07-20 18:16    [W:4.058 / U:0.540 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site