Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: igt-dev@lists.freedesktop.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 7/8] tests/intel/xe_drm_fdinfo: Add tests for virtual engines
Date: Sat, 22 Jun 2024 07:01:01 +0800	[thread overview]
Message-ID: <20240621230102.238397-8-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20240621230102.238397-1-umesh.nerlige.ramappa@intel.com>

Add tests to verify utilization on virtual engines.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 tests/intel/xe_drm_fdinfo.c | 77 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_drm_fdinfo.c b/tests/intel/xe_drm_fdinfo.c
index 2d25c2fbd..96b246364 100644
--- a/tests/intel/xe_drm_fdinfo.c
+++ b/tests/intel/xe_drm_fdinfo.c
@@ -43,6 +43,18 @@
  * SUBTEST: drm-all-busy-idle-check-all
  * Description: Check that all engines show busy when all are loaded
  *
+ * SUBTEST: drm-virtual-idle
+ * Description: Check that virtual engines show no load when idle
+ *
+ * SUBTEST: drm-virtual-busy-idle
+ * Description: Check that virtual engines show load when idle after busy
+ *
+ * SUBTEST: drm-virtual-all-busy-idle-check-all
+ * Description: Check that all virtual engines show busy when loaded
+ *
+ * SUBTEST: drm-virtual-busy-idle-isolation
+ * Description: Check that virtual engine load does not spill over to other drm clients
+ *
  * SUBTEST: drm-total-resident
  * Description: Create and compare total and resident memory consumption by client
  *
@@ -714,12 +726,60 @@ all_busy_check_all(int fd, struct drm_xe_engine_class_instance *hwe, int width,
 	if (flags & TEST_ISOLATION)
 		close(local_fd);
 }
+
+static void
+multi_all_busy_check_all(int fd, unsigned int flags)
+{
+	struct pceu_cycles pceu1[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
+	struct pceu_cycles pceu2[DRM_XE_ENGINE_CLASS_COMPUTE + 1];
+	struct xe_spin_ctx *ctx[DRM_XE_ENGINE_CLASS_COMPUTE + 1] = {};
+	struct drm_xe_engine_class_instance *hwe;
+	int local_fd = fd, count, class;
+	uint32_t vm;
+
+	if (flags & TEST_ISOLATION)
+		local_fd = drm_reopen_driver(fd);
+
+	vm = xe_vm_create(local_fd, 0, 0);
+	if (flags & TEST_BUSY) {
+		xe_for_each_multi_engine(local_fd, hwe, count) {
+			class = hwe->engine_class;
+			ctx[class] = xe_spin_ctx_init(local_fd, hwe, vm,
+						      1,
+						      count);
+			xe_spin_sync_start(local_fd, ctx[class]);
+		}
+	}
+
+	read_engine_cycles(local_fd, pceu1);
+	measured_usleep(batch_duration_ns / 1000);
+	if (flags & TEST_TRAILING_IDLE) {
+		xe_for_each_multi_engine(local_fd, hwe, count) {
+			xe_spin_sync_end(local_fd, ctx[hwe->engine_class]);
+		}
+	}
+	read_engine_cycles(local_fd, pceu2);
+
+	xe_for_each_multi_engine(local_fd, hwe, count) {
+		class = hwe->engine_class;
+		check_results(pceu1, pceu2, class,
+			      1,
+			      flags);
+		xe_spin_sync_end(local_fd, ctx[class]);
+		xe_spin_ctx_destroy(local_fd, ctx[class]);
+	}
+	xe_vm_destroy(local_fd, vm);
+
+	if (flags & TEST_ISOLATION)
+		close(local_fd);
+}
+
 igt_main
 {
 	struct drm_xe_engine_class_instance *hwe;
 	unsigned int num_engines = 0, num_classes = 0;
 	unsigned int classes[16] = { };
-	int xe;
+	int xe, count;
 
 	igt_fixture {
 		struct drm_client_fdinfo info = { };
@@ -772,6 +832,21 @@ igt_main
 	igt_subtest("drm-all-busy-idle-check-all")
 		all_busy_check_all(xe, hwe, 1, 1, TEST_BUSY | TEST_TRAILING_IDLE);
 
+	igt_subtest("drm-virtual-idle")
+		xe_for_each_multi_engine(xe, hwe, count)
+			single(xe, hwe, 1, count, 0);
+
+	igt_subtest("drm-virtual-busy-idle")
+		xe_for_each_multi_engine(xe, hwe, count)
+			single(xe, hwe, 1, count, TEST_BUSY | TEST_TRAILING_IDLE);
+
+	igt_subtest("drm-virtual-all-busy-idle-check-all")
+		multi_all_busy_check_all(xe, TEST_BUSY | TEST_TRAILING_IDLE);
+
+	igt_subtest("drm-virtual-busy-idle-isolation")
+		xe_for_each_multi_engine(xe, hwe, count)
+			single(xe, hwe, 1, count, TEST_BUSY | TEST_TRAILING_IDLE | TEST_ISOLATION);
+
 	igt_describe("Create and compare total and resident memory consumption by client");
 	igt_subtest("drm-total-resident")
 		test_total_resident(xe);
-- 
2.34.1


  parent reply	other threads:[~2024-06-21 23:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 23:00 [PATCH i-g-t 0/8] Add per-client engine utilization tests Umesh Nerlige Ramappa
2024-06-21 23:00 ` [PATCH i-g-t 1/8] tests/intel/xe_drm_fdinfo: Update basic test to include client utilization Umesh Nerlige Ramappa
2024-07-01 16:27   ` Riana Tauro
2024-07-01 18:30     ` Umesh Nerlige Ramappa
2024-07-01 16:52   ` Lucas De Marchi
2024-06-21 23:00 ` [PATCH i-g-t 2/8] tests/intel/xe_drm_fdinfo: Add helper to read utilization for all classes Umesh Nerlige Ramappa
2024-06-21 23:00 ` [PATCH i-g-t 3/8] tests/intel/xe_drm_fdinfo: Add helpers for spinning batches Umesh Nerlige Ramappa
2024-07-01 16:57   ` Lucas De Marchi
2024-07-01 17:27     ` Umesh Nerlige Ramappa
2024-07-01 18:08       ` Lucas De Marchi
2024-06-21 23:00 ` [PATCH i-g-t 4/8] tests/intel/xe_drm_fdinfo: Add single engine tests Umesh Nerlige Ramappa
2024-07-01 17:35   ` Lucas De Marchi
2024-07-01 18:26     ` Umesh Nerlige Ramappa
2024-07-02 18:18       ` Umesh Nerlige Ramappa
2024-07-02 20:57         ` Umesh Nerlige Ramappa
2024-07-02 20:57         ` Lucas De Marchi
2024-06-21 23:00 ` [PATCH i-g-t 5/8] tests/intel/xe_drm_fdinfo: Add tests to verify all class utilization Umesh Nerlige Ramappa
2024-06-21 23:01 ` [PATCH i-g-t 6/8] tests/intel/xe_drm_fdinfo: Add an iterator for virtual engines Umesh Nerlige Ramappa
2024-06-21 23:01 ` Umesh Nerlige Ramappa [this message]
2024-06-21 23:01 ` [PATCH i-g-t 8/8] tests/intel/xe_drm_fdinfo: Add tests for parallel engines Umesh Nerlige Ramappa
2024-06-21 23:35 ` ✓ CI.xeBAT: success for Add per-client engine utilization tests Patchwork
2024-06-21 23:44 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-22  0:40 ` ✓ CI.xeFULL: " Patchwork
2024-06-22 21:32 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-06-28 21:27 ` ✓ CI.xeBAT: success for Add per-client engine utilization tests (rev2) Patchwork
2024-06-28 21:37 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-28 22:21 ` ✓ CI.xeFULL: " Patchwork
2024-06-29 22:53 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240621230102.238397-8-umesh.nerlige.ramappa@intel.com \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox