[Intel-gfx] [PATCH v5 18/18] drm/i915: Watchdog timeout: Export media reset count from GuC to debugfs
Chris Wilson
chris at chris-wilson.co.uk
Sat Mar 25 09:12:54 UTC 2017
On Fri, Mar 24, 2017 at 06:30:10PM -0700, Michel Thierry wrote:
> From firmware v8.8, GuC provides the count of media engine resets
> (watchdog timeout). This information is available in the GuC shared
> context data struct, which resides in the first page of the default
> (kernel) lrc context.
>
> Since GuC handled engine resets are transparent for kernel and user,
> provide a simple debugfs entry to see the number of times media reset
> has happened.
>
> Signed-off-by: Michel Thierry <michel.thierry at intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 28 ++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_guc_fwif.h | 18 ++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 8db850541e03..f40a2c84b423 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1400,6 +1400,32 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused)
> return 0;
> }
>
> +static u32 i915_watchdog_reset_count(struct drm_i915_private *dev_priv)
> +{
> + struct drm_device *dev = &dev_priv->drm;
> + struct i915_gem_context *ctx;
> + struct page *page;
> + struct guc_shared_ctx_data *guc_shared_data;
> + u32 guc_media_reset_count;
> +
> + if (!i915.enable_guc_submission)
> + return 0;
> +
> + if (mutex_lock_interruptible(&dev->struct_mutex))
> + return 0;
Do you need the mutex?
> + ctx = dev_priv->kernel_context;
> + page = i915_gem_object_get_dirty_page(ctx->engine[RCS].state->obj,
> + LRC_GUCSHR_PN);
Are you writing?
> + guc_shared_data = kmap_atomic(page);
Atomic?
> + guc_media_reset_count = guc_shared_data->media_reset_count;
This is an unserialised access, mark it so (READ_ONCE).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list