From patchwork Wed Jul 16 16:22:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Ceraolo Spurio X-Patchwork-Id: 4568401 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5AD36C0514 for ; Wed, 16 Jul 2014 16:26:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76629200FF for ; Wed, 16 Jul 2014 16:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7C0132018E for ; Wed, 16 Jul 2014 16:26:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18CC96E628; Wed, 16 Jul 2014 09:26:11 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 739076E628 for ; Wed, 16 Jul 2014 09:26:10 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 16 Jul 2014 09:19:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,673,1400050800"; d="scan'208";a="562741615" Received: from dceraolo-linux.iwi.intel.com ([172.28.253.73]) by fmsmga001.fm.intel.com with ESMTP; 16 Jul 2014 09:23:35 -0700 From: daniele.ceraolospurio@intel.com To: intel-gfx@lists.freedesktop.org Date: Wed, 16 Jul 2014 17:22:39 +0100 Message-Id: <1405527759-957-4-git-send-email-daniele.ceraolospurio@intel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1405527759-957-1-git-send-email-daniele.ceraolospurio@intel.com> References: <1405527759-957-1-git-send-email-daniele.ceraolospurio@intel.com> Subject: [Intel-gfx] [RFC v2 3/3] drm/i915: Trace point callbacks for validation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniele Ceraolo Spurio 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 --- 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 133da7b..9fc81a2 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 6b0dd9f..e5daef10 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 +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 d639d6c..a16e29c 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, @@ -394,6 +406,10 @@ TRACE_EVENT(i915_gem_ring_dispatch_validation, __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); ), TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x, vm=%p", @@ -630,6 +646,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", @@ -650,6 +669,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)