Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John.C.Harrison@Intel.com
To: Intel-Xe@Lists.FreeDesktop.Org
Cc: "John Harrison" <John.C.Harrison@Intel.com>,
	"kernel test robot" <lkp@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Oded Gabbay" <ogabbay@kernel.org>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Matt Roper" <matthew.d.roper@intel.com>,
	"Michal Wajdeczko" <michal.wajdeczko@intel.com>,
	"Fei Yang" <fei.yang@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: [PATCH] drm/xe/guc: Fix uninitialised count in GuC load debug prints
Date: Fri, 24 May 2024 13:26:03 -0700	[thread overview]
Message-ID: <20240524202603.4011656-1-John.C.Harrison@Intel.com> (raw)

From: John Harrison <John.C.Harrison@Intel.com>

The debug prints about how long the GuC load takes have a loop
counter. However that was neither initialised nor incremented! Plus,
counting loops is no longer meaningful given the wait function returns
early for any change in the status value. So fix it to only count
loops due to actual timeouts.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405250151.IbH0l8FG-lkp@intel.com/
Fixes: b0ac1b42dbdc ("drm/xe/guc: Port over the slow GuC loading support from i915")
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Fei Yang <fei.yang@intel.com>
Cc: intel-xe@lists.freedesktop.org
---
 drivers/gpu/drm/xe/xe_guc.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index f7886c00af01..086a048876ba 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -591,7 +591,7 @@ static void guc_wait_ucode(struct xe_guc *guc)
 	ktime_t before, after, delta;
 	int load_done;
 	u32 status = 0;
-	int count;
+	int count = 0;
 	u64 delta_ms;
 	u32 before_freq;
 
@@ -604,6 +604,7 @@ static void guc_wait_ucode(struct xe_guc *guc)
 	 */
 	do {
 		u32 last_status = status & (GS_UKERNEL_MASK | GS_BOOTROM_MASK);
+		int ret;
 
 		/*
 		 * Wait for any change (intermediate or terminal) in the status register.
@@ -612,9 +613,10 @@ static void guc_wait_ucode(struct xe_guc *guc)
 		 * timeouts rather than allowing a huge timeout each time. So basically, need
 		 * to treat a timeout no different to a value change.
 		 */
-		xe_mmio_wait32_not(gt, GUC_STATUS, GS_UKERNEL_MASK | GS_BOOTROM_MASK,
-				   last_status, 1000 * 1000, &status, false);
-
+		ret = xe_mmio_wait32_not(gt, GUC_STATUS, GS_UKERNEL_MASK | GS_BOOTROM_MASK,
+					 last_status, 1000 * 1000, &status, false);
+		if (ret < 0)
+			count++;
 		after = ktime_get();
 		delta = ktime_sub(after, before);
 		delta_ms = ktime_to_ms(delta);
@@ -626,7 +628,7 @@ static void guc_wait_ucode(struct xe_guc *guc)
 		if (delta_ms >= (GUC_LOAD_RETRY_LIMIT * 1000))
 			break;
 
-		xe_gt_dbg(gt, "load still in progress, count = %d, freq = %dMHz (req %dMHz), status = 0x%08X [0x%02X/%02X]\n",
+		xe_gt_dbg(gt, "load still in progress, timeouts = %d, freq = %dMHz (req %dMHz), status = 0x%08X [0x%02X/%02X]\n",
 			  count, xe_guc_pc_get_act_freq(guc_pc),
 			  guc_pc_get_cur_freq(guc_pc), status,
 			  REG_FIELD_GET(GS_BOOTROM_MASK, status),
@@ -678,13 +680,13 @@ static void guc_wait_ucode(struct xe_guc *guc)
 
 		xe_device_declare_wedged(gt_to_xe(gt));
 	} else if (delta_ms > GUC_LOAD_TIME_WARN_MS) {
-		xe_gt_warn(gt, "excessive init time: %lldms! [status = 0x%08X, count = %d]\n",
+		xe_gt_warn(gt, "excessive init time: %lldms! [status = 0x%08X, timeouts = %d]\n",
 			   delta_ms, status, count);
 		xe_gt_warn(gt, "excessive init time: [freq = %dMHz (req = %dMHz), before = %dMHz, perf_limit_reasons = 0x%08X]\n",
 			   xe_guc_pc_get_act_freq(guc_pc), guc_pc_get_cur_freq(guc_pc),
 			   before_freq, xe_gt_throttle_get_limit_reasons(gt));
 	} else {
-		xe_gt_dbg(gt, "init took %lldms, freq = %dMHz (req = %dMHz), before = %dMHz, status = 0x%08X, count = %d\n",
+		xe_gt_dbg(gt, "init took %lldms, freq = %dMHz (req = %dMHz), before = %dMHz, status = 0x%08X, timeouts = %d\n",
 			  delta_ms, xe_guc_pc_get_act_freq(guc_pc), guc_pc_get_cur_freq(guc_pc),
 			  before_freq, status, count);
 	}
-- 
2.43.2


             reply	other threads:[~2024-05-24 20:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 20:26 John.C.Harrison [this message]
2024-05-24 20:32 ` ✓ CI.Patch_applied: success for drm/xe/guc: Fix uninitialised count in GuC load debug prints Patchwork
2024-05-24 20:32 ` ✓ CI.checkpatch: " Patchwork
2024-05-24 20:33 ` ✓ CI.KUnit: " Patchwork
2024-05-24 20:45 ` ✓ CI.Build: " Patchwork
2024-05-24 20:47 ` ✓ CI.Hooks: " Patchwork
2024-05-24 20:49 ` ✓ CI.checksparse: " Patchwork
2024-05-24 21:20 ` ✗ CI.BAT: failure " Patchwork
2024-05-24 22:51 ` [PATCH] " Matt Roper
2024-05-27 13:45 ` ✗ CI.FULL: failure for " Patchwork
2024-05-28 20:17   ` John Harrison

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=20240524202603.4011656-1-John.C.Harrison@Intel.com \
    --to=john.c.harrison@intel.com \
    --cc=Intel-Xe@Lists.FreeDesktop.Org \
    --cc=fei.yang@intel.com \
    --cc=lkp@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=ogabbay@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.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