mirror of https://gitee.com/openkylin/linux.git
drm/i915: Use i915_hw_context to set reset stats
With full ppgtt support drm_i915_file_private gained knowledge about the default context. Also reset stats are now inside i915_hw_context so we can use proper abstraction. v2: Move BUG_ON and WARN_ON to more proper locations (Ben) v3: Pass dev directly to i915_context_is_banned to avoid the need to dereference ctx->last_ring. Spotted by Mika when checking my s/BUG/WARN/ change, I've missed this ->last_ring dereference. Suggested-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> (v2) Reviewed-by: Ben Widawsky <ben@bwidawsk.net> (v2) [danvet: s/BUG/WARN/] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
116f2b6da8
commit
44e2c0705a
|
@ -2305,11 +2305,15 @@ static bool i915_request_guilty(struct drm_i915_gem_request *request,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool i915_context_is_banned(const struct i915_ctx_hang_stats *hs)
|
static bool i915_context_is_banned(struct drm_device *dev,
|
||||||
|
const struct i915_hw_context *ctx)
|
||||||
{
|
{
|
||||||
const unsigned long elapsed = get_seconds() - hs->guilty_ts;
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||||
|
unsigned long elapsed;
|
||||||
|
|
||||||
if (hs->banned)
|
elapsed = get_seconds() - ctx->hang_stats.guilty_ts;
|
||||||
|
|
||||||
|
if (ctx->hang_stats.banned)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (elapsed <= DRM_I915_CTX_BAN_PERIOD) {
|
if (elapsed <= DRM_I915_CTX_BAN_PERIOD) {
|
||||||
|
@ -2324,9 +2328,13 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring,
|
||||||
struct drm_i915_gem_request *request,
|
struct drm_i915_gem_request *request,
|
||||||
u32 acthd)
|
u32 acthd)
|
||||||
{
|
{
|
||||||
struct i915_ctx_hang_stats *hs = NULL;
|
|
||||||
bool inside, guilty;
|
bool inside, guilty;
|
||||||
unsigned long offset = 0;
|
unsigned long offset = 0;
|
||||||
|
struct i915_hw_context *ctx = request->ctx;
|
||||||
|
struct i915_ctx_hang_stats *hs;
|
||||||
|
|
||||||
|
if (WARN_ON(!ctx))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Innocent until proven guilty */
|
/* Innocent until proven guilty */
|
||||||
guilty = false;
|
guilty = false;
|
||||||
|
@ -2341,28 +2349,22 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring,
|
||||||
ring->name,
|
ring->name,
|
||||||
inside ? "inside" : "flushing",
|
inside ? "inside" : "flushing",
|
||||||
offset,
|
offset,
|
||||||
request->ctx ? request->ctx->id : 0,
|
ctx->id,
|
||||||
acthd);
|
acthd);
|
||||||
|
|
||||||
guilty = true;
|
guilty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If contexts are disabled or this is the default context, use
|
WARN_ON(!ctx->last_ring);
|
||||||
* file_priv->reset_state
|
|
||||||
*/
|
|
||||||
if (request->ctx && request->ctx->id != DEFAULT_CONTEXT_ID)
|
|
||||||
hs = &request->ctx->hang_stats;
|
|
||||||
else if (request->file_priv)
|
|
||||||
hs = &request->file_priv->private_default_ctx->hang_stats;
|
|
||||||
|
|
||||||
if (hs) {
|
hs = &ctx->hang_stats;
|
||||||
if (guilty) {
|
|
||||||
hs->banned = i915_context_is_banned(hs);
|
if (guilty) {
|
||||||
hs->batch_active++;
|
hs->banned = i915_context_is_banned(ring->dev, ctx);
|
||||||
hs->guilty_ts = get_seconds();
|
hs->batch_active++;
|
||||||
} else {
|
hs->guilty_ts = get_seconds();
|
||||||
hs->batch_pending++;
|
} else {
|
||||||
}
|
hs->batch_pending++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue