Re: [PATCH v3] drm/i915/selftests: Exercise context switching in parallel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Chris Wilson (2019-09-30 15:15:22)
> We currently test context switching on each engine as a basic stress
> test (just verifying that nothing explodes if we execute 2 requests from
> different contexts sequentially). What we have not tested is what
> happens if we try and do so on all available engines simultaneously,
> putting our SW and the HW under the maximal stress.
> 
> v2: Clone the set of engines from the first context into the secondary
> contexts.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> ---

> +static int live_parallel_switch(void *arg)
> +{
> +       struct drm_i915_private *i915 = arg;
> +       static int (* const func[])(void *arg) = {
> +               __live_parallel_switch1,
> +               __live_parallel_switchN,
> +               NULL,
> +       };
> +       struct i915_gem_engines *engines;
> +       struct i915_gem_engines_iter it;
> +       int (* const *fn)(void *arg);
> +       struct parallel_switch *data;
> +       struct i915_gem_context *ctx;
> +       struct intel_context *ce;
> +       struct drm_file *file;
> +       int n, m, count;
> +       int err = 0;
> +
> +       /*
> +        * Check we can process switches on all engines simultaneously.
> +        */
> +
> +       if (!DRIVER_CAPS(i915)->has_logical_contexts)
> +               return 0;
> +
> +       file = mock_file(i915);
> +       if (IS_ERR(file))
> +               return PTR_ERR(file);
> +
> +       mutex_lock(&i915->drm.struct_mutex);
> +
> +       ctx = live_context(i915, file);
> +       if (IS_ERR(ctx)) {
> +               err = PTR_ERR(ctx);
> +               goto out_locked;

This needs data = NULL to be safe.
...

> +       mutex_lock(&i915->drm.struct_mutex);
> +out_locked:
> +       for (n = 0; n < count; n++) {
> +               for (m = 0; m < ARRAY_SIZE(data->ce); m++) {
> +                       if (!data[n].ce[m])
> +                               continue;
> +
> +                       intel_context_unpin(data[n].ce[m]);
> +                       intel_context_put(data[n].ce[m]);
> +               }
> +       }
> +       mutex_unlock(&i915->drm.struct_mutex);
> +       kfree(data);
> +       mock_file_free(i915, file);
> +       return err;
> +}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux