diff mbox series

drm/i915/perf: Add preemption check while waiting for OA

Message ID 20191114140224.21818-1-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/perf: Add preemption check while waiting for OA | expand

Commit Message

Lionel Landwerlin Nov. 14, 2019, 2:02 p.m. UTC
While we're waiting for the OA configuration to apply, let's give a
chance to other contexts that might need to run other workloads.

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

Comments

Chris Wilson Nov. 14, 2019, 2:42 p.m. UTC | #1
Quoting Lionel Landwerlin (2019-11-14 14:02:24)
> While we're waiting for the OA configuration to apply, let's give a
> chance to other contexts that might need to run other workloads.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  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 31e47ee23357..608e6c3f3c1a 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -1777,6 +1777,8 @@ static int alloc_noa_wait(struct i915_perf_stream *stream)
>         *cs++ = MI_MATH_ADD;
>         *cs++ = MI_MATH_STOREINV(MI_MATH_REG(JUMP_PREDICATE), MI_MATH_REG_CF);
>  
> +       *cs++ = MI_ARB_CHECK;
> +

That's as reasonable a time to check. If we get preempted just before
the end of the wait we do one more loop before exciting. And the loop is
quick enough that it doesn't matter.

So placement of MI_ARB_CHECK is at your convenience (just so long as it
is inside the loop!)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 31e47ee23357..608e6c3f3c1a 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -1777,6 +1777,8 @@  static int alloc_noa_wait(struct i915_perf_stream *stream)
 	*cs++ = MI_MATH_ADD;
 	*cs++ = MI_MATH_STOREINV(MI_MATH_REG(JUMP_PREDICATE), MI_MATH_REG_CF);
 
+	*cs++ = MI_ARB_CHECK;
+
 	/*
 	 * Transfer the result into the predicate register to be used for the
 	 * predicated jump.