[Intel-gfx] [PATCH 1/2] drm/i915/selftests: Split preemption smoke test into threads

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 27 09:02:52 UTC 2018


Quoting Chris Wilson (2018-09-27 09:49:39)
> When submitting chains to each engine, we can do so (mostly) in
> parallel, so delegate submission to threads on a per-engine basis.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/selftests/intel_lrc.c | 71 ++++++++++++++++++----
>  1 file changed, 59 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> index 3a474bb64c05..2ab142c9d9c2 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> @@ -587,8 +587,10 @@ static int random_priority(struct rnd_state *rnd)
>  struct preempt_smoke {
>         struct drm_i915_private *i915;
>         struct i915_gem_context **contexts;
> +       struct intel_engine_cs *engine;
>         unsigned int ncontext;
>         struct rnd_state prng;
> +       unsigned long count;
>  };
>  
>  static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
> @@ -597,31 +599,76 @@ static struct i915_gem_context *smoke_context(struct preempt_smoke *smoke)
>                                                           &smoke->prng)];
>  }
>  
> +static int smoke_crescendo_thread(void *arg)
> +{
> +       struct preempt_smoke *smoke = arg;
> +       IGT_TIMEOUT(end_time);
> +       unsigned long count;
> +
> +       count = 0;
> +       do {
> +               struct i915_gem_context *ctx = smoke_context(smoke);
> +               struct i915_request *rq;
> +
> +               ctx->sched.priority = count % I915_PRIORITY_MAX;
> +
> +               mutex_lock(&smoke->i915->drm.struct_mutex);

Shared ctx, I should move the priority under the lock.
-Chris


More information about the Intel-gfx mailing list