Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/xe_gt_freq: Use sync reset
@ 2024-09-25 22:09 Vinay Belgaumkar
  2024-09-26 14:36 ` Rodrigo Vivi
  2024-10-03 21:27 ` Dixit, Ashutosh
  0 siblings, 2 replies; 3+ messages in thread
From: Vinay Belgaumkar @ 2024-09-25 22:09 UTC (permalink / raw)
  To: intel-gfx, igt-dev; +Cc: Vinay Belgaumkar, Badal Nilawar

Some recent WAs reduce the GT freq during driver load/reset. Use sync
reset so that we give enough time for GT frequency to be restored after
reset has completed.

Also, stash/restore frequencies per GT as they can be different.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2676
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2711

Cc: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/intel/xe_gt_freq.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/intel/xe_gt_freq.c b/tests/intel/xe_gt_freq.c
index 427e12c55..de4d111ea 100644
--- a/tests/intel/xe_gt_freq.c
+++ b/tests/intel/xe_gt_freq.c
@@ -341,7 +341,8 @@ static void test_reset(int fd, int gt_id, int cycles)
 		igt_assert_f(get_freq(fd, gt_id, "cur") == rpn,
 			     "Failed after %d good cycles\n", i);
 
-		xe_force_gt_reset_async(fd, gt_id);
+		xe_force_gt_reset_sync(fd, gt_id);
+
 		usleep(SLPC_FREQ_LATENCY_US);
 
 		igt_assert_f(get_freq(fd, gt_id, "min") == rpn,
@@ -433,16 +434,23 @@ igt_main
 	int fd;
 	int gt;
 	struct drm_xe_engine_class_instance *hwe;
-	uint32_t stash_min;
-	uint32_t stash_max;
+	uint32_t *stash_min, *stash_max;
+	int num_gts;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 
 		igt_require(xe_sysfs_gt_has_node(fd, 0, "freq0"));
+		num_gts = xe_number_gt(fd);
+
 		/* The defaults are the same. Stashing the gt0 is enough */
-		stash_min = get_freq(fd, 0, "min");
-		stash_max = get_freq(fd, 0, "max");
+		stash_min = (uint32_t *) malloc(sizeof(uint32_t) * num_gts);
+		stash_max = (uint32_t *) malloc(sizeof(uint32_t) * num_gts);
+
+		xe_for_each_gt(fd, gt) {
+			stash_min[gt] = get_freq(fd, gt, "min");
+			stash_max[gt] = get_freq(fd, gt, "max");
+		}
 	}
 
 	igt_subtest("throttle_basic_api") {
@@ -517,9 +525,11 @@ igt_main
 
 	igt_fixture {
 		xe_for_each_gt(fd, gt) {
-			set_freq(fd, gt, "min", stash_min);
-			set_freq(fd, gt, "max", stash_max);
+			set_freq(fd, gt, "max", stash_max[gt]);
+			set_freq(fd, gt, "min", stash_min[gt]);
 		}
+		free(stash_min);
+		free(stash_max);
 		drm_close_driver(fd);
 	}
 }
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/xe_gt_freq: Use sync reset
  2024-09-25 22:09 [PATCH i-g-t] tests/xe_gt_freq: Use sync reset Vinay Belgaumkar
@ 2024-09-26 14:36 ` Rodrigo Vivi
  2024-10-03 21:27 ` Dixit, Ashutosh
  1 sibling, 0 replies; 3+ messages in thread
From: Rodrigo Vivi @ 2024-09-26 14:36 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: intel-gfx, igt-dev, Badal Nilawar

On Wed, Sep 25, 2024 at 03:09:23PM -0700, Vinay Belgaumkar wrote:
> Some recent WAs reduce the GT freq during driver load/reset. Use sync
> reset so that we give enough time for GT frequency to be restored after
> reset has completed.
> 
> Also, stash/restore frequencies per GT as they can be different.
> 
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2676
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2711
> 
> Cc: Badal Nilawar <badal.nilawar@intel.com>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  tests/intel/xe_gt_freq.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/intel/xe_gt_freq.c b/tests/intel/xe_gt_freq.c
> index 427e12c55..de4d111ea 100644
> --- a/tests/intel/xe_gt_freq.c
> +++ b/tests/intel/xe_gt_freq.c
> @@ -341,7 +341,8 @@ static void test_reset(int fd, int gt_id, int cycles)
>  		igt_assert_f(get_freq(fd, gt_id, "cur") == rpn,
>  			     "Failed after %d good cycles\n", i);
>  
> -		xe_force_gt_reset_async(fd, gt_id);
> +		xe_force_gt_reset_sync(fd, gt_id);
> +
>  		usleep(SLPC_FREQ_LATENCY_US);
>  
>  		igt_assert_f(get_freq(fd, gt_id, "min") == rpn,
> @@ -433,16 +434,23 @@ igt_main
>  	int fd;
>  	int gt;
>  	struct drm_xe_engine_class_instance *hwe;
> -	uint32_t stash_min;
> -	uint32_t stash_max;
> +	uint32_t *stash_min, *stash_max;
> +	int num_gts;
>  
>  	igt_fixture {
>  		fd = drm_open_driver(DRIVER_XE);
>  
>  		igt_require(xe_sysfs_gt_has_node(fd, 0, "freq0"));
> +		num_gts = xe_number_gt(fd);
> +
>  		/* The defaults are the same. Stashing the gt0 is enough */
> -		stash_min = get_freq(fd, 0, "min");
> -		stash_max = get_freq(fd, 0, "max");
> +		stash_min = (uint32_t *) malloc(sizeof(uint32_t) * num_gts);
> +		stash_max = (uint32_t *) malloc(sizeof(uint32_t) * num_gts);
> +
> +		xe_for_each_gt(fd, gt) {
> +			stash_min[gt] = get_freq(fd, gt, "min");
> +			stash_max[gt] = get_freq(fd, gt, "max");
> +		}
>  	}
>  
>  	igt_subtest("throttle_basic_api") {
> @@ -517,9 +525,11 @@ igt_main
>  
>  	igt_fixture {
>  		xe_for_each_gt(fd, gt) {
> -			set_freq(fd, gt, "min", stash_min);
> -			set_freq(fd, gt, "max", stash_max);
> +			set_freq(fd, gt, "max", stash_max[gt]);
> +			set_freq(fd, gt, "min", stash_min[gt]);
>  		}
> +		free(stash_min);
> +		free(stash_max);
>  		drm_close_driver(fd);
>  	}
>  }
> -- 
> 2.38.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/xe_gt_freq: Use sync reset
  2024-09-25 22:09 [PATCH i-g-t] tests/xe_gt_freq: Use sync reset Vinay Belgaumkar
  2024-09-26 14:36 ` Rodrigo Vivi
@ 2024-10-03 21:27 ` Dixit, Ashutosh
  1 sibling, 0 replies; 3+ messages in thread
From: Dixit, Ashutosh @ 2024-10-03 21:27 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: intel-gfx, igt-dev, Badal Nilawar

On Wed, 25 Sep 2024 15:09:23 -0700, Vinay Belgaumkar wrote:
>
> Some recent WAs reduce the GT freq during driver load/reset. Use sync
> reset so that we give enough time for GT frequency to be restored after
> reset has completed.
>
> Also, stash/restore frequencies per GT as they can be different.
>
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2676
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2711
>

No empty line here.

> Cc: Badal Nilawar <badal.nilawar@intel.com>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

Please use 'intel' in the commit title, intel is not the only vendor
contributing to igt.

I have fixed these up this time and merged this.

Thanks.
--
Ashutosh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-03 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 22:09 [PATCH i-g-t] tests/xe_gt_freq: Use sync reset Vinay Belgaumkar
2024-09-26 14:36 ` Rodrigo Vivi
2024-10-03 21:27 ` Dixit, Ashutosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox