diff mbox

[13/14] drm/i915: Add stats for GuC log buffer flush interrupts

Message ID 1467485491-17247-14-git-send-email-akash.goel@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

akash.goel@intel.com July 2, 2016, 6:51 p.m. UTC
From: Akash Goel <akash.goel@intel.com>

GuC firmware sends an interrupt to flush the log buffer when it
becomes half full. GuC firmware also tracks how many times the
buffer overflowed.
It would be useful to maintain a statistics of how many flush
interrupts were received and for which type of log buffer,
along with the overflow count of each buffer type.
Augmented i915_log_info debugfs to report back these statistics.

Signed-off-by: Akash Goel <akash.goel@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c        | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_guc_submission.c |  3 +++
 drivers/gpu/drm/i915/i915_irq.c            |  1 +
 drivers/gpu/drm/i915/intel_guc.h           |  5 +++++
 4 files changed, 35 insertions(+)

Comments

Chris Wilson July 3, 2016, 9:44 a.m. UTC | #1
On Sun, Jul 03, 2016 at 12:21:30AM +0530, akash.goel@intel.com wrote:
> From: Akash Goel <akash.goel@intel.com>
> 
> GuC firmware sends an interrupt to flush the log buffer when it
> becomes half full. GuC firmware also tracks how many times the
> buffer overflowed.
> It would be useful to maintain a statistics of how many flush

For what purpose? Would not tracepoints be even more useful?
-Chris
akash.goel@intel.com July 3, 2016, 12:36 p.m. UTC | #2
On 7/3/2016 3:14 PM, Chris Wilson wrote:
> On Sun, Jul 03, 2016 at 12:21:30AM +0530, akash.goel@intel.com wrote:
>> From: Akash Goel <akash.goel@intel.com>
>>
>> GuC firmware sends an interrupt to flush the log buffer when it
>> becomes half full. GuC firmware also tracks how many times the
>> buffer overflowed.
>> It would be useful to maintain a statistics of how many flush
>
> For what purpose? Would not tracepoints be even more useful?
Having a stats would be useful to get an idea of the volume & the rate 
at which logs are being generated from GuC side and whether Driver is 
quick enough to capture all of them.

Yes tracepoint would also be very useful.

Please see below the logging related stats, in the output of
‘i915_guc_info’ on execution of ‘gem_exec_nop’ IGT.

GuC total action count: 623531
GuC action failure count: 0
GuC last action command: 0x30
GuC last action status: 0xf0000000
GuC last action error code: 0

GuC submissions:
         render ring             :    9019910, last seqno 0x01a4390b
         blitter ring            :    6188291, last seqno 0x01a4390d
         bsd ring                :    6179075, last seqno 0x01a4390c
         video enhancement ring  :    6156547, last seqno 0x01a4390e
         Total: 27543823

GuC execbuf client @ ffff8801659fb100:
         Priority 2, GuC ctx index: 0, PD offset 0x800
         Doorbell id 0, offset: 0x0, cookie 0x1a4490f
         WQ size 8192, offset: 0x1000, tail 4336
         Work queue full: 0
         Failed to queue: 0
         Failed doorbell: 0
         Last submission result: 0
         Submissions: 9019910 render ring
         Submissions: 6188291 blitter ring
         Submissions: 6179075 bsd ring
         Submissions: 6156547 video enhancement ring
         Total: 27543823

GuC logging stats:
         ISR:     flush count     321718, overflow count        0
         DPC:     flush count     303788, overflow count        1
         CRASH:   flush count          0, overflow count        0
         Total flush interrupt count: 625511


Best regards
Akash
> -Chris
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 16aeab2..857ce9d 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2542,6 +2542,30 @@  static int i915_guc_load_status_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+static void i915_guc_log_info(struct seq_file *m,
+				 struct drm_i915_private *dev_priv)
+{
+	struct intel_guc *guc = &dev_priv->guc;
+
+	seq_printf(m, "\nGuC logging stats:\n");
+
+	seq_printf(m, "\tISR:   flush count %10u, overflow count %8u\n",
+		guc->log.flush_count[GUC_ISR_LOG_BUFFER],
+		guc->log.overflow_count[GUC_ISR_LOG_BUFFER]);
+
+	seq_printf(m, "\tDPC:   flush count %10u, overflow count %8u\n",
+		guc->log.flush_count[GUC_DPC_LOG_BUFFER],
+		guc->log.overflow_count[GUC_DPC_LOG_BUFFER]);
+
+	seq_printf(m, "\tCRASH: flush count %10u, overflow count %8u\n",
+		guc->log.flush_count[GUC_CRASH_DUMP_LOG_BUFFER],
+		guc->log.overflow_count[GUC_CRASH_DUMP_LOG_BUFFER]);
+
+	seq_printf(m, "\tTotal flush interrupt count: %u\n",
+			guc->log.flush_interrupt_count);
+
+}
+
 static void i915_guc_client_info(struct seq_file *m,
 				 struct drm_i915_private *dev_priv,
 				 struct i915_guc_client *client)
@@ -2615,6 +2639,8 @@  static int i915_guc_info(struct seq_file *m, void *data)
 	seq_printf(m, "\nGuC execbuf client @ %p:\n", guc.execbuf_client);
 	i915_guc_client_info(m, dev_priv, &client);
 
+	i915_guc_log_info(m, dev_priv);
+
 	/* Add more as required ... */
 
 	return 0;
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
index d20df8d..2a192d4 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -907,6 +907,9 @@  static void guc_read_update_log_buffer(struct drm_device *dev, bool capture_all)
 			log_buffer_copy_state++;
 		}
 
+		guc->log.overflow_count[i] = log_buffer_state->buffer_full_cnt;
+		guc->log.flush_count[i] += log_buffer_state->flush_to_file;
+
 		/* Update the read pointer in the shared log buffer */
 		log_buffer_state->read_ptr =
 			log_buffer_state->sampled_write_ptr;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index f1cf36e..e2cbe1e 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1743,6 +1743,7 @@  static void gen9_guc_irq_handler(struct drm_i915_private *dev_priv, u32 gt_iir)
 			queue_work(dev_priv->guc.log.wq,
 					&dev_priv->guc.events_work);
 		}
+		dev_priv->guc.log.flush_interrupt_count++;
 		spin_unlock(&dev_priv->irq_lock);
 	}
 }
diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
index 7cefd81..bd299d3 100644
--- a/drivers/gpu/drm/i915/intel_guc.h
+++ b/drivers/gpu/drm/i915/intel_guc.h
@@ -128,6 +128,11 @@  struct intel_guc_log {
 	struct workqueue_struct *wq;
 	struct rchan *relay_chan;
 	void *buf_addr;
+
+	/* logging related stats */
+	u32 flush_interrupt_count;
+	u32 overflow_count[GUC_MAX_LOG_BUFFER];
+	u32 flush_count[GUC_MAX_LOG_BUFFER];
 };
 
 struct intel_guc {