Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Matt Roper <matthew.d.roper@intel.com>
Subject: [PATCH v2 2/5] drm/i915/display: Zero-initialize frame/scanline counts in tracepoints
Date: Mon, 23 Sep 2024 16:02:51 -0300	[thread overview]
Message-ID: <20240923190324.83013-3-gustavo.sousa@intel.com> (raw)
In-Reply-To: <20240923190324.83013-1-gustavo.sousa@intel.com>

In an upcoming change, we will also add support for logging
frame/scanline counts for pipe D in relevant tracepoints.

In [1], Matt mentioned the possibility of having garbage in those counts
for pipe D on a platform containing only 3 pipes. Indeed, it has been
verified that the counts for the extra pipe would not be
zero-initialized by the tracing system.

Since it is also possible that the same would happen for a fused-off
pipe, let's go ahead and add the logic to zero-initialize the arrays
now.

[1] https://lore.kernel.org/all/20240918224927.GU5091@mdroper-desk1.amr.corp.intel.com/

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_trace.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
index e70c015a09a1..84526f8df75b 100644
--- a/drivers/gpu/drm/i915/display/intel_display_trace.h
+++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
@@ -9,6 +9,7 @@
 #if !defined(__INTEL_DISPLAY_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
 #define __INTEL_DISPLAY_TRACE_H__
 
+#include <linux/string.h>
 #include <linux/string_helpers.h>
 #include <linux/types.h>
 #include <linux/tracepoint.h>
@@ -36,6 +37,10 @@ TRACE_EVENT(intel_pipe_enable,
 			   struct intel_display *display = to_intel_display(crtc);
 			   struct intel_crtc *it__;
 			   __assign_str(dev);
+			   memset(__entry->frame, 0,
+				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
+			   memset(__entry->scanline, 0,
+				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
 			   for_each_intel_crtc(display->drm, it__) {
 				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
 				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
@@ -65,6 +70,10 @@ TRACE_EVENT(intel_pipe_disable,
 			   struct intel_display *display = to_intel_display(crtc);
 			   struct intel_crtc *it__;
 			   __assign_str(dev);
+			   memset(__entry->frame, 0,
+				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
+			   memset(__entry->scanline, 0,
+				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
 			   for_each_intel_crtc(display->drm, it__) {
 				   __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
 				   __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
@@ -194,6 +203,10 @@ TRACE_EVENT(intel_memory_cxsr,
 	    TP_fast_assign(
 			   struct intel_crtc *crtc;
 			   __assign_str(dev);
+			   memset(__entry->frame, 0,
+				  sizeof(__entry->frame[0]) * I915_MAX_PIPES);
+			   memset(__entry->scanline, 0,
+				  sizeof(__entry->scanline[0]) * I915_MAX_PIPES);
 			   for_each_intel_crtc(display->drm, crtc) {
 				   __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
 				   __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
-- 
2.46.1


  parent reply	other threads:[~2024-09-23 19:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 19:02 [PATCH v2 0/5] Miscelaneous fixes for display tracepoints Gustavo Sousa
2024-09-23 19:02 ` [PATCH v2 1/5] drm/i915/display: Fix out-of-bounds access in pipe-related tracepoints Gustavo Sousa
2024-09-23 19:02 ` Gustavo Sousa [this message]
2024-09-23 19:02 ` [PATCH v2 3/5] drm/i915/display: Store pipe name in trace events Gustavo Sousa
2024-09-23 19:02 ` [PATCH v2 4/5] drm/i915/display: Do not use ids from enum pipe in TP_printk() Gustavo Sousa
2024-09-23 19:02 ` [PATCH v2 5/5] drm/i915/display: Cover all possible pipes " Gustavo Sousa
2024-09-23 19:23   ` Ville Syrjälä
2024-09-23 20:06     ` Gustavo Sousa
2024-09-23 20:18       ` Ville Syrjälä
2024-09-23 20:47         ` Gustavo Sousa
2024-09-23 20:48           ` Gustavo Sousa
2024-09-23 21:08             ` Ville Syrjälä
2024-09-26 19:26 ` ✗ Fi.CI.CHECKPATCH: warning for Miscelaneous fixes for display tracepoints (rev2) Patchwork
2024-09-26 19:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-10-04 11:12   ` Gustavo Sousa
2024-10-04 11:33     ` Jani Nikula
2024-10-04 11:43       ` Gustavo Sousa
2024-10-04 12:03         ` Saarinen, Jani
2024-10-04 12:09           ` Saarinen, Jani
2024-10-08 19:46 ` ✗ Fi.CI.CHECKPATCH: warning for Miscelaneous fixes for display tracepoints (rev3) Patchwork
2024-10-08 19:55 ` ✗ Fi.CI.BAT: failure " Patchwork

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=20240923190324.83013-3-gustavo.sousa@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox