|
@@ -2740,34 +2740,38 @@ i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static bool ban_context(const struct i915_gem_context *ctx)
|
|
|
|
|
|
+static bool ban_context(const struct i915_gem_context *ctx,
|
|
|
|
+ unsigned int score)
|
|
{
|
|
{
|
|
return (i915_gem_context_is_bannable(ctx) &&
|
|
return (i915_gem_context_is_bannable(ctx) &&
|
|
- ctx->ban_score >= CONTEXT_SCORE_BAN_THRESHOLD);
|
|
|
|
|
|
+ score >= CONTEXT_SCORE_BAN_THRESHOLD);
|
|
}
|
|
}
|
|
|
|
|
|
static void i915_gem_context_mark_guilty(struct i915_gem_context *ctx)
|
|
static void i915_gem_context_mark_guilty(struct i915_gem_context *ctx)
|
|
{
|
|
{
|
|
- ctx->guilty_count++;
|
|
|
|
- ctx->ban_score += CONTEXT_SCORE_GUILTY;
|
|
|
|
- if (ban_context(ctx))
|
|
|
|
- i915_gem_context_set_banned(ctx);
|
|
|
|
|
|
+ unsigned int score;
|
|
|
|
+ bool banned;
|
|
|
|
|
|
- DRM_DEBUG_DRIVER("context %s marked guilty (score %d) banned? %s\n",
|
|
|
|
- ctx->name, ctx->ban_score,
|
|
|
|
- yesno(i915_gem_context_is_banned(ctx)));
|
|
|
|
|
|
+ atomic_inc(&ctx->guilty_count);
|
|
|
|
|
|
- if (!i915_gem_context_is_banned(ctx) || IS_ERR_OR_NULL(ctx->file_priv))
|
|
|
|
|
|
+ score = atomic_add_return(CONTEXT_SCORE_GUILTY, &ctx->ban_score);
|
|
|
|
+ banned = ban_context(ctx, score);
|
|
|
|
+ DRM_DEBUG_DRIVER("context %s marked guilty (score %d) banned? %s\n",
|
|
|
|
+ ctx->name, score, yesno(banned));
|
|
|
|
+ if (!banned)
|
|
return;
|
|
return;
|
|
|
|
|
|
- ctx->file_priv->context_bans++;
|
|
|
|
- DRM_DEBUG_DRIVER("client %s has had %d context banned\n",
|
|
|
|
- ctx->name, ctx->file_priv->context_bans);
|
|
|
|
|
|
+ i915_gem_context_set_banned(ctx);
|
|
|
|
+ if (!IS_ERR_OR_NULL(ctx->file_priv)) {
|
|
|
|
+ atomic_inc(&ctx->file_priv->context_bans);
|
|
|
|
+ DRM_DEBUG_DRIVER("client %s has had %d context banned\n",
|
|
|
|
+ ctx->name, atomic_read(&ctx->file_priv->context_bans));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static void i915_gem_context_mark_innocent(struct i915_gem_context *ctx)
|
|
static void i915_gem_context_mark_innocent(struct i915_gem_context *ctx)
|
|
{
|
|
{
|
|
- ctx->active_count++;
|
|
|
|
|
|
+ atomic_inc(&ctx->active_count);
|
|
}
|
|
}
|
|
|
|
|
|
struct drm_i915_gem_request *
|
|
struct drm_i915_gem_request *
|