Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Shekhar Chauhan <shekhar.chauhan@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH v5 2/2] tests/intel/xe_oa: Wa_14026633728
Date: Tue, 05 May 2026 23:27:21 -0700	[thread overview]
Message-ID: <87cxz9giie.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <87ecjpgmn9.wl-ashutosh.dixit@intel.com>

On Tue, 05 May 2026 21:58:02 -0700, Dixit, Ashutosh wrote:
>
> On Tue, 05 May 2026 19:55:14 -0700, Shekhar Chauhan wrote:
> >
> >
> > On 5/6/2026 8:14, Shekhar Chauhan wrote:
> > > For MERTOA in CRI, oa buffer can be in device memory. Because of slower
> > > device mem access, OA exponent values lower than 8 can result in buffer
> > > overflows. Bump the OA exponent value.
> > >
> > > Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
> > > ---
> > >   tests/intel/xe_oa.c | 12 ++++++++++--
> > >   1 file changed, 10 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
> > > index 988c46df6..67db20168 100644
> > > --- a/tests/intel/xe_oa.c
> > > +++ b/tests/intel/xe_oa.c
> > > @@ -24,6 +24,7 @@
> > >   #include "igt_device.h"
> > >   #include "igt_syncobj.h"
> > >   #include "igt_sysfs.h"
> > > +#include "intel_wa.h"
> > >   #include "xe/xe_ioctl.h"
> > >   #include "xe/xe_query.h"
> > >   #include "xe/xe_oa.h"
> > > @@ -2643,8 +2644,15 @@ test_buffer_fill(const struct drm_xe_oa_unit *oau)
> > >   static void
> > >   test_non_zero_reason(const struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
> > >   {
> > > -	/* ~20 micro second period */
> > > -	int oa_exponent = max_oa_exponent_for_period_lte(20000);
> > > +	/*
> > > +	 * Wa_14026633728: For MERTOA in CRI, oa buffer can be in device memory.
> > > +	 * Because of slower device mem access, OA exponent values lower than 8 can
> > > +	 * result in buffer overflows.
> > > +	 * By default, use ~20 micro second period.
> > > +	 */
> > > +	int oa_exponent = max(max_oa_exponent_for_period_lte(20000),
> > > +			      (oau->oa_unit_type == DRM_XE_OA_UNIT_TYPE_MERT &&
> > > +			       igt_has_intel_wa(drm_fd, "14026633728")) ? 8 : 0);
> >
> > I agree that the v2 was more readable. But, the issue in using that again
> > is the C90 rule violation. If at all I declare here and then later modify
> > it, properties[] uses oa_exponent, and I believe it's value should be
> > finalised before declaration. If I place this max condition before that,
> > again a C90 rule violation. The max() condition in the initializer avoids
> > this which is why I didn't make that change. If you have any other ideas,
> > I'm open to suggestions.
>
> Add the if statement after the declarations and modify the property array
> too (there are several examples of this) with the new exponent value.
>
> Note max etc. is not needed, as it was in v2.

Sorry, max is needed, as it was in v2.

>
> >
> > As for the dropping > 0, I still have mixed feelings about that
> > change. igt_has_intel_wa has 3 return values: 0 if no WA is present, 1 if
> > the WA is present and -1 on error (maybe couldn't load from debugfs or some
> > other issue). When I explicitly write it as > 0, it signifies that the
> > workaround was definitely found and it exists. Of course, the return value
> > would always be 1 when the workaround is found, so, technically, the code
> > is still right (and cleaner, I agree).
>
> OK, you are right.
>
> But the function is *very* badly written. A function returning int should
> generally return 0 on success and non-zero on failure. There is no point
> distinguishing between error and no_wa cases. Moreover, error case should
> just be an assert, rather than a return value.
>
> If you want to clean all this up, add a 3rd patch, since you already have a
> R-b from Gustavo on Patch 1. So retain Patch 1 as is for now.
>
> There are no users/callers of the function except for oa, so it's a good
> time to change it now before new callers appear.
>
> >
> > Let me know what you (Ashutosh) think about the oa_exponent declaration vs
> > initialization vs usage thing (in regards to C90) and I can send another
> > patch if a change is required.
> >
> > -shekhar
> >
> > >	struct intel_xe_perf_metric_set *test_set = oa_unit_metric_set(oau);
> > >	uint64_t fmt = test_set->perf_oa_format;
> > >	size_t report_size = get_oa_format(fmt).size;
> >
> > --
> > Shekhar Chauhan
> > Linux Graphics Software Engineer
> > Intel Corporation
> >

  reply	other threads:[~2026-05-06  6:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  2:44 [PATCH v5 0/2] Wa_14026633728 Shekhar Chauhan
2026-05-06  2:44 ` [PATCH v5 1/2] lib/intel_wa: Check for device workarounds Shekhar Chauhan
2026-05-06  4:25   ` Dixit, Ashutosh
2026-05-06  2:44 ` [PATCH v5 2/2] tests/intel/xe_oa: Wa_14026633728 Shekhar Chauhan
2026-05-06  2:55   ` Shekhar Chauhan
2026-05-06  4:58     ` Dixit, Ashutosh
2026-05-06  6:27       ` Dixit, Ashutosh [this message]
2026-05-06  3:27 ` ✓ Xe.CI.BAT: success for Wa_14026633728 (rev2) Patchwork
2026-05-06  3:33 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-06  7:07 ` ✗ Xe.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=87cxz9giie.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=shekhar.chauhan@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