diff mbox series

[03/20] drm/i915/perf: Manually acquire engine-wakeref around use of kernel_context

Message ID 20200227085723.1961649-3-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/20] drm/i915: Skip barriers inside waits | expand

Commit Message

Chris Wilson Feb. 27, 2020, 8:57 a.m. UTC
The engine->kernel_context is a special case for request emission. Since
it is used as the barrier within the engine's wakeref, we must acquire the
wakeref before submitting a request to the kernel_context.

Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mika Kuoppala Feb. 28, 2020, 11:53 a.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> The engine->kernel_context is a special case for request emission. Since
> it is used as the barrier within the engine's wakeref, we must acquire the
> wakeref before submitting a request to the kernel_context.

I am a bit surprised that the kernel ctx is used in this capacity...

>
> Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_perf.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 0838a12e2dc5..2334c45f1d08 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2196,7 +2196,9 @@ static int gen8_modify_self(struct intel_context *ce,
>  	struct i915_request *rq;
>  	int err;
>  
> +	intel_engine_pm_get(ce->engine);
>  	rq = i915_request_create(ce);
> +	intel_engine_pm_put(ce->engine);
>  	if (IS_ERR(rq))
>  		return PTR_ERR(rq);
>  
> -- 
> 2.25.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Feb. 28, 2020, 11:56 a.m. UTC | #2
Quoting Mika Kuoppala (2020-02-28 11:53:06)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > The engine->kernel_context is a special case for request emission. Since
> > it is used as the barrier within the engine's wakeref, we must acquire the
> > wakeref before submitting a request to the kernel_context.
> 
> I am a bit surprised that the kernel ctx is used in this capacity...

I am happy that you are surprised, and I hope you quickly forget and
return to your happy innocence. :)
-Chris
Mika Kuoppala Feb. 28, 2020, 12:18 p.m. UTC | #3
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Quoting Mika Kuoppala (2020-02-28 11:53:06)
>> Chris Wilson <chris@chris-wilson.co.uk> writes:
>> 
>> > The engine->kernel_context is a special case for request emission. Since
>> > it is used as the barrier within the engine's wakeref, we must acquire the
>> > wakeref before submitting a request to the kernel_context.
>> 
>> I am a bit surprised that the kernel ctx is used in this capacity...
>
> I am happy that you are surprised, and I hope you quickly forget and
> return to your happy innocence. :)

I am surprised in a same way when looking at people who enjoys playing
games with other elemental building blocks...like for example hydrogen.
Yes I am happy to leave the premises. Good luck.

-Mika

> -Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 0838a12e2dc5..2334c45f1d08 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2196,7 +2196,9 @@  static int gen8_modify_self(struct intel_context *ce,
 	struct i915_request *rq;
 	int err;
 
+	intel_engine_pm_get(ce->engine);
 	rq = i915_request_create(ce);
+	intel_engine_pm_put(ce->engine);
 	if (IS_ERR(rq))
 		return PTR_ERR(rq);