• Tvrtko Ursulin's avatar
    drm/i915: Engine busy time tracking · 30e17b78
    Tvrtko Ursulin authored
    Track total time requests have been executing on the hardware.
    
    We add new kernel API to allow software tracking of time GPU
    engines are spending executing requests.
    
    Both per-engine and global API is added with the latter also
    being exported for use by external users.
    
    v2:
     * Squashed with the internal API.
     * Dropped static key.
     * Made per-engine.
     * Store time in monotonic ktime.
    
    v3: Moved stats clearing to disable.
    
    v4:
     * Comments.
     * Don't export the API just yet.
    
    v5: Whitespace cleanup.
    
    v6:
     * Rename ref to active.
     * Drop engine aggregate stats for now.
     * Account initial busy period after enabling stats.
    
    v7:
     * Rebase.
    
    v8:
     * Move context in notification after the notifier. (Chris Wilson)
    
    v9:
    
    In cases where stats tracking is getting disabled while there is
    an active context on an engine, add up the current value to the
    total. This also implies we don't clear the total when tracking
    is disabled any longer. There is no real need to do so because
    we define the stats as relative while enabled, meaning
    comparison between two samples while tracking is enabled is the
    valid usage. However, when busy stats will later be plugged into
    the perf PMU API, it is beneficial to not reset the total, since
    the PMU core likes to do some counter disable/enable cycles on
    startup, and while doing so during a single long context
    executing on an engine we would lose some accuracy and so make
    unit testing more difficult than needs to be.
    
    v10:
     * Fix accounting for preemption.
    
    v11:
     * Rebase for i915_modparams.enable_execlists removal.
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Link: https://patchwork.freedesktop.org/patch/msgid/20171121181852.16128-5-tvrtko.ursulin@linux.intel.com
    30e17b78
intel_ringbuffer.h 32.9 KB