[Intel-gfx] [igt-dev] [PATCH i-g-t 4/4] tests/gem_media_vme: Shut down half of subslices to avoid gpu hang on ICL

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Jan 8 14:53:27 UTC 2019


Quoting Tvrtko Ursulin (2019-01-08 13:24:50)
> From: Tony Ye <tony.ye at intel.com>
> 
> On Icelake we need to turn off subslices not containing the VME block or
> the VME kernel will hang.
> 
> v2: (Tvrtko Ursulin)
>  * Remove libdrm usage for setting context param.
>  * Cleanup bitmask operation.
>  * Only apply the workaround for ICL.
> 
> v3: (Tvrtko Ursulin)
>  * Added hang detector. (Chris Wilson)
> 
> v4: (Tvrtko Ursulin)
>  * Rebase for hang detector moved to previous patch.
>  * Tidy curly braces.
> 
> Signed-off-by: Tony Ye <tony.ye at intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Tony Ye <tony.ye at intel.com>
> ---
>  lib/gpu_cmds.c             | 12 ++++++++
>  lib/gpu_cmds.h             |  3 ++
>  lib/media_fill.c           |  2 +-
>  tests/i915/gem_media_vme.c | 60 ++++++++++++++++++++++++++++++++++++++
>  4 files changed, 76 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
> index b490a63bdfef..8d270ee86229 100644
> --- a/lib/gpu_cmds.c
> +++ b/lib/gpu_cmds.c
> @@ -36,6 +36,18 @@ gen7_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
>         igt_assert(ret == 0);
>  }
>  
> +void
> +gen7_render_context_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> +{
> +       int ret;
> +
> +       ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> +       if (ret == 0)
> +               ret = drm_intel_gem_bo_context_exec(batch->bo, batch->ctx,
> +                               batch_end, 0);
> +       igt_assert(ret == 0);
> +}
> +
>  uint32_t
>  gen7_fill_curbe_buffer_data(struct intel_batchbuffer *batch,
>                             uint8_t color)
> diff --git a/lib/gpu_cmds.h b/lib/gpu_cmds.h
> index ca671fb52daf..1321af446161 100644
> --- a/lib/gpu_cmds.h
> +++ b/lib/gpu_cmds.h
> @@ -40,6 +40,9 @@
>  void
>  gen7_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
>  
> +void
> +gen7_render_context_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> +
>  uint32_t
>  gen7_fill_curbe_buffer_data(struct intel_batchbuffer *batch,
>                         uint8_t color);
> diff --git a/lib/media_fill.c b/lib/media_fill.c
> index b1e84727394a..03b5e71e101b 100644
> --- a/lib/media_fill.c
> +++ b/lib/media_fill.c
> @@ -338,7 +338,7 @@ __gen11_media_vme_func(struct intel_batchbuffer *batch,
>         batch_end = intel_batchbuffer_align(batch, 8);
>         assert(batch_end < BATCH_STATE_SPLIT);
>  
> -       gen7_render_flush(batch, batch_end);
> +       gen7_render_context_flush(batch, batch_end);
>         intel_batchbuffer_reset(batch);
>  }

Above hunks could be in the previous patch, too?

> +static void shut_non_vme_subslices(int drm_fd, uint32_t ctx)
> +{
> +       struct drm_i915_gem_context_param_sseu sseu = { };
> +       struct drm_i915_gem_context_param arg = {
> +               .param = I915_CONTEXT_PARAM_SSEU,
> +               .ctx_id = ctx,
> +               .size = sizeof(sseu),
> +               .value = to_user_pointer(&sseu),
> +       };
> +       int ret;
> +
> +       if (__gem_context_get_param(drm_fd, &arg))
> +               return; /* no sseu support */

I guess we could fail at this point already, but maybe there will be a
surprise ICL stepping to prove me wrong :)

> +
> +       ret = __gem_context_set_param(drm_fd, &arg);
> +       igt_assert(ret == 0 || ret == -ENODEV || ret == -EINVAL);
> +       if (ret)
> +               return; /* no sseu support */
> +
> +       /* shutdown half subslices*/

space before */

With the hunk moved or not.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas

> +       sseu.subslice_mask =
> +               switch_off_n_bits(sseu.subslice_mask,
> +                                 __builtin_popcount(sseu.subslice_mask) / 2);
> +
> +       gem_context_set_param(drm_fd, &arg);
> +}


More information about the Intel-gfx mailing list