Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 04/18] tests/intel/xe_oa: Change oa_unit_engine to take an oa_unit argument
Date: Wed, 08 Oct 2025 16:19:31 -0700	[thread overview]
Message-ID: <87h5w9dlrw.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <aOboZs+GJyJ2/HCg@soc-5CG1426VCC.clients.intel.com>

On Wed, 08 Oct 2025 15:40:38 -0700, Umesh Nerlige Ramappa wrote:
>
> On Wed, Oct 08, 2025 at 02:17:51PM -0700, Ashutosh Dixit wrote:
> > To prevent code duplication with oa_unit_by_id(), pass 'struct
> > drm_xe_oa_unit *' as argument to oa_unit_engine().
> >
> > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > ---
> > tests/intel/xe_oa.c | 32 ++++++++------------------------
> > 1 file changed, 8 insertions(+), 24 deletions(-)
> >
> > diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
> > index 65e03b1010..c7de1d081d 100644
> > --- a/tests/intel/xe_oa.c
> > +++ b/tests/intel/xe_oa.c
> > @@ -472,25 +472,9 @@ static u64 oa_format_fields(u64 name)
> > }
> > #define __ff oa_format_fields
> >
> > -static struct drm_xe_engine_class_instance *oa_unit_engine(int fd, int n)
> > +static struct drm_xe_engine_class_instance *oa_unit_engine(struct drm_xe_oa_unit *oau)
> > {
> > -	struct drm_xe_query_oa_units *qoa = xe_oa_units(fd);
> > -	struct drm_xe_engine_class_instance *hwe = NULL;
> > -	struct drm_xe_oa_unit *oau;
> > -	u8 *poau;
> > -
> > -	poau = (u8 *)&qoa->oa_units[0];
> > -	for (int i = 0; i < qoa->num_oa_units; i++) {
> > -		oau = (struct drm_xe_oa_unit *)poau;
> > -
> > -		if (i == n) {
> > -			hwe = oau->num_engines ? &oau->eci[random() % oau->num_engines] : NULL;
> > -			break;
> > -		}
> > -		poau += sizeof(*oau) + oau->num_engines * sizeof(oau->eci[0]);
> > -	}
> > -
> > -	return hwe;
> > +	return !oau ? NULL : oau->num_engines ? &oau->eci[random() % oau->num_engines] : NULL;
>
> Since this can now return NULL hwe, test_oa_unit_exclusive_stream() and
> test_oa_unit_concurrent_oa_buffer_read() should check if the hwe is NULL
> and account for that.

For test_oa_unit_exclusive_stream() this is done in the patch 16/18
("tests/intel/xe_oa: Run test_oa_unit_exclusive_stream on multiple OA
units").

For test_oa_unit_concurrent_oa_buffer_read(), hwe is eliminated in Patch
10/18 ("tests/intel/xe_oa: Convert blocking/polling tests to take OA unit
arguments").

So looks ok to me I think. Thanks.


>
> Umesh
>
> > }
> >
> > static struct drm_xe_oa_unit *oa_unit_by_id(int fd, int n)
> > @@ -4263,7 +4247,7 @@ test_oa_unit_exclusive_stream(bool exponent)
> >
> >	/* for each oa unit, open one random perf stream with sample OA */
> >	for (i = 0; i < qoa->num_oa_units; i++) {
> > -		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(drm_fd, i);
> > +		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(oa_unit_by_id(drm_fd, i));
> >
> >		oau = (struct drm_xe_oa_unit *)poau;
> >		if (oau->oa_unit_type != DRM_XE_OA_UNIT_TYPE_OAG)
> > @@ -4295,7 +4279,7 @@ test_oa_unit_exclusive_stream(bool exponent)
> >	/* for each oa unit make sure no other streams can be opened */
> >	poau = (u8 *)&qoa->oa_units[0];
> >	for (i = 0; i < qoa->num_oa_units; i++) {
> > -		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(drm_fd, i);
> > +		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(oa_unit_by_id(drm_fd, i));
> >		int err;
> >
> >		oau = (struct drm_xe_oa_unit *)poau;
> > @@ -4345,7 +4329,7 @@ test_oa_unit_concurrent_oa_buffer_read(void)
> >	struct drm_xe_query_oa_units *qoa = xe_oa_units(drm_fd);
> >
> >	igt_fork(child, qoa->num_oa_units) {
> > -		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(drm_fd, child);
> > +		struct drm_xe_engine_class_instance *hwe = oa_unit_engine(oa_unit_by_id(drm_fd, child));
> >
> >		/* No OAM support yet */
> >		if (oa_unit_by_id(drm_fd, child)->oa_unit_type != DRM_XE_OA_UNIT_TYPE_OAG)
> > @@ -4924,18 +4908,18 @@ static const char *xe_engine_class_name(uint32_t engine_class)
> >
> > #define __for_one_hwe_in_each_oa_unit(hwe) \
> >	for (int m = 0; !m || hwe; m++) \
> > -		for_each_if(hwe = oa_unit_engine(drm_fd, m)) \
> > +		for_each_if(hwe = oa_unit_engine(oa_unit_by_id(drm_fd, m))) \
> >			igt_dynamic_f("%s-%d", xe_engine_class_name(hwe->engine_class), \
> >				      hwe->engine_instance)
> >
> > /* Only OAG (not OAM) is currently supported */
> > #define __for_one_hwe_in_oag(hwe) \
> > -	if ((hwe = oa_unit_engine(drm_fd, 0))) \
> > +	if ((hwe = oa_unit_engine(oa_unit_by_id(drm_fd, 0)))) \
> >		igt_dynamic_f("%s-%d", xe_engine_class_name(hwe->engine_class), \
> >			      hwe->engine_instance)
> >
> > #define __for_one_hwe_in_oag_w_arg(hwe, str) \
> > -	if ((hwe = oa_unit_engine(drm_fd, 0))) \
> > +	if ((hwe = oa_unit_engine(oa_unit_by_id(drm_fd, 0)))) \
> >		igt_dynamic_f("%s-%d-%s", xe_engine_class_name(hwe->engine_class), \
> >			      hwe->engine_instance, str)
> >
> > --
> > 2.48.1
> >

  reply	other threads:[~2025-10-08 23:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 21:17 [PATCH i-g-t 00/18] Change OA IGT's to run on all OA units Ashutosh Dixit
2025-10-08 21:17 ` [PATCH i-g-t 01/18] tests/intel/xe_oa: Add OAM formats to lnl_oa_formats Ashutosh Dixit
2025-10-08 21:55   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 02/18] tests/intel/xe_oa: Get rid of unnecessary DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE Ashutosh Dixit
2025-10-08 21:55   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 03/18] tests/intel/xe_oa: Rename nth_oa_unit to oa_unit_by_id Ashutosh Dixit
2025-10-08 21:56   ` Umesh Nerlige Ramappa
2025-10-10 21:31     ` Dixit, Ashutosh
2025-10-08 21:17 ` [PATCH i-g-t 04/18] tests/intel/xe_oa: Change oa_unit_engine to take an oa_unit argument Ashutosh Dixit
2025-10-08 22:40   ` Umesh Nerlige Ramappa
2025-10-08 23:19     ` Dixit, Ashutosh [this message]
2025-10-08 23:33       ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 05/18] tests/intel/xe_oa: Add oa_unit_by_type Ashutosh Dixit
2025-10-08 22:42   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 06/18] tests/intel/xe_oa: Add for_each_oa_unit Ashutosh Dixit
2025-10-08 23:31   ` Umesh Nerlige Ramappa
2025-10-09 16:40     ` Umesh Nerlige Ramappa
2025-10-13 20:32       ` Dixit, Ashutosh
2025-10-08 21:17 ` [PATCH i-g-t 07/18] tests/intel/xe_oa: Convert test_oa_formats to take an OA unit argument Ashutosh Dixit
2025-10-10 22:22   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 08/18] tests/intel/xe_oa: Convert several more tests to take OA unit arguments Ashutosh Dixit
2025-10-10 22:24   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 09/18] tests/intel/xe_oa: Convert test_non_zero_reason to take an OA unit argument Ashutosh Dixit
2025-10-10 22:24   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 10/18] tests/intel/xe_oa: Convert blocking/polling tests to take OA unit arguments Ashutosh Dixit
2025-10-10 22:25   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 11/18] tests/intel/xe_oa: Convert test_mi_rpc to take an OA unit argument Ashutosh Dixit
2025-10-10 22:26   ` Umesh Nerlige Ramappa
2025-10-08 21:17 ` [PATCH i-g-t 12/18] tests/intel/xe_oa: Convert test_single_ctx_render_target_writes_a_counter Ashutosh Dixit
2025-10-10 22:27   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 13/18] tests/intel/xe_oa: Convert OA buffer mmap tests to take OA unit arguments Ashutosh Dixit
2025-10-10 22:28   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 14/18] tests/intel/xe_oa: Convert MMIO trigger " Ashutosh Dixit
2025-10-10 22:29   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 15/18] tests/intel/xe_oa: Convert sync " Ashutosh Dixit
2025-10-10 22:30   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 16/18] tests/intel/xe_oa: Run test_oa_unit_exclusive_stream on multiple OA units Ashutosh Dixit
2025-10-10 22:31   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 17/18] tests/intel/xe_oa: Add new non-zero-reason-all test Ashutosh Dixit
2025-10-10 22:32   ` Umesh Nerlige Ramappa
2025-10-08 21:18 ` [PATCH i-g-t 18/18] tests/intel/xe_oa: Constify arguments to various functions Ashutosh Dixit
2025-10-08 22:21 ` ✓ Xe.CI.BAT: success for Change OA IGT's to run on all OA units Patchwork
2025-10-08 22:39 ` ✓ i915.CI.BAT: " Patchwork
2025-10-09  1:49 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-09 11:47 ` ✗ i915.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-10-13 20:30 [PATCH i-g-t v2 00/18] " Ashutosh Dixit
2025-10-13 20:30 ` [PATCH i-g-t 04/18] tests/intel/xe_oa: Change oa_unit_engine to take an oa_unit argument Ashutosh Dixit

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=87h5w9dlrw.wl-ashutosh.dixit@intel.com \
    --to=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