diff mbox series

[i-g-t] tests/xe_gt_freq: Use sync reset

Message ID 20240925220923.2030384-1-vinay.belgaumkar@intel.com (mailing list archive)
State New, archived
Headers show
Series [i-g-t] tests/xe_gt_freq: Use sync reset | expand

Commit Message

Vinay Belgaumkar Sept. 25, 2024, 10:09 p.m. UTC
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(-)

Comments

Rodrigo Vivi Sept. 26, 2024, 2:36 p.m. UTC | #1
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
>
Dixit, Ashutosh Oct. 3, 2024, 9:27 p.m. UTC | #2
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
diff mbox series

Patch

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);
 	}
 }