All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: daniele.ceraolospurio@intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915: Trace point callbacks for validation
Date: Mon, 7 Jul 2014 22:36:41 +0200	[thread overview]
Message-ID: <20140707203641.GB17271@phenom.ffwll.local> (raw)
In-Reply-To: <1404231863-14127-3-git-send-email-daniele.ceraolospurio@intel.com>

On Tue, Jul 01, 2014 at 05:24:23PM +0100, daniele.ceraolospurio@intel.com wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> These callbacks can be assigned to specific functions inside an external
> validation kernel module. This module can then extract run-time
> information to make sure everything is working as expected.
> 
> Specifically, these two callbacks extract information about full PPGTT
> and batch dispatch.
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c    |  3 +++
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c |  3 +++
>  drivers/gpu/drm/i915/i915_trace.h          | 22 ++++++++++++++++++++++
>  3 files changed, 28 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 99f7022..120a319 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -90,6 +90,9 @@
>  #include "i915_drv.h"
>  #include "i915_trace.h"
>  
> +i915_ppgtt_validation_callback_t ppgtt_validation_callback = NULL;
> +EXPORT_SYMBOL_GPL(ppgtt_validation_callback);
> +
>  /* This is a HW constraint. The value below is the largest known requirement
>   * I've seen in a spec to date, and that was a workaround for a non-shipping
>   * part. It should be safe to decrease this, but it's more future proof as is.
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 0b2b76e..7feb977 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -33,6 +33,9 @@
>  #include "intel_drv.h"
>  #include <linux/dma_remapping.h>
>  
> +i915_gem_ring_dispatch_callback_t i915_gem_ring_dispatch_validation_callback = NULL;
> +EXPORT_SYMBOL_GPL(i915_gem_ring_dispatch_validation_callback);
> +
>  #define  __EXEC_OBJECT_HAS_PIN (1<<31)
>  #define  __EXEC_OBJECT_HAS_FENCE (1<<30)
>  #define  __EXEC_OBJECT_NEEDS_BIAS (1<<28)
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index 4e73e3a..98c6f47 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -15,6 +15,18 @@
>  #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
>  #define TRACE_INCLUDE_FILE i915_trace
>  
> +/* validation callbacks */
> +
> +typedef void (*i915_ppgtt_validation_callback_t)(unsigned int action_code,
> +						 struct i915_hw_ppgtt *ppgtt);
> +extern i915_ppgtt_validation_callback_t ppgtt_validation_callback;
> +
> +typedef void (*i915_gem_ring_dispatch_callback_t)(struct intel_engine_cs *ring,
> +						  u32 seqno,
> +						  u32 flags,
> +						  struct intel_context *ctx);
> +extern i915_gem_ring_dispatch_callback_t i915_gem_ring_dispatch_validation_callback;
> +
>  /* pipe updates */
>  
>  TRACE_EVENT(i915_pipe_update_start,
> @@ -371,6 +383,10 @@ TRACE_EVENT(i915_gem_ring_dispatch,
>  			   __entry->flags = flags;
>  			   __entry->vm = ctx->vm;
>  			   i915_trace_irq_get(ring, seqno);
> +
> +			   if (i915_gem_ring_dispatch_validation_callback)
> +				   i915_gem_ring_dispatch_validation_callback(ring,
> +						      seqno, flags, ctx);

Nack on two grounds:
- I already get flames for the irq_get in here from the tracepoint
  maintainer - he really doesn't like us adding randome stuff with
  side-effects here.
- If we want extended validation interfaces we should upstream those, not
  just the hooks.

Cheers, Daniel

>  			   ),
>  
>  	    TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x, vm=%p",
> @@ -607,6 +623,9 @@ TRACE_EVENT(create_vm_for_ctx,
>  			__entry->vm = &ppgtt->base;
>  			__entry->dev = ppgtt->base.dev->primary->index;
>  			__entry->pid = (unsigned int)task_pid_nr(current);
> +
> +			if (ppgtt_validation_callback)
> +				ppgtt_validation_callback(0, ppgtt);
>  	),
>  
>  	TP_printk("dev=%u, task_pid=%u, vm=%p",
> @@ -627,6 +646,9 @@ TRACE_EVENT(ppgtt_release,
>  	TP_fast_assign(
>  		__entry->vm = &ppgtt->base;
>  		__entry->dev = ppgtt->base.dev->primary->index;
> +
> +		if (ppgtt_validation_callback)
> +			ppgtt_validation_callback(1, ppgtt);
>  	),
>  
>  	TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-07-07 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01 16:24 [PATCH 1/3] drm/i915: Add ppgtt init/release trace points daniele.ceraolospurio
2014-07-01 16:24 ` [PATCH 2/3] drm/i915: Add ctx param to i915_gem_ring_dispatch trace point daniele.ceraolospurio
2014-07-01 16:24 ` [PATCH 3/3] drm/i915: Trace point callbacks for validation daniele.ceraolospurio
2014-07-07 20:36   ` Daniel Vetter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-18 16:16 [PATCH 1/3] drm/i915: Add ppgtt init/release trace points oscar.mateo
2014-06-18 16:16 ` [PATCH 3/3] drm/i915: Trace point callbacks for validation oscar.mateo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140707203641.GB17271@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.