Skip to contentSkip to conversation

drm/i915/guc: Add GuC Load time to dmesg log.

PATCH In review Anusha Srivatsa 5 participants 12 messages Nov 1, 2017 – Nov 2, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915/guc: Add GuC Load time to dmesg log.

Calculate the time that GuC takes to load using jiffies. This information could be very useful in determining if GuC is taking unreasonably long time to load in a certain platforms.

v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well.

v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko)

v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko)

v5: Rebased. Do not expose the load time variable in a global struct (Tvrtko, Joonas)

Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc_fw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +9 -2
index ef67a36..4ce9a30 100644
@@ -133,7 +133,8 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	unsigned long offset;
 	struct sg_table *sg = vma->pages;
 	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
-	int i, ret = 0;
+	int i, ret = 0, load_time;
+	ktime_t start_load;
 
 	/* where RSA signature starts */
 	offset = guc_fw->rsa_offset;
@@ -160,6 +161,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	I915_WRITE(DMA_ADDR_1_HIGH, DMA_ADDRESS_SPACE_WOPCM);
 
 	/* Finally start the DMA */
+	start_load = ktime_get();
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(UOS_MOVE | START_DMA));
 
 	/*
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	 */
 	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
 
+	load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
 			I915_READ(DMA_CTRL), status);
 
 	if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
 		DRM_ERROR("GuC firmware signature verification failed\n");
 		ret = -ENOEXEC;
-	}
+	} else if (load_time > 20)
+		DRM_NOTE("GuC load takes more than acceptable threshold\n");
+	else
+		DRM_DEBUG_DRIVER("GuC loaded in %d ms\n", load_time);
 
 	DRM_DEBUG_DRIVER("returning %d\n", ret);
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/i915/huc: Add HuC Load time to dmesg log.

This patch uses jiffies to calculate the huc load time.This information can be useful for testing to know how much time huc takes to load.

v2: Remove debugfs entry. Remove local variable huc_finish_load. (Daniel, Tvrtko)

v3: Use ktime_get() for more accurate timings. Ensure the load is successful, before load times is printed. (Tvrtko, Michal)

v4: Rebase. Do not expose the load time variable in a gobal struct. Use int for load time (Tvrtko, Joonas)

Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo Lozano <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_huc.c +8 -1
index 98d1725..3e3ce14 100644
@@ -127,7 +127,8 @@ static int huc_ucode_xfer(struct intel_uc_fw *huc_fw, struct i915_vma *vma)
 	struct drm_i915_private *dev_priv = huc_to_i915(huc);
 	unsigned long offset = 0;
 	u32 size;
-	int ret;
+	int ret, load_time;
+	ktime_t start_load;
 
 	GEM_BUG_ON(huc_fw->type != INTEL_UC_FW_TYPE_HUC);
 
@@ -148,13 +149,19 @@ static int huc_ucode_xfer(struct intel_uc_fw *huc_fw, struct i915_vma *vma)
 	I915_WRITE(DMA_COPY_SIZE, size);
 
 	/* Start the DMA */
+	start_load = ktime_get();
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(HUC_UKERNEL | START_DMA));
 
 	/* Wait for DMA to finish */
 	ret = intel_wait_for_register_fw(dev_priv, DMA_CTRL, START_DMA, 0, 100);
 
+	load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("HuC DMA transfer wait over with ret %d\n", ret);
 
+	if (!ret)
+		DRM_DEBUG_DRIVER("HuC is loaded in %d ms\n", load_time);
+
 	/* Disable the bits once DMA is over */
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_DISABLE(HUC_UKERNEL));
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] drm/i915/huc: Add HuC Load time to dmesg log.

Quoted 1 line · Anusha Srivatsa

This patch uses jiffies to calculate the huc

                  ^^^^^^^                  ^^^

Please update commit message to match final change and use correct name for HuC (s/huc/HuC)

Quoted 42 lines

load time.This information can be useful for testing to know how much time huc takes to load.

v2: Remove debugfs entry. Remove local variable huc_finish_load. (Daniel, Tvrtko)

v3: Use ktime_get() for more accurate timings. Ensure the load is successful, before load times is printed. (Tvrtko, Michal)

v4: Rebase. Do not expose the load time variable in a gobal struct. Use int for load time (Tvrtko, Joonas)

Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo Lozano <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_huc.c +3 -1
index 98d1725..3e3ce14 100644
@@ -127,7 +127,8 @@ static int huc_ucode_xfer(struct intel_uc_fw  
 *huc_fw, struct i915_vma *vma)
 	struct drm_i915_private *dev_priv = huc_to_i915(huc);
 	unsigned long offset = 0;
 	u32 size;
-	int ret;
+	int ret, load_time;
+	ktime_t start_load;
 	GEM_BUG_ON(huc_fw->type != INTEL_UC_FW_TYPE_HUC);
@@ -148,13 +149,19 @@ static int huc_ucode_xfer(struct intel_uc_fw  
 *huc_fw, struct i915_vma *vma)
 	I915_WRITE(DMA_COPY_SIZE, size);
 	/* Start the DMA */
+	start_load = ktime_get();

drivers/gpu/drm/i915/intel_huc.c static int huc_ucode_xfer(struct intel_uc_fw · line 162

Quoted 10 lines
drivers/gpu/drm/i915/intel_huc.c +5 -0
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(HUC_UKERNEL | START_DMA));
 	/* Wait for DMA to finish */
 	ret = intel_wait_for_register_fw(dev_priv, DMA_CTRL, START_DMA, 0,  
 100);
+	load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("HuC DMA transfer wait over with ret %d\n", ret);
+	if (!ret)
+		DRM_DEBUG_DRIVER("HuC is loaded in %d ms\n", load_time);
+

Maybe we can squash above two messages into:

DRM_DEBUG_DRIVER("HuC DMA transfer %s in %dms\n",
ret ? "timedout" ? "completed", load_time);

drivers/gpu/drm/i915/intel_huc.c static int huc_ucode_xfer(struct intel_uc_fw *huc_fw, struct i915_vma *vma) · line 166

Quoted 2 lines
drivers/gpu/drm/i915/intel_huc.c +0 -0
 	/* Disable the bits once DMA is over */
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_DISABLE(HUC_UKERNEL));

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/guc: Add GuC Load time to dmesg log.

In reply to Anusha Srivatsa
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/guc: Add GuC Load time to dmesg log.
URL : https://patchwork.freedesktop.org/series/32936/
State : success

== Summary ==

Series 32936v1 series starting with [1/2] drm/i915/guc: Add GuC Load time to dmesg log.
https://patchwork.freedesktop.org/api/1.0/series/32936/revisions/1/mbox/

Test drv_module_reload:

        Subgroup basic-no-display:
                fail       -> PASS       (fi-hsw-4770r)
                dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#103206

fdo#103206 https://bugs.freedesktop.org/show_bug.cgi?id=103206

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:445s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:459s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:380s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:548s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:276s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:524s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:509s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:486s
fi-cfl-s         total:287  pass:253  dwarn:2   dfail:0   fail:0   skip:31 
fi-cnl-y         total:217  pass:196  dwarn:0   dfail:0   fail:0   skip:20 
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:435s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:263s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:583s
fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:496s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:429s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:430s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:428s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:466s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:490s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:578s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:481s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:582s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:567s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:598s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:652s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:526s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:505s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:463s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:570s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:422s

98f067e087ab9294555a9bdd6a056c4156777117 drm-tip: 2017y-10m-31d-20h-56m-13s UTC integration manifest 15988f30344c drm/i915/huc: Add HuC Load time to dmesg log.
9b50a2ba1a14 drm/i915/guc: Add GuC Load time to dmesg log.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6286/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915/guc: Add GuC Load time to dmesg log.

In reply to Anusha Srivatsa
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/guc: Add GuC Load time to dmesg log.
URL : https://patchwork.freedesktop.org/series/32936/
State : success

== Summary ==

Test drv_module_reload:

        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (shard-hsw) fdo#102707
Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-A:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249
Test kms_flip:
        Subgroup plain-flip-fb-recreate:
                pass       -> FAIL       (shard-hsw) fdo#100368

fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

shard-hsw total:2539 pass:1432 dwarn:1 dfail:0 fail:9 skip:1097 time:9217s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6286/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Anusha Srivatsa
Quoted 2 lines · Anusha Srivatsa

Calculate the time that GuC takes to load using jiffies. This information could be very useful in

^^^^^^^
This is no longer true.

Quoted 36 lines

determining if GuC is taking unreasonably long time to load in a certain platforms.

v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well.

v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko)

v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko)

v5: Rebased. Do not expose the load time variable in a global struct (Tvrtko, Joonas)

Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc_fw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
index ef67a36..4ce9a30 100644

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct · line 137

Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -1
@@ -133,7 +133,8 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
 	unsigned long offset;
 	struct sg_table *sg = vma->pages;
 	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
-	int i, ret = 0;
+	int i, ret = 0, load_time;

Note that ktime_ms_delta() return type is s64 not int.

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 137

Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
+	ktime_t start_load;

s/start_load/now ?

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct · line 164

Quoted 7 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
 	/* where RSA signature starts */
 	offset = guc_fw->rsa_offset;
@@ -160,6 +161,7 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
 	I915_WRITE(DMA_ADDR_1_HIGH, DMA_ADDRESS_SPACE_WOPCM);
 	/* Finally start the DMA */
+	start_load = ktime_get();

Maybe we should either update comment with note about taking start time or move ktime_get call before that comment to avoid confusion..

Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(UOS_MOVE | START_DMA));
 	/*
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
 	 */
 	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct · line 185

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_fw.c +4 -1
+	load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
 			I915_READ(DMA_CTRL), status);
 	if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
 		DRM_ERROR("GuC firmware signature verification failed\n");
 		ret = -ENOEXEC;
-	}
+	} else if (load_time > 20)
+		DRM_NOTE("GuC load takes more than acceptable threshold\n");

Please add threshold and actual load time to the message to let user know that times

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 188

Quoted 2 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -0
+	else
+		DRM_DEBUG_DRIVER("GuC loaded in %d ms\n", load_time);

And I'm not sure that we can rely on 'load_time' on timeout in wait_for.

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 190

Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
 	DRM_DEBUG_DRIVER("returning %d\n", ret);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Quoting Michal Wajdeczko (2017-11-01 13:14:33)

Quoted 10 lines

On Wed, 01 Nov 2017 01:11:20 +0100, Anusha Srivatsa

Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -0
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
       */
      ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
+     load_time = ktime_ms_delta(ktime_get(), start_load);
+
      DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
                      I915_READ(DMA_CTRL), status);
      if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
Quoted 8 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 186

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -1
              DRM_ERROR("GuC firmware signature verification failed\n");
              ret = -ENOEXEC;
-     }
+     } else if (load_time > 20)
+             DRM_NOTE("GuC load takes more than acceptable threshold\n");

Please add threshold and actual load time to the message to let user know that times

The more important question is why are we telling the user this at all; a significant but normal condition. What do we expect them to do? It doesn't impair any functionality of the driver, it just took longer than you expected -- which may be simply because the system was doing something else and we slept for longer.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 20 lines · Chris Wilson

Quoting Michal Wajdeczko (2017-11-01 13:14:33)

Quoted 10 lines

On Wed, 01 Nov 2017 01:11:20 +0100, Anusha Srivatsa

Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -0
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
       */
      ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
+     load_time = ktime_ms_delta(ktime_get(), start_load);
+
      DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
                      I915_READ(DMA_CTRL), status);
      if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
Quoted 8 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 186

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -1
              DRM_ERROR("GuC firmware signature verification failed\n");
              ret = -ENOEXEC;
-     }
+     } else if (load_time > 20)
+             DRM_NOTE("GuC load takes more than acceptable threshold\n");

Please add threshold and actual load time to the message to let user know that times

Quoted 5 lines

The more important question is why are we telling the user this at all; a significant but normal condition. What do we expect them to do? It doesn't impair any functionality of the driver, it just took longer than you expected -- which may be simply because the system was doing something else and we slept for longer.

Chris, I am inclining to have this info more for us than the user. It is more of a debug print to give us some data. We can see if firmware takes peculiarly long time to load. We know its normal to be within 20ms range. So, alert if it takes longer than that...

Quoted 1 line

-Chris

Signature · 5 lines
Anusha Srivatsa
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Quoting Anusha Srivatsa (2017-11-02 20:28:10)

Quoted 27 lines · Chris Wilson
Quoted 20 lines

Quoting Michal Wajdeczko (2017-11-01 13:14:33)

Quoted 10 lines

On Wed, 01 Nov 2017 01:11:20 +0100, Anusha Srivatsa

Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -0
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct  
 drm_i915_private *dev_priv,
       */
      ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
+     load_time = ktime_ms_delta(ktime_get(), start_load);
+
      DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
                      I915_READ(DMA_CTRL), status);
      if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
Quoted 8 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 186

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -1
              DRM_ERROR("GuC firmware signature verification failed\n");
              ret = -ENOEXEC;
-     }
+     } else if (load_time > 20)
+             DRM_NOTE("GuC load takes more than acceptable threshold\n");

Please add threshold and actual load time to the message to let user know that times

Quoted 5 lines

The more important question is why are we telling the user this at all; a significant but normal condition. What do we expect them to do? It doesn't impair any functionality of the driver, it just took longer than you expected -- which may be simply because the system was doing something else and we slept for longer.

Quoted 4 lines

Chris, I am inclining to have this info more for us than the user. It is more of a debug print to give us some data. We can see if firmware takes peculiarly long time to load. We know its normal to be within 20ms range. So, alert if it takes longer than that...

Sure, but the impact is that this is a user facing message, even marked as a significant message. We are quite capable of parsing debug messages; even capable of setting up ftrace to extract this timing info without adding the dmesg in the first place...
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
In reply to Michal Wajdeczko
Quoted 7 lines · Michal Wajdeczko
Quoted 2 lines · Anusha Srivatsa

Calculate the time that GuC takes to load using jiffies. This information could be very useful in

^^^^^^^
This is no longer true.

True. Will sending an all new patch with updated
approach(using ktime instead of jiffies) be good?
Or stick to this with change in commit message?

Quoted 46 lines
Quoted 37 lines

determining if GuC is taking unreasonably long time to load in a certain platforms.

v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well.

v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko)

v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko)

v5: Rebased. Do not expose the load time variable in a global struct (Tvrtko, Joonas)

Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Tvrtko Ursulin <[email protected]>

---
drivers/gpu/drm/i915/intel_guc_fw.c | 11 +++++++++--

1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
index ef67a36..4ce9a30 100644

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private · line 137

Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -1
@@ -133,7 +133,8 @@ static int guc_ucode_xfer_dma(struct drm_i915_private
 *dev_priv,
 	unsigned long offset;
 	struct sg_table *sg = vma->pages;
 	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
-	int i, ret = 0;
+	int i, ret = 0, load_time;

Note that ktime_ms_delta() return type is s64 not int.

Quoted 3 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 137

Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
+	ktime_t start_load;

s/start_load/now ?

I think start_load is verbose.

Quoted 10 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private · line 164

Quoted 7 lines
drivers/gpu/drm/i915/intel_guc_fw.c +1 -0
 	/* where RSA signature starts */
 	offset = guc_fw->rsa_offset;
@@ -160,6 +161,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private
 *dev_priv,
 	I915_WRITE(DMA_ADDR_1_HIGH, DMA_ADDRESS_SPACE_WOPCM);
 	/* Finally start the DMA */
+	start_load = ktime_get();

Maybe we should either update comment with note about taking start time or move ktime_get call before that comment to avoid confusion..

I prefer the latter.

Quoted 20 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
 	I915_WRITE(DMA_CTRL, _MASKED_BIT_ENABLE(UOS_MOVE | START_DMA));
 	/*
@@ -172,13 +174,18 @@ static int guc_ucode_xfer_dma(struct
 drm_i915_private *dev_priv,
 	 */
 	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct · line 185

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_fw.c +4 -1
+	load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("DMA status 0x%x, GuC status 0x%x\n",
 			I915_READ(DMA_CTRL), status);
 	if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
 		DRM_ERROR("GuC firmware signature verification failed\n");
 		ret = -ENOEXEC;
-	}
+	} else if (load_time > 20)
+		DRM_NOTE("GuC load takes more than acceptable threshold\n");

Please add threshold and actual load time to the message to let user know that times

Quoted 4 lines

drivers/gpu/drm/i915/intel_guc_fw.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 188

Quoted 2 lines
drivers/gpu/drm/i915/intel_guc_fw.c +2 -0
+	else
+		DRM_DEBUG_DRIVER("GuC loaded in %d ms\n", load_time);

And I'm not sure that we can rely on 'load_time' on timeout in wait_for.

Hmm.... we are checking the DMA status right after that which means the firmware load should have happened by then.... thats why I am calculating it there....

Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_guc_fw.c +0 -0
 	DRM_DEBUG_DRIVER("returning %d\n", ret);
Signature · 5 lines
Anusha Srivatsa
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
In reply to Anusha Srivatsa
Quoted 14 lines · Anusha Srivatsa

Calculate the time that GuC takes to load using jiffies. This information could be very useful in determining if GuC is taking unreasonably long time to load in a certain platforms.

v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well.

v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko)

Quoted 7 lines

v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko)

v5: Rebased. Do not expose the load time variable in a global struct (Tvrtko, Joonas)

From my point of view (measuring suspend/resume times) knowing how much time is spent loading GuC & HuC is really useful, so it's definitely useful information.

Kind regards, David Weinehall
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

Quoting David Weinehall (2017-11-01 13:38:48)

Quoted 20 lines · Anusha Srivatsa
Quoted 19 lines

Calculate the time that GuC takes to load using jiffies. This information could be very useful in determining if GuC is taking unreasonably long time to load in a certain platforms.

v2: Calculate time before logs are collected. Move the guc_load_time variable as a part of intel_uc_fw struct. Store only final result which is to be exported to debugfs. (Michal) Add the load time in the print message as well.

v3: Remove debugfs entry. Remove local variable guc_finish_load. (Daniel, Tvrtko)

v4: Use ktime_get() instead of jiffies. Use DRM_NOTE if time taken to load is more than the threshold. On load times within acceptable range, use DRM_DEBUG_DRIVER (Tvrtko)

Quoted 6 lines
Quoted 2 lines

v5: Rebased. Do not expose the load time variable in a global struct (Tvrtko, Joonas)

From my point of view (measuring suspend/resume times) knowing how much time is spent loading GuC & HuC is really useful, so it's definitely useful information.

This information could be gleaned from ftrace...
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx