Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: [PATCH i-g-t 1/2] tests/intel/xe_oa: Fix __for_one_render_engine
Date: Fri, 14 Mar 2025 15:45:44 -0700	[thread overview]
Message-ID: <20250314224545.239134-2-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20250314224545.239134-1-ashutosh.dixit@intel.com>

On platforms without render engines, __for_one_render_engine is an infinite
loop. Fix and simplify the macro to reduce chance of such errors in the
future.

v2: Use pre-existing xe_find_engine_by_class()

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
---
 tests/intel/xe_oa.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 9bc62c5b9d..03b0acf5db 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -4645,13 +4645,10 @@ static const char *xe_engine_class_name(uint32_t engine_class)
 		igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class), \
 			      hwe->engine_instance, str)
 
-#define __for_one_render_engine(hwe)	      \
-	for (int m = 0, done = 0; !done; m++) \
-		for_each_if(m < xe_number_engines(drm_fd) && \
-			    (hwe = &xe_engine(drm_fd, m)->instance) && \
-			    hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER && \
-			    (done = 1)) \
-			igt_dynamic_f("rcs-%d", hwe->engine_instance)
+#define __for_one_render_engine(hwe) \
+	hwe = &xe_find_engine_by_class(drm_fd, DRM_XE_ENGINE_CLASS_RENDER)->instance; \
+	igt_require_f(hwe, "no render engine\n"); \
+	igt_dynamic_f("rcs-%d", hwe->engine_instance)
 
 igt_main
 {
@@ -4895,10 +4892,10 @@ igt_main
 		}
 
 		for (const struct sync_section *s = sync_sections; s->name; s++) {
-			igt_subtest_with_dynamic_f("syncs-%s", s->name)
+			igt_subtest_with_dynamic_f("syncs-%s", s->name) {
 				__for_one_render_engine(hwe)
 					test_syncs(hwe, s->sync_type, s->flags);
-
+			}
 		}
 	}
 
-- 
2.48.1


  reply	other threads:[~2025-03-14 22:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 22:45 [PATCH i-g-t 0/2] tests/intel/xe_oa: Fix __for_one_render_engine Ashutosh Dixit
2025-03-14 22:45 ` Ashutosh Dixit [this message]
2025-03-14 22:45 ` [PATCH i-g-t 2/2] tests/intel/xe_oa: Don't limit sync tests to render engine Ashutosh Dixit
2025-03-15  2:58 ` ✓ Xe.CI.BAT: success for tests/intel/xe_oa: Fix __for_one_render_engine Patchwork
2025-03-15  3:18 ` ✓ i915.CI.BAT: " Patchwork
2025-03-15 12:55 ` ✗ Xe.CI.Full: failure " Patchwork
2025-03-15 13:19 ` ✗ i915.CI.Full: " 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=20250314224545.239134-2-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=sai.teja.pottumuttu@intel.com \
    --cc=umesh.nerlige.ramappa@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