• Chris Wilson's avatar
    drm/i915/execlists: Suppress preempting self · c9a64622
    Chris Wilson authored
    In order to avoid preempting ourselves, we currently refuse to schedule
    the tasklet if we reschedule an inflight context. However, this glosses
    over a few issues such as what happens after a CS completion event and
    we then preempt the newly executing context with itself, or if something
    else causes a tasklet_schedule triggering the same evaluation to
    preempt the active context with itself.
    
    However, when we avoid preempting ELSP[0], we still retain the preemption
    value as it may match a second preemption request within the same time period
    that we need to resolve after the next CS event. However, since we only
    store the maximum preemption priority seen, it may not match the
    subsequent event and so we should double check whether or not we
    actually do need to trigger a preempt-to-idle by comparing the top
    priorities from each queue. Later, this gives us a hook for finer
    control over deciding whether the preempt-to-idle is justified.
    
    The sequence of events where we end up preempting for no avail is:
    
    1. Queue requests/contexts A, B
    2. Priority boost A; no preemption as it is executing, but keep hint
    3. After CS switch, B is less than hint, force preempt-to-idle
    4. Resubmit B after idling
    
    v2: We can simplify a bunch of tests based on the knowledge that PI will
    ensure that earlier requests along the same context will have the highest
    priority.
    v3: Demonstrate the stale preemption hint with a selftest
    
    References: a2bf92e8 ("drm/i915/execlists: Avoid kicking priority on the current context")
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190129185452.20989-4-chris@chris-wilson.co.uk
    c9a64622
intel_ringbuffer.h 32.8 KB