Commit a4c969d1 authored by Chris Wilson's avatar Chris Wilson

drm/i915/perf: Set the exclusive stream under perf->lock

The BKL struct_mutex is no more, the only serialisation we required for
setting the exclusive stream is already managed by ce->pin_mutex in
gen8_configure_all_contexts(). As such, we can manipulate
i915_perf.exclusive_stream underneath our own (already held) perf->lock.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191007140812.10963-2-chris@chris-wilson.co.uk
Link: https://patchwork.freedesktop.org/patch/msgid/20191007210942.18145-2-chris@chris-wilson.co.uk
parent 8f8b1171
...@@ -1343,10 +1343,8 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) ...@@ -1343,10 +1343,8 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
* Unset exclusive_stream first, it will be checked while disabling * Unset exclusive_stream first, it will be checked while disabling
* the metric set on gen8+. * the metric set on gen8+.
*/ */
mutex_lock(&perf->i915->drm.struct_mutex);
perf->exclusive_stream = NULL; perf->exclusive_stream = NULL;
perf->ops.disable_metric_set(stream); perf->ops.disable_metric_set(stream);
mutex_unlock(&perf->i915->drm.struct_mutex);
free_oa_buffer(stream); free_oa_buffer(stream);
...@@ -1853,7 +1851,7 @@ static int gen8_configure_all_contexts(struct i915_perf_stream *stream, ...@@ -1853,7 +1851,7 @@ static int gen8_configure_all_contexts(struct i915_perf_stream *stream,
for (i = 2; i < ARRAY_SIZE(regs); i++) for (i = 2; i < ARRAY_SIZE(regs); i++)
regs[i].value = oa_config_flex_reg(oa_config, regs[i].reg); regs[i].value = oa_config_flex_reg(oa_config, regs[i].reg);
lockdep_assert_held(&i915->drm.struct_mutex); lockdep_assert_held(&stream->perf->lock);
/* /*
* The OA register config is setup through the context image. This image * The OA register config is setup through the context image. This image
...@@ -2220,10 +2218,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -2220,10 +2218,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
if (ret) if (ret)
goto err_oa_buf_alloc; goto err_oa_buf_alloc;
ret = i915_mutex_lock_interruptible(&stream->perf->i915->drm);
if (ret)
goto err_lock;
stream->ops = &i915_oa_stream_ops; stream->ops = &i915_oa_stream_ops;
perf->exclusive_stream = stream; perf->exclusive_stream = stream;
...@@ -2233,8 +2227,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -2233,8 +2227,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
goto err_enable; goto err_enable;
} }
mutex_unlock(&stream->perf->i915->drm.struct_mutex);
hrtimer_init(&stream->poll_check_timer, hrtimer_init(&stream->poll_check_timer,
CLOCK_MONOTONIC, HRTIMER_MODE_REL); CLOCK_MONOTONIC, HRTIMER_MODE_REL);
stream->poll_check_timer.function = oa_poll_check_timer_cb; stream->poll_check_timer.function = oa_poll_check_timer_cb;
...@@ -2246,9 +2238,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -2246,9 +2238,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
err_enable: err_enable:
perf->exclusive_stream = NULL; perf->exclusive_stream = NULL;
perf->ops.disable_metric_set(stream); perf->ops.disable_metric_set(stream);
mutex_unlock(&stream->perf->i915->drm.struct_mutex);
err_lock:
free_oa_buffer(stream); free_oa_buffer(stream);
err_oa_buf_alloc: err_oa_buf_alloc:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment