From: "Pottumuttu, Sai Teja" <sai.teja.pottumuttu@intel.com>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>,
<igt-dev@lists.freedesktop.org>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH i-g-t 1/3] tests/intel/xe_oa: Fix __for_one_render_engine
Date: Fri, 14 Mar 2025 12:37:58 +0530 [thread overview]
Message-ID: <2fb3e99a-cb71-4261-848d-2f088daa8447@intel.com> (raw)
In-Reply-To: <20250314002058.220854-2-ashutosh.dixit@intel.com>
On 14-03-2025 05:50, Ashutosh Dixit wrote:
> 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.
>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
LGTM,
Reviewed-by: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
> ---
> tests/intel/xe_oa.c | 27 ++++++++++++++++++---------
> 1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
> index 9bc62c5b9d..245481f8a3 100644
> --- a/tests/intel/xe_oa.c
> +++ b/tests/intel/xe_oa.c
> @@ -430,6 +430,18 @@ static u64 oa_format_fields(u64 name)
> }
> #define __ff oa_format_fields
>
> +static struct drm_xe_engine_class_instance *hwe_of_class(int fd, int class)
> +{
> + struct drm_xe_engine_class_instance *hwe;
> +
> + for (int m = 0; m < xe_number_engines(fd); m++) {
> + hwe = &xe_engine(drm_fd, m)->instance;
> + if (hwe->engine_class == class)
> + return hwe;
> + }
> + return NULL;
> +}
> +
> static struct drm_xe_engine_class_instance *oa_unit_engine(int fd, int n)
> {
> struct drm_xe_query_oa_units *qoa = xe_oa_units(fd);
> @@ -4645,13 +4657,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 = hwe_of_class(drm_fd, DRM_XE_ENGINE_CLASS_RENDER); \
> + igt_require_f(hwe, "no render engine\n"); \
> + igt_dynamic_f("rcs-%d", hwe->engine_instance)
>
> igt_main
> {
> @@ -4895,10 +4904,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);
> -
> + }
> }
> }
>
next prev parent reply other threads:[~2025-03-14 7:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 0:20 [PATCH i-g-t 0/3] tests/intel/xe_oa: Fix __for_one_render_engine Ashutosh Dixit
2025-03-14 0:20 ` [PATCH i-g-t 1/3] " Ashutosh Dixit
2025-03-14 7:07 ` Pottumuttu, Sai Teja [this message]
2025-03-14 0:20 ` [PATCH i-g-t 2/3] tests/intel/xe_oa: Don't limit sync tests to render engine Ashutosh Dixit
2025-03-14 7:11 ` Pottumuttu, Sai Teja
2025-03-14 0:20 ` [PATCH i-g-t 3/3] tests/amdgpu/amd_hotplug: Fix compile on Ubuntu 24 Ashutosh Dixit
2025-03-14 15:18 ` Pottumuttu, Sai Teja
2025-03-14 17:22 ` ✓ Xe.CI.Full: success for tests/intel/xe_oa: Fix __for_one_render_engine Patchwork
2025-03-14 23:39 ` ✗ Fi.CI.BUILD: failure for tests/intel/xe_oa: Fix __for_one_render_engine (rev2) 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=2fb3e99a-cb71-4261-848d-2f088daa8447@intel.com \
--to=sai.teja.pottumuttu@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--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