drm/i915: Fix context runtime accounting
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 20 Mar 2023 15:14:23 +0000 (15:14 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 31 Mar 2023 08:32:53 +0000 (09:32 +0100)
commitb3e70051879c665acdd3a1ab50d0ed58d6a8001f
tree5e4b96f0f2a868c44e76a789e7c7b2140d71c39b
parent9079363eda1ea0d9fa2cc5635e65821d8ed4f994
drm/i915: Fix context runtime accounting

When considering whether to mark one context as stopped and another as
started we need to look at whether the previous and new _contexts_ are
different and not just requests. Otherwise the software tracked context
start time was incorrectly updated to the most recent lite-restore time-
stamp, which was in some cases resulting in active time going backward,
until the context switch (typically the heartbeat pulse) would synchronise
with the hardware tracked context runtime. Easiest use case to observe
this behaviour was with a full screen clients with close to 100% engine
load.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: bb6287cb1886 ("drm/i915: Track context current active time")
Cc: <stable@vger.kernel.org> # v5.19+
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230320151423.1708436-1-tvrtko.ursulin@linux.intel.com
[tursulin: Fix spelling in commit msg.]
drivers/gpu/drm/i915/gt/intel_execlists_submission.c