Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
@ 2023-06-09  9:44 Riana Tauro
  2023-06-09 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Riana Tauro @ 2023-06-09  9:44 UTC (permalink / raw)
  To: igt-dev; +Cc: badal.nilawar

The test reads idle residency within a time interval and
checks if its within the tolerance

Currently the test checks RC6 Residency

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 tests/meson.build     |   1 +
 tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+)
 create mode 100644 tests/xe/xe_gt_idle.c

diff --git a/tests/meson.build b/tests/meson.build
index c15eb3a08..10273ebf5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -254,6 +254,7 @@ xe_progs = [
 	'xe_exec_fault_mode',
 	'xe_exec_reset',
 	'xe_exec_threads',
+	'xe_gt_idle',
 	'xe_gpgpu_fill',
 	'xe_guc_pc',
 	'xe_huc_copy',
diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
new file mode 100644
index 000000000..3a1090ffd
--- /dev/null
+++ b/tests/xe/xe_gt_idle.c
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+/**
+ * TEST: Test gtidle properties
+ * Category: Software building block
+ * Sub-category: Power Management
+ * Functionality: RC6
+ * Test category: functionality test
+ */
+
+#include <limits.h>
+
+#include "igt.h"
+#include "igt_sysfs.h"
+
+#include "xe/xe_query.h"
+
+#define SLEEP_DURATION 3 /* in seconds */
+
+const double tolerance = 0.1;
+
+#define assert_within_epsilon(x, ref, tol) \
+	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
+		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
+		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
+		     #x, #ref, (double)(x), \
+		     (tol) * 100.0, (tol) * 100.0, \
+		     (double)(ref))
+
+static bool in_rc6(int sysfs, int gt)
+{
+	char path[PATH_MAX];
+	char rc[8];
+
+	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
+	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
+		return false;
+
+	return strcmp(rc, "rc6") == 0;
+}
+
+static bool is_rc_dir(int sysfs, int gt)
+{
+	char path[PATH_MAX], name[NAME_MAX];
+	char rc[8];
+
+	sprintf(path, "device/gt%d/gtidle/name", gt);
+	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
+		return false;
+
+	sprintf(name, "gt%d-rc", gt);
+	return strcmp(rc, name) == 0;
+}
+
+static unsigned long read_idle_residency(int sysfs, int gt)
+{
+	unsigned long residency;
+	char path[PATH_MAX];
+
+	residency = 0;
+	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
+	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
+	return residency;
+}
+
+/**
+ * SUBTEST: idle-residency
+ * Description: basic residency test to check idle residency
+ * 		within a time interval
+ * Run type: FULL
+ */
+static void test_idle(int sysfs, int gt)
+{
+	struct timespec tv;
+	unsigned long elapsed_ms, residency_start, residency_end;
+
+	assert(is_rc_dir(sysfs, gt));
+	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
+
+	igt_gettime(&tv);
+	residency_start = read_idle_residency(sysfs, gt);
+	sleep(SLEEP_DURATION);
+	residency_end = read_idle_residency(sysfs, gt);
+	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
+
+	igt_info("Measured %lums of idle residency in %lums\n",
+		 residency_end - residency_start, elapsed_ms);
+
+	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
+}
+
+igt_main
+{
+	int fd, gt;
+	static int sysfs = -1;
+
+	igt_fixture {
+		fd = drm_open_driver(DRIVER_XE);
+
+		xe_device_get(fd);
+		sysfs = igt_sysfs_open(fd);
+		igt_assert(sysfs != -1);
+	}
+
+	igt_subtest("idle-residency")
+		xe_for_each_gt(fd, gt)
+			test_idle(sysfs, gt);
+
+	igt_fixture {
+		close(sysfs);
+		xe_device_put(fd);
+		close(fd);
+	}
+}
-- 
2.40.0

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

* [igt-dev] ✓ Fi.CI.BAT: success for tests/xe: Add basic idle residency test
  2023-06-09  9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
@ 2023-06-09 17:33 ` Patchwork
  2023-06-10 23:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2023-06-09 17:33 UTC (permalink / raw)
  To: Riana Tauro; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 7266 bytes --]

== Series Details ==

Series: tests/xe: Add basic idle residency test
URL   : https://patchwork.freedesktop.org/series/119127/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13256 -> IGTPW_9140
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html

Participating hosts (36 -> 37)
------------------------------

  Additional (1): fi-kbl-soraka 

Known issues
------------

  Here are the changes found in IGTPW_9140 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#2190])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@basic:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#4613]) +3 similar issues
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@gem_lmem_swapping@basic.html

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][3] ([i915#5334] / [i915#7872])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
    - fi-apl-guc:         [PASS][4] -> [DMESG-FAIL][5] ([i915#5334])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@gt_pm:
    - fi-kbl-soraka:      NOTRUN -> [DMESG-FAIL][6] ([i915#1886] / [i915#7913])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

  * igt@kms_chamelium_frames@hdmi-crc-fast:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][7] ([fdo#109271]) +14 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@kms_chamelium_frames@hdmi-crc-fast.html

  * igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1:
    - bat-dg2-8:          [PASS][8] -> [FAIL][9] ([i915#7932])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc@pipe-c-dp-1.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - fi-kbl-soraka:      NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#4579])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-kbl-soraka/igt@kms_setmode@basic-clone-single-crtc.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gem_contexts:
    - {bat-mtlp-8}:       [ABORT][11] -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-mtlp-8/igt@i915_selftest@live@gem_contexts.html

  * igt@i915_selftest@live@gt_mocs:
    - {bat-mtlp-6}:       [DMESG-FAIL][13] ([i915#7059]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

  * igt@i915_selftest@live@slpc:
    - {bat-mtlp-6}:       [DMESG-WARN][15] ([i915#6367]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-mtlp-6/igt@i915_selftest@live@slpc.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-mtlp-6/igt@i915_selftest@live@slpc.html
    - bat-rpls-2:         [DMESG-WARN][17] ([i915#6367]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-rpls-2/igt@i915_selftest@live@slpc.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-rpls-2/igt@i915_selftest@live@slpc.html

  * igt@kms_busy@basic@modeset:
    - {bat-adlp-11}:      [ABORT][19] ([i915#4423]) -> [PASS][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-adlp-11/igt@kms_busy@basic@modeset.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-adlp-11/igt@kms_busy@basic@modeset.html

  * igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1:
    - fi-cfl-8109u:       [ABORT][21] -> [PASS][22]
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/fi-cfl-8109u/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/fi-cfl-8109u/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-dp-1.html

  
#### Warnings ####

  * igt@i915_selftest@live@reset:
    - bat-rpls-1:         [ABORT][23] ([i915#4983] / [i915#7461] / [i915#7981] / [i915#8347] / [i915#8384]) -> [ABORT][24] ([i915#4983] / [i915#7461] / [i915#8347] / [i915#8384])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/bat-rpls-1/igt@i915_selftest@live@reset.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/bat-rpls-1/igt@i915_selftest@live@reset.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4423]: https://gitlab.freedesktop.org/drm/intel/issues/4423
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
  [i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
  [i915#7461]: https://gitlab.freedesktop.org/drm/intel/issues/7461
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#7981]: https://gitlab.freedesktop.org/drm/intel/issues/7981
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
  [i915#8384]: https://gitlab.freedesktop.org/drm/intel/issues/8384
  [i915#8497]: https://gitlab.freedesktop.org/drm/intel/issues/8497


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7322 -> IGTPW_9140

  CI-20190529: 20190529
  CI_DRM_13256: be85dc2d44c075230eec4366e27bc1fe75ee59ff @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9140: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html
  IGT_7322: 2dd77d6d827a308caae49ce3eba759c2bab394ed @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

+igt@xe_gt_idle@idle-residency

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html

[-- Attachment #2: Type: text/html, Size: 8531 bytes --]

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

* [igt-dev] ✓ Fi.CI.IGT: success for tests/xe: Add basic idle residency test
  2023-06-09  9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
  2023-06-09 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2023-06-10 23:43 ` Patchwork
  2023-06-12 13:29 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
  2023-06-14 15:58 ` Nilawar, Badal
  3 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2023-06-10 23:43 UTC (permalink / raw)
  To: Riana Tauro; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 17858 bytes --]

== Series Details ==

Series: tests/xe: Add basic idle residency test
URL   : https://patchwork.freedesktop.org/series/119127/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13256_full -> IGTPW_9140_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html

Participating hosts (7 -> 8)
------------------------------

  Additional (1): shard-rkl0 

Known issues
------------

  Here are the changes found in IGTPW_9140_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_ctx_persistence@processes:
    - shard-snb:          NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#1099]) +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb6/igt@gem_ctx_persistence@processes.html

  * igt@gem_exec_fair@basic-pace-solo@rcs0:
    - shard-glk:          NOTRUN -> [FAIL][2] ([i915#2842])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk1/igt@gem_exec_fair@basic-pace-solo@rcs0.html

  * igt@i915_module_load@load:
    - shard-glk:          NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#6227])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk7/igt@i915_module_load@load.html

  * igt@kms_ccs@pipe-b-bad-rotation-90-y_tiled_gen12_mc_ccs:
    - shard-glk:          NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#3886])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk5/igt@kms_ccs@pipe-b-bad-rotation-90-y_tiled_gen12_mc_ccs.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
    - shard-apl:          [PASS][5] -> [FAIL][6] ([i915#2346])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-apl2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-apl2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
    - shard-snb:          [PASS][7] -> [SKIP][8] ([fdo#109271])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-snb1/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb2/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt.html

  * igt@kms_plane_scaling@plane-downscale-with-pixel-format-factor-0-25@pipe-b-vga-1:
    - shard-snb:          NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#4579]) +19 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb2/igt@kms_plane_scaling@plane-downscale-with-pixel-format-factor-0-25@pipe-b-vga-1.html

  * igt@kms_plane_scaling@plane-scaler-with-clipping-clamping-rotation@pipe-a-vga-1:
    - shard-snb:          NOTRUN -> [SKIP][10] ([fdo#109271]) +89 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb6/igt@kms_plane_scaling@plane-scaler-with-clipping-clamping-rotation@pipe-a-vga-1.html

  * igt@kms_plane_scaling@plane-upscale-with-rotation-20x20@pipe-c-hdmi-a-1:
    - shard-glk:          NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#4579]) +2 similar issues
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk2/igt@kms_plane_scaling@plane-upscale-with-rotation-20x20@pipe-c-hdmi-a-1.html

  * igt@kms_vblank@pipe-d-wait-busy-hang:
    - shard-glk:          NOTRUN -> [SKIP][12] ([fdo#109271]) +37 similar issues
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk9/igt@kms_vblank@pipe-d-wait-busy-hang.html

  
#### Possible fixes ####

  * igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
    - {shard-rkl}:        [FAIL][13] ([i915#7742]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-rkl-4/igt@drm_fdinfo@most-busy-idle-check-all@rcs0.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-rkl-4/igt@drm_fdinfo@most-busy-idle-check-all@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
    - {shard-rkl}:        [FAIL][15] ([i915#6268]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-rkl-4/igt@gem_ctx_exec@basic-nohangcheck.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-rkl-6/igt@gem_ctx_exec@basic-nohangcheck.html

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-apl:          [FAIL][17] ([i915#2842]) -> [PASS][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-apl1/igt@gem_exec_fair@basic-none-solo@rcs0.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-apl6/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@gem_exec_fair@basic-pace@rcs0:
    - {shard-rkl}:        [FAIL][19] ([i915#2842]) -> [PASS][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-rkl-3/igt@gem_exec_fair@basic-pace@rcs0.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-rkl-6/igt@gem_exec_fair@basic-pace@rcs0.html
    - shard-glk:          [FAIL][21] ([i915#2842]) -> [PASS][22] +1 similar issue
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-glk2/igt@gem_exec_fair@basic-pace@rcs0.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk9/igt@gem_exec_fair@basic-pace@rcs0.html

  * igt@gen9_exec_parse@allowed-single:
    - shard-glk:          [ABORT][23] ([i915#5566]) -> [PASS][24]
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-glk5/igt@gen9_exec_parse@allowed-single.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk6/igt@gen9_exec_parse@allowed-single.html

  * igt@i915_pm_dc@dc9-dpms:
    - shard-apl:          [SKIP][25] ([fdo#109271]) -> [PASS][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-apl2/igt@i915_pm_dc@dc9-dpms.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-apl6/igt@i915_pm_dc@dc9-dpms.html

  * igt@i915_pm_rpm@modeset-lpsp-stress:
    - {shard-dg1}:        [SKIP][27] ([i915#1397]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-13/igt@i915_pm_rpm@modeset-lpsp-stress.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-19/igt@i915_pm_rpm@modeset-lpsp-stress.html

  * igt@i915_pm_rps@reset:
    - shard-snb:          [INCOMPLETE][29] ([i915#7790]) -> [PASS][30]
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-snb6/igt@i915_pm_rps@reset.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb1/igt@i915_pm_rps@reset.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - {shard-tglu}:       [ABORT][31] ([i915#8213]) -> [PASS][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-tglu-2/igt@i915_suspend@basic-s2idle-without-i915.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-tglu-4/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@kms_async_flips@alternate-sync-async-flip@pipe-a-vga-1:
    - shard-snb:          [FAIL][33] ([i915#2521]) -> [PASS][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-snb7/igt@kms_async_flips@alternate-sync-async-flip@pipe-a-vga-1.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-snb7/igt@kms_async_flips@alternate-sync-async-flip@pipe-a-vga-1.html

  * igt@kms_async_flips@alternate-sync-async-flip@pipe-b-hdmi-a-1:
    - shard-glk:          [FAIL][35] ([i915#2521]) -> [PASS][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-glk7/igt@kms_async_flips@alternate-sync-async-flip@pipe-b-hdmi-a-1.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-glk2/igt@kms_async_flips@alternate-sync-async-flip@pipe-b-hdmi-a-1.html

  * igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip:
    - {shard-dg1}:        [FAIL][37] ([i915#3743]) -> [PASS][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-19/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-19/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html

  * igt@kms_cursor_legacy@forked-bo@pipe-b:
    - {shard-rkl}:        [INCOMPLETE][39] ([i915#8011]) -> [PASS][40]
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-rkl-7/igt@kms_cursor_legacy@forked-bo@pipe-b.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-rkl-4/igt@kms_cursor_legacy@forked-bo@pipe-b.html

  * igt@kms_cursor_legacy@single-bo@pipe-b:
    - {shard-dg1}:        [INCOMPLETE][41] ([i915#8011] / [i915#8347]) -> [PASS][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-19/igt@kms_cursor_legacy@single-bo@pipe-b.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-12/igt@kms_cursor_legacy@single-bo@pipe-b.html

  * igt@perf_pmu@busy-double-start@vecs0:
    - {shard-dg1}:        [FAIL][43] ([i915#4349]) -> [PASS][44] +1 similar issue
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-13/igt@perf_pmu@busy-double-start@vecs0.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-13/igt@perf_pmu@busy-double-start@vecs0.html

  * igt@perf_pmu@busy-idle-check-all@vecs0:
    - {shard-dg1}:        [FAIL][45] ([i915#4521]) -> [PASS][46] +2 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-17/igt@perf_pmu@busy-idle-check-all@vecs0.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-15/igt@perf_pmu@busy-idle-check-all@vecs0.html

  * igt@perf_pmu@most-busy-idle-check-all@rcs0:
    - {shard-dg1}:        [FAIL][47] ([i915#5234]) -> [PASS][48]
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13256/shard-dg1-15/igt@perf_pmu@most-busy-idle-check-all@rcs0.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/shard-dg1-19/igt@perf_pmu@most-busy-idle-check-all@rcs0.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
  [fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
  [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
  [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
  [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
  [i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
  [i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
  [i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
  [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
  [i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
  [i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
  [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
  [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
  [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
  [i915#3743]: https://gitlab.freedesktop.org/drm/intel/issues/3743
  [i915#3825]: https://gitlab.freedesktop.org/drm/intel/issues/3825
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
  [i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
  [i915#4521]: https://gitlab.freedesktop.org/drm/intel/issues/4521
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
  [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
  [i915#5122]: https://gitlab.freedesktop.org/drm/intel/issues/5122
  [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
  [i915#5234]: https://gitlab.freedesktop.org/drm/intel/issues/5234
  [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
  [i915#5251]: https://gitlab.freedesktop.org/drm/intel/issues/5251
  [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
  [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
  [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
  [i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
  [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
  [i915#6117]: https://gitlab.freedesktop.org/drm/intel/issues/6117
  [i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
  [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
  [i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
  [i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
  [i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
  [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
  [i915#7582]: https://gitlab.freedesktop.org/drm/intel/issues/7582
  [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
  [i915#7790]: https://gitlab.freedesktop.org/drm/intel/issues/7790
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8213]: https://gitlab.freedesktop.org/drm/intel/issues/8213
  [i915#8292]: https://gitlab.freedesktop.org/drm/intel/issues/8292
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347
  [i915#8414]: https://gitlab.freedesktop.org/drm/intel/issues/8414
  [i915#8502]: https://gitlab.freedesktop.org/drm/intel/issues/8502


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7322 -> IGTPW_9140
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_13256: be85dc2d44c075230eec4366e27bc1fe75ee59ff @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_9140: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html
  IGT_7322: 2dd77d6d827a308caae49ce3eba759c2bab394ed @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_9140/index.html

[-- Attachment #2: Type: text/html, Size: 14463 bytes --]

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-09  9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
  2023-06-09 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2023-06-10 23:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2023-06-12 13:29 ` Kamil Konieczny
  2023-06-13  9:47   ` Riana Tauro
  2023-06-14 15:58 ` Nilawar, Badal
  3 siblings, 1 reply; 10+ messages in thread
From: Kamil Konieczny @ 2023-06-12 13:29 UTC (permalink / raw)
  To: igt-dev; +Cc: badal.nilawar

Hi Riana,

On 2023-06-09 at 15:14:57 +0530, Riana Tauro wrote:
> The test reads idle residency within a time interval and
> checks if its within the tolerance
> 
> Currently the test checks RC6 Residency
> 
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>  tests/meson.build     |   1 +
>  tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 118 insertions(+)
>  create mode 100644 tests/xe/xe_gt_idle.c
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index c15eb3a08..10273ebf5 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -254,6 +254,7 @@ xe_progs = [
>  	'xe_exec_fault_mode',
>  	'xe_exec_reset',
>  	'xe_exec_threads',
> +	'xe_gt_idle',

Could you change name to xe_pm or xe_power?
imho xe_pm is better name.

Regards,
Kamil

>  	'xe_gpgpu_fill',
>  	'xe_guc_pc',
>  	'xe_huc_copy',
> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
> new file mode 100644
> index 000000000..3a1090ffd
> --- /dev/null
> +++ b/tests/xe/xe_gt_idle.c
> @@ -0,0 +1,117 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: Test gtidle properties
> + * Category: Software building block
> + * Sub-category: Power Management
> + * Functionality: RC6
> + * Test category: functionality test
> + */
> +
> +#include <limits.h>
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +
> +#include "xe/xe_query.h"
> +
> +#define SLEEP_DURATION 3 /* in seconds */
> +
> +const double tolerance = 0.1;
> +
> +#define assert_within_epsilon(x, ref, tol) \
> +	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
> +		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
> +		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
> +		     #x, #ref, (double)(x), \
> +		     (tol) * 100.0, (tol) * 100.0, \
> +		     (double)(ref))
> +
> +static bool in_rc6(int sysfs, int gt)
> +{
> +	char path[PATH_MAX];
> +	char rc[8];
> +
> +	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> +		return false;
> +
> +	return strcmp(rc, "rc6") == 0;
> +}
> +
> +static bool is_rc_dir(int sysfs, int gt)
> +{
> +	char path[PATH_MAX], name[NAME_MAX];
> +	char rc[8];
> +
> +	sprintf(path, "device/gt%d/gtidle/name", gt);
> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> +		return false;
> +
> +	sprintf(name, "gt%d-rc", gt);
> +	return strcmp(rc, name) == 0;
> +}
> +
> +static unsigned long read_idle_residency(int sysfs, int gt)
> +{
> +	unsigned long residency;
> +	char path[PATH_MAX];
> +
> +	residency = 0;
> +	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
> +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
> +	return residency;
> +}
> +
> +/**
> + * SUBTEST: idle-residency
> + * Description: basic residency test to check idle residency
> + * 		within a time interval
> + * Run type: FULL
> + */
> +static void test_idle(int sysfs, int gt)
> +{
> +	struct timespec tv;
> +	unsigned long elapsed_ms, residency_start, residency_end;
> +
> +	assert(is_rc_dir(sysfs, gt));
> +	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
> +
> +	igt_gettime(&tv);
> +	residency_start = read_idle_residency(sysfs, gt);
> +	sleep(SLEEP_DURATION);
> +	residency_end = read_idle_residency(sysfs, gt);
> +	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
> +
> +	igt_info("Measured %lums of idle residency in %lums\n",
> +		 residency_end - residency_start, elapsed_ms);
> +
> +	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
> +}
> +
> +igt_main
> +{
> +	int fd, gt;
> +	static int sysfs = -1;
> +
> +	igt_fixture {
> +		fd = drm_open_driver(DRIVER_XE);
> +
> +		xe_device_get(fd);
> +		sysfs = igt_sysfs_open(fd);
> +		igt_assert(sysfs != -1);
> +	}
> +
> +	igt_subtest("idle-residency")
> +		xe_for_each_gt(fd, gt)
> +			test_idle(sysfs, gt);
> +
> +	igt_fixture {
> +		close(sysfs);
> +		xe_device_put(fd);
> +		close(fd);
> +	}
> +}
> -- 
> 2.40.0
> 

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-12 13:29 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
@ 2023-06-13  9:47   ` Riana Tauro
  2023-06-14 13:27     ` Kamil Konieczny
  0 siblings, 1 reply; 10+ messages in thread
From: Riana Tauro @ 2023-06-13  9:47 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev, badal.nilawar, Gupta, Anshuman



On 6/12/2023 6:59 PM, Kamil Konieczny wrote:
> Hi Riana,
> 
> On 2023-06-09 at 15:14:57 +0530, Riana Tauro wrote:
>> The test reads idle residency within a time interval and
>> checks if its within the tolerance
>>
>> Currently the test checks RC6 Residency
>>
>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>> ---
>>   tests/meson.build     |   1 +
>>   tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 118 insertions(+)
>>   create mode 100644 tests/xe/xe_gt_idle.c
>>
>> diff --git a/tests/meson.build b/tests/meson.build
>> index c15eb3a08..10273ebf5 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -254,6 +254,7 @@ xe_progs = [
>>   	'xe_exec_fault_mode',
>>   	'xe_exec_reset',
>>   	'xe_exec_threads',
>> +	'xe_gt_idle',
> 
> Could you change name to xe_pm or xe_power?
> imho xe_pm is better name.

Hi Kamil

There is already a test with xe_pm [Suspend tests].
This patch is a test for 
https://patchwork.freedesktop.org/series/119262/ [gtidle properties]

Is xe_gt_idle okay? or should i rename it to xe_pm_residency?

Thanks
Riana


> 
> Regards,
> Kamil
> 
>>   	'xe_gpgpu_fill',
>>   	'xe_guc_pc',
>>   	'xe_huc_copy',
>> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
>> new file mode 100644
>> index 000000000..3a1090ffd
>> --- /dev/null
>> +++ b/tests/xe/xe_gt_idle.c
>> @@ -0,0 +1,117 @@
>> +// SPDX-License-Identifier: MIT
>> +/*
>> + * Copyright © 2023 Intel Corporation
>> + */
>> +
>> +/**
>> + * TEST: Test gtidle properties
>> + * Category: Software building block
>> + * Sub-category: Power Management
>> + * Functionality: RC6
>> + * Test category: functionality test
>> + */
>> +
>> +#include <limits.h>
>> +
>> +#include "igt.h"
>> +#include "igt_sysfs.h"
>> +
>> +#include "xe/xe_query.h"
>> +
>> +#define SLEEP_DURATION 3 /* in seconds */
>> +
>> +const double tolerance = 0.1;
>> +
>> +#define assert_within_epsilon(x, ref, tol) \
>> +	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
>> +		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
>> +		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
>> +		     #x, #ref, (double)(x), \
>> +		     (tol) * 100.0, (tol) * 100.0, \
>> +		     (double)(ref))
>> +
>> +static bool in_rc6(int sysfs, int gt)
>> +{
>> +	char path[PATH_MAX];
>> +	char rc[8];
>> +
>> +	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
>> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>> +		return false;
>> +
>> +	return strcmp(rc, "rc6") == 0;
>> +}
>> +
>> +static bool is_rc_dir(int sysfs, int gt)
>> +{
>> +	char path[PATH_MAX], name[NAME_MAX];
>> +	char rc[8];
>> +
>> +	sprintf(path, "device/gt%d/gtidle/name", gt);
>> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>> +		return false;
>> +
>> +	sprintf(name, "gt%d-rc", gt);
>> +	return strcmp(rc, name) == 0;
>> +}
>> +
>> +static unsigned long read_idle_residency(int sysfs, int gt)
>> +{
>> +	unsigned long residency;
>> +	char path[PATH_MAX];
>> +
>> +	residency = 0;
>> +	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
>> +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
>> +	return residency;
>> +}
>> +
>> +/**
>> + * SUBTEST: idle-residency
>> + * Description: basic residency test to check idle residency
>> + * 		within a time interval
>> + * Run type: FULL
>> + */
>> +static void test_idle(int sysfs, int gt)
>> +{
>> +	struct timespec tv;
>> +	unsigned long elapsed_ms, residency_start, residency_end;
>> +
>> +	assert(is_rc_dir(sysfs, gt));
>> +	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
>> +
>> +	igt_gettime(&tv);
>> +	residency_start = read_idle_residency(sysfs, gt);
>> +	sleep(SLEEP_DURATION);
>> +	residency_end = read_idle_residency(sysfs, gt);
>> +	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
>> +
>> +	igt_info("Measured %lums of idle residency in %lums\n",
>> +		 residency_end - residency_start, elapsed_ms);
>> +
>> +	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
>> +}
>> +
>> +igt_main
>> +{
>> +	int fd, gt;
>> +	static int sysfs = -1;
>> +
>> +	igt_fixture {
>> +		fd = drm_open_driver(DRIVER_XE);
>> +
>> +		xe_device_get(fd);
>> +		sysfs = igt_sysfs_open(fd);
>> +		igt_assert(sysfs != -1);
>> +	}
>> +
>> +	igt_subtest("idle-residency")
>> +		xe_for_each_gt(fd, gt)
>> +			test_idle(sysfs, gt);
>> +
>> +	igt_fixture {
>> +		close(sysfs);
>> +		xe_device_put(fd);
>> +		close(fd);
>> +	}
>> +}
>> -- 
>> 2.40.0
>>

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-13  9:47   ` Riana Tauro
@ 2023-06-14 13:27     ` Kamil Konieczny
  2023-06-21  4:31       ` Riana Tauro
  0 siblings, 1 reply; 10+ messages in thread
From: Kamil Konieczny @ 2023-06-14 13:27 UTC (permalink / raw)
  To: igt-dev; +Cc: badal.nilawar

Hi Riana,

On 2023-06-13 at 15:17:24 +0530, Riana Tauro wrote:
> 
> 
> On 6/12/2023 6:59 PM, Kamil Konieczny wrote:
> > Hi Riana,
> > 
> > On 2023-06-09 at 15:14:57 +0530, Riana Tauro wrote:
> > > The test reads idle residency within a time interval and
> > > checks if its within the tolerance
> > > 
> > > Currently the test checks RC6 Residency
> > > 
> > > Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> > > ---
> > >   tests/meson.build     |   1 +
> > >   tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
> > >   2 files changed, 118 insertions(+)
> > >   create mode 100644 tests/xe/xe_gt_idle.c
> > > 
> > > diff --git a/tests/meson.build b/tests/meson.build
> > > index c15eb3a08..10273ebf5 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -254,6 +254,7 @@ xe_progs = [
> > >   	'xe_exec_fault_mode',
> > >   	'xe_exec_reset',
> > >   	'xe_exec_threads',
> > > +	'xe_gt_idle',
> > 
> > Could you change name to xe_pm or xe_power?
> > imho xe_pm is better name.
> 
> Hi Kamil
> 
> There is already a test with xe_pm [Suspend tests].
> This patch is a test for https://patchwork.freedesktop.org/series/119262/
> [gtidle properties]

Thank you for pointing this, please include it also in your
commit description also with name of patch series (as links
can later dissapear).

> 
> Is xe_gt_idle okay? or should i rename it to xe_pm_residency?
> 
> Thanks
> Riana

This looks better: xe_pm_residency

These are i915 tests related to pm:

ls -1 |grep _pm_

i915_pm_backlight.c
i915_pm_dc.c
i915_pm_freq_api.c
i915_pm_freq_mult.c
i915_pm_lpsp.c
i915_pm_rc6_residency.c
i915_pm_rpm.c
i915_pm_rps.c
i915_pm_sseu.c

Why not make it a subtest in xe_pm.c ?

Regards,
Kamil

> 
> 
> > 
> > Regards,
> > Kamil
> > 
> > >   	'xe_gpgpu_fill',
> > >   	'xe_guc_pc',
> > >   	'xe_huc_copy',
> > > diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
> > > new file mode 100644
> > > index 000000000..3a1090ffd
> > > --- /dev/null
> > > +++ b/tests/xe/xe_gt_idle.c
> > > @@ -0,0 +1,117 @@
> > > +// SPDX-License-Identifier: MIT
> > > +/*
> > > + * Copyright © 2023 Intel Corporation
> > > + */
> > > +
> > > +/**
> > > + * TEST: Test gtidle properties
> > > + * Category: Software building block
> > > + * Sub-category: Power Management
> > > + * Functionality: RC6
> > > + * Test category: functionality test
> > > + */
> > > +
> > > +#include <limits.h>
> > > +
> > > +#include "igt.h"
> > > +#include "igt_sysfs.h"
> > > +
> > > +#include "xe/xe_query.h"
> > > +
> > > +#define SLEEP_DURATION 3 /* in seconds */
> > > +
> > > +const double tolerance = 0.1;
> > > +
> > > +#define assert_within_epsilon(x, ref, tol) \
> > > +	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
> > > +		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
> > > +		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
> > > +		     #x, #ref, (double)(x), \
> > > +		     (tol) * 100.0, (tol) * 100.0, \
> > > +		     (double)(ref))
> > > +
> > > +static bool in_rc6(int sysfs, int gt)
> > > +{
> > > +	char path[PATH_MAX];
> > > +	char rc[8];
> > > +
> > > +	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
> > > +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> > > +		return false;
> > > +
> > > +	return strcmp(rc, "rc6") == 0;
> > > +}
> > > +
> > > +static bool is_rc_dir(int sysfs, int gt)
> > > +{
> > > +	char path[PATH_MAX], name[NAME_MAX];
> > > +	char rc[8];
> > > +
> > > +	sprintf(path, "device/gt%d/gtidle/name", gt);
> > > +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> > > +		return false;
> > > +
> > > +	sprintf(name, "gt%d-rc", gt);
> > > +	return strcmp(rc, name) == 0;
> > > +}
> > > +
> > > +static unsigned long read_idle_residency(int sysfs, int gt)
> > > +{
> > > +	unsigned long residency;
> > > +	char path[PATH_MAX];
> > > +
> > > +	residency = 0;
> > > +	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
> > > +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
> > > +	return residency;
> > > +}
> > > +
> > > +/**
> > > + * SUBTEST: idle-residency
> > > + * Description: basic residency test to check idle residency
> > > + * 		within a time interval
> > > + * Run type: FULL
> > > + */
> > > +static void test_idle(int sysfs, int gt)
> > > +{
> > > +	struct timespec tv;
> > > +	unsigned long elapsed_ms, residency_start, residency_end;
> > > +
> > > +	assert(is_rc_dir(sysfs, gt));
> > > +	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
> > > +
> > > +	igt_gettime(&tv);
> > > +	residency_start = read_idle_residency(sysfs, gt);
> > > +	sleep(SLEEP_DURATION);
> > > +	residency_end = read_idle_residency(sysfs, gt);
> > > +	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
> > > +
> > > +	igt_info("Measured %lums of idle residency in %lums\n",
> > > +		 residency_end - residency_start, elapsed_ms);
> > > +
> > > +	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
> > > +}
> > > +
> > > +igt_main
> > > +{
> > > +	int fd, gt;
> > > +	static int sysfs = -1;
> > > +
> > > +	igt_fixture {
> > > +		fd = drm_open_driver(DRIVER_XE);
> > > +
> > > +		xe_device_get(fd);
> > > +		sysfs = igt_sysfs_open(fd);
> > > +		igt_assert(sysfs != -1);
> > > +	}
> > > +
> > > +	igt_subtest("idle-residency")
> > > +		xe_for_each_gt(fd, gt)
> > > +			test_idle(sysfs, gt);
> > > +
> > > +	igt_fixture {
> > > +		close(sysfs);
> > > +		xe_device_put(fd);
> > > +		close(fd);
> > > +	}
> > > +}
> > > -- 
> > > 2.40.0
> > > 

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-09  9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
                   ` (2 preceding siblings ...)
  2023-06-12 13:29 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
@ 2023-06-14 15:58 ` Nilawar, Badal
  2023-06-15  7:57   ` Riana Tauro
  3 siblings, 1 reply; 10+ messages in thread
From: Nilawar, Badal @ 2023-06-14 15:58 UTC (permalink / raw)
  To: Riana Tauro, igt-dev

Hi Riana,

On 09-06-2023 15:14, Riana Tauro wrote:
> The test reads idle residency within a time interval and
> checks if its within the tolerance
> 
> Currently the test checks RC6 Residency
> 
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>   tests/meson.build     |   1 +
>   tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 118 insertions(+)
>   create mode 100644 tests/xe/xe_gt_idle.c
> 
> diff --git a/tests/meson.build b/tests/meson.build
> index c15eb3a08..10273ebf5 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -254,6 +254,7 @@ xe_progs = [
>   	'xe_exec_fault_mode',
>   	'xe_exec_reset',
>   	'xe_exec_threads',
> +	'xe_gt_idle',
>   	'xe_gpgpu_fill',
>   	'xe_guc_pc',
>   	'xe_huc_copy',
> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
> new file mode 100644
> index 000000000..3a1090ffd
> --- /dev/null
> +++ b/tests/xe/xe_gt_idle.c
> @@ -0,0 +1,117 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +/**
> + * TEST: Test gtidle properties
> + * Category: Software building block
> + * Sub-category: Power Management
> + * Functionality: RC6
> + * Test category: functionality test
> + */
> +
> +#include <limits.h>
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +
> +#include "xe/xe_query.h"
> +
> +#define SLEEP_DURATION 3 /* in seconds */
> +
> +const double tolerance = 0.1;
> +
> +#define assert_within_epsilon(x, ref, tol) \
> +	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
> +		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
> +		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
> +		     #x, #ref, (double)(x), \
> +		     (tol) * 100.0, (tol) * 100.0, \
> +		     (double)(ref))
> +
> +static bool in_rc6(int sysfs, int gt)
> +{
> +	char path[PATH_MAX];
> +	char rc[8];
> +
> +	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> +		return false;
> +
> +	return strcmp(rc, "rc6") == 0;
> +}
This function is also defined in xe_guc_pc.c. So how about making this 
function as library function may be under new file lib/xe/xe_pm.c.

Regards,
Badal
> +
> +static bool is_rc_dir(int sysfs, int gt)
> +{
> +	char path[PATH_MAX], name[NAME_MAX];
> +	char rc[8];
> +
> +	sprintf(path, "device/gt%d/gtidle/name", gt);
> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
> +		return false;
> +
> +	sprintf(name, "gt%d-rc", gt);
> +	return strcmp(rc, name) == 0;
> +}
> +
> +static unsigned long read_idle_residency(int sysfs, int gt)
> +{
> +	unsigned long residency;
> +	char path[PATH_MAX];
> +
> +	residency = 0;
> +	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
> +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
> +	return residency;
> +}
> +
> +/**
> + * SUBTEST: idle-residency
> + * Description: basic residency test to check idle residency
> + * 		within a time interval
> + * Run type: FULL
> + */
> +static void test_idle(int sysfs, int gt)
> +{
> +	struct timespec tv;
> +	unsigned long elapsed_ms, residency_start, residency_end;
> +
> +	assert(is_rc_dir(sysfs, gt));
> +	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
> +
> +	igt_gettime(&tv);
> +	residency_start = read_idle_residency(sysfs, gt);
> +	sleep(SLEEP_DURATION);
> +	residency_end = read_idle_residency(sysfs, gt);
> +	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
> +
> +	igt_info("Measured %lums of idle residency in %lums\n",
> +		 residency_end - residency_start, elapsed_ms);
> +
> +	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
> +}
> +
> +igt_main
> +{
> +	int fd, gt;
> +	static int sysfs = -1;
> +
> +	igt_fixture {
> +		fd = drm_open_driver(DRIVER_XE);
> +
> +		xe_device_get(fd);
> +		sysfs = igt_sysfs_open(fd);
> +		igt_assert(sysfs != -1);
> +	}
> +
> +	igt_subtest("idle-residency")
> +		xe_for_each_gt(fd, gt)
> +			test_idle(sysfs, gt);
> +
> +	igt_fixture {
> +		close(sysfs);
> +		xe_device_put(fd);
> +		close(fd);
> +	}
> +}

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-14 15:58 ` Nilawar, Badal
@ 2023-06-15  7:57   ` Riana Tauro
  2023-06-15 11:33     ` Nilawar, Badal
  0 siblings, 1 reply; 10+ messages in thread
From: Riana Tauro @ 2023-06-15  7:57 UTC (permalink / raw)
  To: Nilawar, Badal, igt-dev



On 6/14/2023 9:28 PM, Nilawar, Badal wrote:
> Hi Riana,
> 
> On 09-06-2023 15:14, Riana Tauro wrote:
>> The test reads idle residency within a time interval and
>> checks if its within the tolerance
>>
>> Currently the test checks RC6 Residency
>>
>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>> ---
>>   tests/meson.build     |   1 +
>>   tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 118 insertions(+)
>>   create mode 100644 tests/xe/xe_gt_idle.c
>>
>> diff --git a/tests/meson.build b/tests/meson.build
>> index c15eb3a08..10273ebf5 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -254,6 +254,7 @@ xe_progs = [
>>       'xe_exec_fault_mode',
>>       'xe_exec_reset',
>>       'xe_exec_threads',
>> +    'xe_gt_idle',
>>       'xe_gpgpu_fill',
>>       'xe_guc_pc',
>>       'xe_huc_copy',
>> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
>> new file mode 100644
>> index 000000000..3a1090ffd
>> --- /dev/null
>> +++ b/tests/xe/xe_gt_idle.c
>> @@ -0,0 +1,117 @@
>> +// SPDX-License-Identifier: MIT
>> +/*
>> + * Copyright © 2023 Intel Corporation
>> + */
>> +
>> +/**
>> + * TEST: Test gtidle properties
>> + * Category: Software building block
>> + * Sub-category: Power Management
>> + * Functionality: RC6
>> + * Test category: functionality test
>> + */
>> +
>> +#include <limits.h>
>> +
>> +#include "igt.h"
>> +#include "igt_sysfs.h"
>> +
>> +#include "xe/xe_query.h"
>> +
>> +#define SLEEP_DURATION 3 /* in seconds */
>> +
>> +const double tolerance = 0.1;
>> +
>> +#define assert_within_epsilon(x, ref, tol) \
>> +    igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
>> +             (double)(x) >= (1.0 - (tol)) * (double)(ref), \
>> +             "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance 
>> of %f)\n",\
>> +             #x, #ref, (double)(x), \
>> +             (tol) * 100.0, (tol) * 100.0, \
>> +             (double)(ref))
>> +
>> +static bool in_rc6(int sysfs, int gt)
>> +{
>> +    char path[PATH_MAX];
>> +    char rc[8];
>> +
>> +    sprintf(path, "device/gt%d/gtidle/idle_status", gt);
>> +    if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>> +        return false;
>> +
>> +    return strcmp(rc, "rc6") == 0;
>> +}
> This function is also defined in xe_guc_pc.c. So how about making this 
> function as library function may be under new file lib/xe/xe_pm.c.
Hi Badal

Intention is to move all the rc tests in guc_pc to this file
Would this be needed by any other tests?

Thanks
Riana
> 
> Regards,
> Badal
>> +
>> +static bool is_rc_dir(int sysfs, int gt)
>> +{
>> +    char path[PATH_MAX], name[NAME_MAX];
>> +    char rc[8];
>> +
>> +    sprintf(path, "device/gt%d/gtidle/name", gt);
>> +    if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>> +        return false;
>> +
>> +    sprintf(name, "gt%d-rc", gt);
>> +    return strcmp(rc, name) == 0;
>> +}
>> +
>> +static unsigned long read_idle_residency(int sysfs, int gt)
>> +{
>> +    unsigned long residency;
>> +    char path[PATH_MAX];
>> +
>> +    residency = 0;
>> +    sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
>> +    igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
>> +    return residency;
>> +}
>> +
>> +/**
>> + * SUBTEST: idle-residency
>> + * Description: basic residency test to check idle residency
>> + *         within a time interval
>> + * Run type: FULL
>> + */
>> +static void test_idle(int sysfs, int gt)
>> +{
>> +    struct timespec tv;
>> +    unsigned long elapsed_ms, residency_start, residency_end;
>> +
>> +    assert(is_rc_dir(sysfs, gt));
>> +    assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
>> +
>> +    igt_gettime(&tv);
>> +    residency_start = read_idle_residency(sysfs, gt);
>> +    sleep(SLEEP_DURATION);
>> +    residency_end = read_idle_residency(sysfs, gt);
>> +    elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
>> +
>> +    igt_info("Measured %lums of idle residency in %lums\n",
>> +         residency_end - residency_start, elapsed_ms);
>> +
>> +    assert_within_epsilon(residency_end - residency_start, 
>> elapsed_ms, tolerance);
>> +}
>> +
>> +igt_main
>> +{
>> +    int fd, gt;
>> +    static int sysfs = -1;
>> +
>> +    igt_fixture {
>> +        fd = drm_open_driver(DRIVER_XE);
>> +
>> +        xe_device_get(fd);
>> +        sysfs = igt_sysfs_open(fd);
>> +        igt_assert(sysfs != -1);
>> +    }
>> +
>> +    igt_subtest("idle-residency")
>> +        xe_for_each_gt(fd, gt)
>> +            test_idle(sysfs, gt);
>> +
>> +    igt_fixture {
>> +        close(sysfs);
>> +        xe_device_put(fd);
>> +        close(fd);
>> +    }
>> +}

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-15  7:57   ` Riana Tauro
@ 2023-06-15 11:33     ` Nilawar, Badal
  0 siblings, 0 replies; 10+ messages in thread
From: Nilawar, Badal @ 2023-06-15 11:33 UTC (permalink / raw)
  To: Riana Tauro, igt-dev



On 15-06-2023 13:27, Riana Tauro wrote:
> 
> 
> On 6/14/2023 9:28 PM, Nilawar, Badal wrote:
>> Hi Riana,
>>
>> On 09-06-2023 15:14, Riana Tauro wrote:
>>> The test reads idle residency within a time interval and
>>> checks if its within the tolerance
>>>
>>> Currently the test checks RC6 Residency
>>>
>>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>>> ---
>>>   tests/meson.build     |   1 +
>>>   tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>>>   2 files changed, 118 insertions(+)
>>>   create mode 100644 tests/xe/xe_gt_idle.c
>>>
>>> diff --git a/tests/meson.build b/tests/meson.build
>>> index c15eb3a08..10273ebf5 100644
>>> --- a/tests/meson.build
>>> +++ b/tests/meson.build
>>> @@ -254,6 +254,7 @@ xe_progs = [
>>>       'xe_exec_fault_mode',
>>>       'xe_exec_reset',
>>>       'xe_exec_threads',
>>> +    'xe_gt_idle',
>>>       'xe_gpgpu_fill',
>>>       'xe_guc_pc',
>>>       'xe_huc_copy',
>>> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
>>> new file mode 100644
>>> index 000000000..3a1090ffd
>>> --- /dev/null
>>> +++ b/tests/xe/xe_gt_idle.c
>>> @@ -0,0 +1,117 @@
>>> +// SPDX-License-Identifier: MIT
>>> +/*
>>> + * Copyright © 2023 Intel Corporation
>>> + */
>>> +
>>> +/**
>>> + * TEST: Test gtidle properties
>>> + * Category: Software building block
>>> + * Sub-category: Power Management
>>> + * Functionality: RC6
>>> + * Test category: functionality test
>>> + */
>>> +
>>> +#include <limits.h>
>>> +
>>> +#include "igt.h"
>>> +#include "igt_sysfs.h"
>>> +
>>> +#include "xe/xe_query.h"
>>> +
>>> +#define SLEEP_DURATION 3 /* in seconds */
>>> +
>>> +const double tolerance = 0.1;
>>> +
>>> +#define assert_within_epsilon(x, ref, tol) \
>>> +    igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
>>> +             (double)(x) >= (1.0 - (tol)) * (double)(ref), \
>>> +             "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance 
>>> of %f)\n",\
>>> +             #x, #ref, (double)(x), \
>>> +             (tol) * 100.0, (tol) * 100.0, \
>>> +             (double)(ref))
>>> +
>>> +static bool in_rc6(int sysfs, int gt)
>>> +{
>>> +    char path[PATH_MAX];
>>> +    char rc[8];
>>> +
>>> +    sprintf(path, "device/gt%d/gtidle/idle_status", gt);
>>> +    if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>> +        return false;
>>> +
>>> +    return strcmp(rc, "rc6") == 0;
>>> +}
>> This function is also defined in xe_guc_pc.c. So how about making this 
>> function as library function may be under new file lib/xe/xe_pm.c.
> Hi Badal
> 
> Intention is to move all the rc tests in guc_pc to this file
> Would this be needed by any other tests?
In that case this is not needed.
Thanks,
Badal
> 
> Thanks
> Riana
>>
>> Regards,
>> Badal
>>> +
>>> +static bool is_rc_dir(int sysfs, int gt)
>>> +{
>>> +    char path[PATH_MAX], name[NAME_MAX];
>>> +    char rc[8];
>>> +
>>> +    sprintf(path, "device/gt%d/gtidle/name", gt);
>>> +    if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>> +        return false;
>>> +
>>> +    sprintf(name, "gt%d-rc", gt);
>>> +    return strcmp(rc, name) == 0;
>>> +}
>>> +
>>> +static unsigned long read_idle_residency(int sysfs, int gt)
>>> +{
>>> +    unsigned long residency;
>>> +    char path[PATH_MAX];
>>> +
>>> +    residency = 0;
>>> +    sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
>>> +    igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
>>> +    return residency;
>>> +}
>>> +
>>> +/**
>>> + * SUBTEST: idle-residency
>>> + * Description: basic residency test to check idle residency
>>> + *         within a time interval
>>> + * Run type: FULL
>>> + */
>>> +static void test_idle(int sysfs, int gt)
>>> +{
>>> +    struct timespec tv;
>>> +    unsigned long elapsed_ms, residency_start, residency_end;
>>> +
>>> +    assert(is_rc_dir(sysfs, gt));
>>> +    assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
>>> +
>>> +    igt_gettime(&tv);
>>> +    residency_start = read_idle_residency(sysfs, gt);
>>> +    sleep(SLEEP_DURATION);
>>> +    residency_end = read_idle_residency(sysfs, gt);
>>> +    elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
>>> +
>>> +    igt_info("Measured %lums of idle residency in %lums\n",
>>> +         residency_end - residency_start, elapsed_ms);
>>> +
>>> +    assert_within_epsilon(residency_end - residency_start, 
>>> elapsed_ms, tolerance);
>>> +}
>>> +
>>> +igt_main
>>> +{
>>> +    int fd, gt;
>>> +    static int sysfs = -1;
>>> +
>>> +    igt_fixture {
>>> +        fd = drm_open_driver(DRIVER_XE);
>>> +
>>> +        xe_device_get(fd);
>>> +        sysfs = igt_sysfs_open(fd);
>>> +        igt_assert(sysfs != -1);
>>> +    }
>>> +
>>> +    igt_subtest("idle-residency")
>>> +        xe_for_each_gt(fd, gt)
>>> +            test_idle(sysfs, gt);
>>> +
>>> +    igt_fixture {
>>> +        close(sysfs);
>>> +        xe_device_put(fd);
>>> +        close(fd);
>>> +    }
>>> +}

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

* Re: [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test
  2023-06-14 13:27     ` Kamil Konieczny
@ 2023-06-21  4:31       ` Riana Tauro
  0 siblings, 0 replies; 10+ messages in thread
From: Riana Tauro @ 2023-06-21  4:31 UTC (permalink / raw)
  To: Kamil Konieczny, igt-dev, badal.nilawar, Gupta, Anshuman

Hi Kamil

On 6/14/2023 6:57 PM, Kamil Konieczny wrote:
> Hi Riana,
> 
> On 2023-06-13 at 15:17:24 +0530, Riana Tauro wrote:
>>
>>
>> On 6/12/2023 6:59 PM, Kamil Konieczny wrote:
>>> Hi Riana,
>>>
>>> On 2023-06-09 at 15:14:57 +0530, Riana Tauro wrote:
>>>> The test reads idle residency within a time interval and
>>>> checks if its within the tolerance
>>>>
>>>> Currently the test checks RC6 Residency
>>>>
>>>> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>>>> ---
>>>>    tests/meson.build     |   1 +
>>>>    tests/xe/xe_gt_idle.c | 117 ++++++++++++++++++++++++++++++++++++++++++
>>>>    2 files changed, 118 insertions(+)
>>>>    create mode 100644 tests/xe/xe_gt_idle.c
>>>>
>>>> diff --git a/tests/meson.build b/tests/meson.build
>>>> index c15eb3a08..10273ebf5 100644
>>>> --- a/tests/meson.build
>>>> +++ b/tests/meson.build
>>>> @@ -254,6 +254,7 @@ xe_progs = [
>>>>    	'xe_exec_fault_mode',
>>>>    	'xe_exec_reset',
>>>>    	'xe_exec_threads',
>>>> +	'xe_gt_idle',
>>>
>>> Could you change name to xe_pm or xe_power?
>>> imho xe_pm is better name.
>>
>> Hi Kamil
>>
>> There is already a test with xe_pm [Suspend tests].
>> This patch is a test for https://patchwork.freedesktop.org/series/119262/
>> [gtidle properties]
> 
> Thank you for pointing this, please include it also in your
> commit description also with name of patch series (as links
> can later dissapear).
Sure will add it
> 
>>
>> Is xe_gt_idle okay? or should i rename it to xe_pm_residency?
>>
>> Thanks
>> Riana
> 
> This looks better: xe_pm_residency
> 
> These are i915 tests related to pm:
> 
> ls -1 |grep _pm_
> 
> i915_pm_backlight.c
> i915_pm_dc.c
> i915_pm_freq_api.c
> i915_pm_freq_mult.c
> i915_pm_lpsp.c
> i915_pm_rc6_residency.c
> i915_pm_rpm.c
> i915_pm_rps.c
> i915_pm_sseu.c
> 
> Why not make it a subtest in xe_pm.c ?
There will be 4-6 more tests for status & residency.
Will rename it to xe_pm_residency as xe_pm has tests related to suspend

Thanks
Riana
> 
> Regards,
> Kamil
> 
>>
>>
>>>
>>> Regards,
>>> Kamil
>>>
>>>>    	'xe_gpgpu_fill',
>>>>    	'xe_guc_pc',
>>>>    	'xe_huc_copy',
>>>> diff --git a/tests/xe/xe_gt_idle.c b/tests/xe/xe_gt_idle.c
>>>> new file mode 100644
>>>> index 000000000..3a1090ffd
>>>> --- /dev/null
>>>> +++ b/tests/xe/xe_gt_idle.c
>>>> @@ -0,0 +1,117 @@
>>>> +// SPDX-License-Identifier: MIT
>>>> +/*
>>>> + * Copyright © 2023 Intel Corporation
>>>> + */
>>>> +
>>>> +/**
>>>> + * TEST: Test gtidle properties
>>>> + * Category: Software building block
>>>> + * Sub-category: Power Management
>>>> + * Functionality: RC6
>>>> + * Test category: functionality test
>>>> + */
>>>> +
>>>> +#include <limits.h>
>>>> +
>>>> +#include "igt.h"
>>>> +#include "igt_sysfs.h"
>>>> +
>>>> +#include "xe/xe_query.h"
>>>> +
>>>> +#define SLEEP_DURATION 3 /* in seconds */
>>>> +
>>>> +const double tolerance = 0.1;
>>>> +
>>>> +#define assert_within_epsilon(x, ref, tol) \
>>>> +	igt_assert_f((double)(x) <= (1.0 + (tol)) * (double)(ref) && \
>>>> +		     (double)(x) >= (1.0 - (tol)) * (double)(ref), \
>>>> +		     "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
>>>> +		     #x, #ref, (double)(x), \
>>>> +		     (tol) * 100.0, (tol) * 100.0, \
>>>> +		     (double)(ref))
>>>> +
>>>> +static bool in_rc6(int sysfs, int gt)
>>>> +{
>>>> +	char path[PATH_MAX];
>>>> +	char rc[8];
>>>> +
>>>> +	sprintf(path, "device/gt%d/gtidle/idle_status", gt);
>>>> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>>> +		return false;
>>>> +
>>>> +	return strcmp(rc, "rc6") == 0;
>>>> +}
>>>> +
>>>> +static bool is_rc_dir(int sysfs, int gt)
>>>> +{
>>>> +	char path[PATH_MAX], name[NAME_MAX];
>>>> +	char rc[8];
>>>> +
>>>> +	sprintf(path, "device/gt%d/gtidle/name", gt);
>>>> +	if (igt_sysfs_scanf(sysfs, path, "%s", rc) < 0)
>>>> +		return false;
>>>> +
>>>> +	sprintf(name, "gt%d-rc", gt);
>>>> +	return strcmp(rc, name) == 0;
>>>> +}
>>>> +
>>>> +static unsigned long read_idle_residency(int sysfs, int gt)
>>>> +{
>>>> +	unsigned long residency;
>>>> +	char path[PATH_MAX];
>>>> +
>>>> +	residency = 0;
>>>> +	sprintf(path, "device/gt%d/gtidle/idle_residency_ms", gt);
>>>> +	igt_assert(igt_sysfs_scanf(sysfs, path, "%lu", &residency) == 1);
>>>> +	return residency;
>>>> +}
>>>> +
>>>> +/**
>>>> + * SUBTEST: idle-residency
>>>> + * Description: basic residency test to check idle residency
>>>> + * 		within a time interval
>>>> + * Run type: FULL
>>>> + */
>>>> +static void test_idle(int sysfs, int gt)
>>>> +{
>>>> +	struct timespec tv;
>>>> +	unsigned long elapsed_ms, residency_start, residency_end;
>>>> +
>>>> +	assert(is_rc_dir(sysfs, gt));
>>>> +	assert(igt_wait(in_rc6(sysfs, gt), 1000, 1));
>>>> +
>>>> +	igt_gettime(&tv);
>>>> +	residency_start = read_idle_residency(sysfs, gt);
>>>> +	sleep(SLEEP_DURATION);
>>>> +	residency_end = read_idle_residency(sysfs, gt);
>>>> +	elapsed_ms = igt_nsec_elapsed(&tv) / 1000000;
>>>> +
>>>> +	igt_info("Measured %lums of idle residency in %lums\n",
>>>> +		 residency_end - residency_start, elapsed_ms);
>>>> +
>>>> +	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
>>>> +}
>>>> +
>>>> +igt_main
>>>> +{
>>>> +	int fd, gt;
>>>> +	static int sysfs = -1;
>>>> +
>>>> +	igt_fixture {
>>>> +		fd = drm_open_driver(DRIVER_XE);
>>>> +
>>>> +		xe_device_get(fd);
>>>> +		sysfs = igt_sysfs_open(fd);
>>>> +		igt_assert(sysfs != -1);
>>>> +	}
>>>> +
>>>> +	igt_subtest("idle-residency")
>>>> +		xe_for_each_gt(fd, gt)
>>>> +			test_idle(sysfs, gt);
>>>> +
>>>> +	igt_fixture {
>>>> +		close(sysfs);
>>>> +		xe_device_put(fd);
>>>> +		close(fd);
>>>> +	}
>>>> +}
>>>> -- 
>>>> 2.40.0
>>>>

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

end of thread, other threads:[~2023-06-21  4:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09  9:44 [igt-dev] [PATCH i-g-t] tests/xe: Add basic idle residency test Riana Tauro
2023-06-09 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-06-10 23:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-06-12 13:29 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
2023-06-13  9:47   ` Riana Tauro
2023-06-14 13:27     ` Kamil Konieczny
2023-06-21  4:31       ` Riana Tauro
2023-06-14 15:58 ` Nilawar, Badal
2023-06-15  7:57   ` Riana Tauro
2023-06-15 11:33     ` Nilawar, Badal

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