Skip to contentSkip to conversation

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

PATCH In review Anusha Srivatsa 4 participants 10 messages Oct 4, 2017 – Oct 9, 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)

Cc Chris Wilson <[email protected]>
Cc Tvrtko ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_guc_loader.c | 10 +++++++++-
 drivers/gpu/drm/i915/intel_uc.h         |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_guc_loader.c +9 -1
index c9e25be..a0b562c 100644
@@ -199,6 +199,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	struct sg_table *sg = vma->pages;
 	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
 	int i, ret = 0;
+	ktime_t start_load;
 
 	/* where RSA signature starts */
 	offset = guc_fw->rsa_offset;
@@ -225,6 +226,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));
 
 	/*
@@ -237,13 +239,17 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
 	 */
 	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
 
+	guc_fw->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 (guc_fw->load_time > 20)
+		DRM_NOTE("Time taken to load GuC is more than the acceptable \
+			 threshold\n");
 
 	DRM_DEBUG_DRIVER("returning %d\n", ret);
 
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
 		 guc->fw.path,
 		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/intel_uc.h +1 -0
index 6966349..65b9674 100644
@@ -136,6 +136,7 @@ struct intel_uc_fw {
 	uint32_t rsa_offset;
 	uint32_t ucode_size;
 	uint32_t ucode_offset;
+	unsigned long long load_time;
 };
 
 struct intel_guc_log {
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)

Cc Chris Wilson <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Oscar Mateo Lozano <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_huc.c +7 -0
index 8b4b535..972ae63 100644
@@ -90,6 +90,7 @@ static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
 	unsigned long offset = 0;
 	u32 size;
 	int ret;
+	ktime_t start_load;
 
 	ret = i915_gem_object_set_to_gtt_domain(huc_fw->obj, false);
 	if (ret) {
@@ -121,11 +122,14 @@ static int huc_ucode_xfer(struct drm_i915_private *dev_priv)
 	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 = wait_for((I915_READ(DMA_CTRL) & START_DMA) == 0, 100);
 
+	huc_fw->load_time = ktime_ms_delta(ktime_get(), start_load);
+
 	DRM_DEBUG_DRIVER("HuC DMA transfer wait over with ret %d\n", ret);
 
 	/* Disable the bits once DMA is over */
@@ -220,6 +224,9 @@ void intel_huc_init_hw(struct intel_huc *huc)
 
 	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		DRM_ERROR("Failed to complete HuC uCode load with ret %d\n", err);
+	else
+		DRM_DEBUG_DRIVER("Time taken to load HuC %lld ms\n",
+			 huc->fw.load_time);
 
 	return;
 }
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 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/31363/
State : success

== Summary ==

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

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514

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

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:454s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:472s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:397s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:569s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:287s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:528s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:531s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:542s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:534s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:552s
fi-cnl-y         total:289  pass:261  dwarn:1   dfail:0   fail:0   skip:27  time:615s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:434s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:590s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:437s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:418s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:470s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:510s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:475s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:496s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:581s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:489s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:595s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:655s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:534s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:524s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:476s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:578s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:432s

654360cf73feea27f7ed5bfa2e5b2fa5ede2e8ec drm-tip: 2017y-10m-03d-17h-55m-08s UTC integration manifest a62859b3af32 drm/i915/huc: Add HuC Load time to dmesg log.
09abcf680851 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_5892/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 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/31363/
State : success

== Summary ==

Test kms_setmode:

        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test perf:
        Subgroup polling:
                pass       -> FAIL       (shard-hsw) fdo#102252

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

shard-hsw total:2429 pass:1314 dwarn:7 dfail:0 fail:25 skip:1083 time:9971s

== Logs ==

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

#4 lore raw
In reply to Anusha Srivatsa
Quoted 71 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)

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)

Cc Chris Wilson <[email protected]>
Cc Tvrtko ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
  drivers/gpu/drm/i915/intel_guc_loader.c | 10 +++++++++-
  drivers/gpu/drm/i915/intel_uc.h         |  1 +
  2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_guc_loader.c +7 -1
index c9e25be..a0b562c 100644
@@ -199,6 +199,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
  	struct sg_table *sg = vma->pages;
  	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
  	int i, ret = 0;
+	ktime_t start_load;
 
  	/* where RSA signature starts */
  	offset = guc_fw->rsa_offset;
@@ -225,6 +226,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));
 
  	/*
@@ -237,13 +239,17 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,
  	 */
  	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
 
+	guc_fw->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 (guc_fw->load_time > 20)
+		DRM_NOTE("Time taken to load GuC is more than the acceptable \
+			 threshold\n");
 
  	DRM_DEBUG_DRIVER("returning %d\n", ret);
 

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 383

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

Also, where ever it is (global or local) unsigned int is enough since you picked ms as the resolution.

Regards,

Tvrtko

Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_loader.c +0 -0
  	return 0;
  }
 
drivers/gpu/drm/i915/intel_uc.h +0 -0
index 6966349..65b9674 100644

drivers/gpu/drm/i915/intel_uc.h struct intel_uc_fw { · line 142

Quoted 7 lines
drivers/gpu/drm/i915/intel_uc.h +1 -0
@@ -136,6 +136,7 @@ struct intel_uc_fw {
  	uint32_t rsa_offset;
  	uint32_t ucode_size;
  	uint32_t ucode_offset;
+	unsigned long long load_time;
  };
 
  struct intel_guc_log {

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

maintainer
#5 lore raw
Quoted 27 lines · Tvrtko Ursulin
Quoted 26 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)

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)

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

<SNIP>

Quoted 10 lines

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 383

Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

We decided not to expose it through debugfs, so let's try to avoid a variable, too.

Regards, Joonas

PS. Also, lets try to get to the habit of having the S-o-b: and Cc:s in chronological order. Less fixing for committers when applying patches.

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 45 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Wednesday, October 4, 2017 5:52 AM
To: Tvrtko Ursulin <[email protected]>; Srivatsa, Anusha <[email protected]>; [email protected]
Cc: Daniel Vetter <[email protected]>; Sundaresan, Sujaritha <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log.

Quoted 25 lines · Tvrtko Ursulin
Quoted 24 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)

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)

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

<SNIP>

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_guc_loader.c +0 -0
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 383

Quoted 2 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

We decided not to expose it through , so let's try to avoid a variable, too.

Hi Joonas,

The order of prints will then be:
GuC firmware status: fetch SUCCESS load PENDING
GuC loaded in x ms
GuC loaded/submission enabled firmware <path_to_firmware>_major.minor.bin version major.minor

Compared to

GuC firmware status: fetch SUCCESS load PENDING
GuC loaded/submission enabled firmware <path_to_firmware>_platform_major.minor.bin version major.minor GuC loaded in x ms

I felt the second one looked a better sequence, but I will change if that’s the majority.

Thanks,
Anusha

Quoted 4 lines

Regards, Joonas

PS. Also, lets try to get to the habit of having the S-o-b: and Cc:s in chronological order. Less fixing for committers when applying patches.

Will keep in mind, thanks

Anusha

Quoted 3 lines

Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

maintainer
#7 lore raw
Quoted 50 lines · Anusha
Quoted 50 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Wednesday, October 4, 2017 5:52 AM
To: Tvrtko Ursulin <[email protected]>; Srivatsa, Anusha <[email protected]>; [email protected]
Cc: Daniel Vetter <[email protected]>; Sundaresan, Sujaritha <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log.

Quoted 25 lines · Tvrtko Ursulin
Quoted 24 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)

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)

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

<SNIP>

Quoted 10 lines

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 383

Quoted 6 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

Quoted 8 lines
Quoted 1 line

We decided not to expose it through , so let's try to avoid a variable, too.

Hi Joonas,

The order of prints will then be:
GuC firmware status: fetch SUCCESS load PENDING
GuC loaded in x ms
GuC loaded/submission enabled firmware <path_to_firmware>_major.minor.bin version major.minor

But is not this the more logical one, too? Say we would enable the asynchronous loading of GuC firmware, and we could simultaneously fallback to ELSP and start using the system. So there could be considerable time between GuC being loaded and GuC submission being enabled. So I might tie the firmware path information to the GuC loaded message.

Also, if we have printk timestamping available, would not the information be readable from there, just calculate delta between firmware status changing from PENDING to LOADED? It won't hurt to explicitly compute it for the user, of course.

Regards, Joonas

Quoted 22 lines

Compared to

GuC firmware status: fetch SUCCESS load PENDING
GuC loaded/submission enabled firmware <path_to_firmware>_platform_major.minor.bin version major.minor GuC loaded in x ms

I felt the second one looked a better sequence, but I will change if that’s the majority.

Thanks,
Anusha

Quoted 4 lines

Regards, Joonas

PS. Also, lets try to get to the habit of having the S-o-b: and Cc:s in chronological order. Less fixing for committers when applying patches.

Will keep in mind, thanks

Anusha

Quoted 3 lines

Joonas Lahtinen
Open Source Technology Center
Intel Corporation

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 79 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Thursday, October 5, 2017 11:30 PM
To: Srivatsa, Anusha <[email protected]>; Tvrtko Ursulin <[email protected]>; [email protected]
Cc: Daniel Vetter <[email protected]>; Sundaresan, Sujaritha <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log.

Quoted 51 lines · Anusha
Quoted 51 lines

-----Original Message-----
From: Joonas Lahtinen [mailto:[email protected]]
Sent: Wednesday, October 4, 2017 5:52 AM
To: Tvrtko Ursulin <[email protected]>; Srivatsa, Anusha <[email protected]>; [email protected]
Cc: Daniel Vetter <[email protected]>; Sundaresan, Sujaritha <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log.

Quoted 25 lines · Tvrtko Ursulin
Quoted 24 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)

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)

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

<SNIP>

Quoted 11 lines

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 384

Quoted 7 lines
drivers/gpu/drm/i915/intel_guc_loader.c +3 -0
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld
+ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

Quoted 8 lines
Quoted 1 line

We decided not to expose it through , so let's try to avoid a variable, too.

Hi Joonas,

The order of prints will then be:
GuC firmware status: fetch SUCCESS load PENDING GuC loaded in x ms GuC loaded/submission enabled firmware <path_to_firmware>_major.minor.bin version major.minor

But is not this the more logical one, too? Say we would enable the asynchronous loading of GuC firmware, and we could simultaneously fallback to ELSP and start using the system. So there could be considerable time between GuC being loaded and GuC submission being enabled. So I might tie the firmware path information to the GuC loaded message.

Quoted 4 lines

Also, if we have printk timestamping available, would not the information be readable from there, just calculate delta between firmware status changing from PENDING to LOADED? It won't hurt to explicitly compute it for the user, of course.

Agreed. Will remove the variable altogether.

Thanks a lot Joonas.
Anusha

Quoted 21 lines

Regards, Joonas

Quoted 8 lines

Compared to

GuC firmware status: fetch SUCCESS load PENDING GuC loaded/submission enabled firmware <path_to_firmware>_platform_major.minor.bin version major.minor GuC loaded in x ms

I felt the second one looked a better sequence, but I will change if that’s the

majority.

Quoted 10 lines

Thanks,
Anusha

Quoted 4 lines

Regards, Joonas

PS. Also, lets try to get to the habit of having the S-o-b: and Cc:s in chronological order. Less fixing for committers when applying patches.

Will keep in mind, thanks

Quoted 8 lines
Quoted 4 lines

Anusha

Quoted 3 lines

Joonas Lahtinen
Open Source Technology Center
Intel Corporation

--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

#9 lore raw
In reply to Tvrtko Ursulin
Quoted 92 lines

-----Original Message-----
From: Tvrtko Ursulin [mailto:[email protected]]
Sent: Wednesday, October 4, 2017 1:17 AM
To: Srivatsa, Anusha <[email protected]>; intel- [email protected]
Cc: Sundaresan, Sujaritha <[email protected]>; Daniel Vetter <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/guc: Add GuC Load time to dmesg log.

drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private

Quoted 35 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)

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)

Cc Chris Wilson <[email protected]>
Cc Tvrtko ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sujaritha Sundaresan <[email protected]>
Cc Oscar Mateo <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
  drivers/gpu/drm/i915/intel_guc_loader.c | 10 +++++++++-
  drivers/gpu/drm/i915/intel_uc.h         |  1 +
  2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_guc_loader.c +0 -0
index c9e25be..a0b562c 100644
@@ -199,6 +199,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private

Quoted 8 lines
drivers/gpu/drm/i915/intel_guc_loader.c +1 -0
  	struct sg_table *sg = vma->pages;
  	u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
  	int i, ret = 0;
+	ktime_t start_load;
 
  	/* where RSA signature starts */
  	offset = guc_fw->rsa_offset;
@@ -225,6 +226,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/intel_guc_loader.c +1 -0
  	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));

drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct

Quoted 3 lines
drivers/gpu/drm/i915/intel_guc_loader.c +0 -0
  	/*
@@ -237,13 +239,17 @@ static int guc_ucode_xfer_dma(struct

drm_i915_private *dev_priv,

Quoted 4 lines
drivers/gpu/drm/i915/intel_guc_loader.c +1 -0
  	 */
  	ret = wait_for(guc_ucode_response(dev_priv, &status), 100);
 
+	guc_fw->load_time = ktime_ms_delta(ktime_get(), start_load);

drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,

Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_loader.c +3 -1
+
  	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 (guc_fw->load_time > 20)
+		DRM_NOTE("Time taken to load GuC is more than the

acceptable \

Quoted 8 lines
drivers/gpu/drm/i915/intel_guc_loader.c +1 -0
+			 threshold\n");
 
  	DRM_DEBUG_DRIVER("returning %d\n", ret);
 
@@ -373,6 +379,8 @@ int intel_guc_init_hw(struct intel_guc *guc)
  		 guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found);
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_guc_loader.c int intel_guc_init_hw(struct intel_guc *guc) · line 383

Quoted 2 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2 -0
+	DRM_DEBUG_DRIVER("GuC is loaded in: %lld ms\n",guc->fw.load_time);
+

If you move this debug to where the DRM_NOTE is you don't have to store the load time in the global structure. Unless there will be a reason in the future to have the value stored?

We can have an IGT that checks the load time and fails if its greater than the threshold.... for that it could be useful to have load time this way?

Quoted 2 lines

Also, where ever it is (global or local) unsigned int is enough since you picked ms as the resolution.

Unsigned int is a better approach.
Will change to unsigned int Tvrtko, thanks for suggestion.

Anusha

Quoted 18 lines

Regards,

Tvrtko

Quoted 14 lines
drivers/gpu/drm/i915/intel_guc_loader.c +0 -0
  	return 0;
  }
 
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_uc.h index 6966349..65b9674 100644

drivers/gpu/drm/i915/intel_uc.h +1 -0
@@ -136,6 +136,7 @@ struct intel_uc_fw {
  	uint32_t rsa_offset;
  	uint32_t ucode_size;
  	uint32_t ucode_offset;
+	unsigned long long load_time;
  };
 
Quoted 2 lines

drivers/gpu/drm/i915/intel_uc.h struct intel_uc_fw { · line 142

Quoted 2 lines
drivers/gpu/drm/i915/intel_uc.h +0 -0
  struct intel_guc_log {

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