From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: [PATCH i-g-t 4/4] tests/intel/xe_oa: Use separate oa unit variables for caps and iterator
Date: Thu, 4 Dec 2025 16:05:28 -0800 [thread overview]
Message-ID: <20251205000528.720706-5-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20251205000528.720706-1-ashutosh.dixit@intel.com>
The __for_each_oa_unit() iterator places the oau pointer at the end of the
oa unit array. If the iterator is followed by 'oau->capabilities' check,
'oau->capabilities' is undefined after the end of the oa unit array. To
resolve this situation use separate oa unit variables for checking the
caps and for the iterator.
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
tests/intel/xe_oa.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 2f966e808f..502fa47323 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -5031,7 +5031,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
{ "ufence-wait", OA_SYNC_TYPE_UFENCE, WAIT },
{ NULL },
};
- const struct drm_xe_oa_unit *oau;
+ const struct drm_xe_oa_unit *oau0, *oau;
struct xe_device *xe_dev;
igt_fixture {
@@ -5063,7 +5063,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
/* See xe_query_oa_units_new() */
igt_require(xe_dev->oa_units);
igt_require(xe_dev->oa_units->num_oa_units);
- oau = oa_unit_by_id(drm_fd, 0);
+ oau0 = oa_unit_by_id(drm_fd, 0);
devid = intel_get_drm_devid(drm_fd);
sysfs = igt_sysfs_open(drm_fd);
@@ -5102,7 +5102,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
test_oa_exponents(oau);
igt_subtest_with_dynamic("buffer-fill") {
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
test_buffer_fill(oau);
}
@@ -5114,14 +5114,14 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
igt_subtest_with_dynamic("buffer-size") {
long k = random() % num_buf_sizes;
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_oa_unit_by_type_w_arg(DRM_XE_OA_UNIT_TYPE_OAG, buf_sizes[k].name)
test_non_zero_reason(oau, buf_sizes[k].size);
}
igt_subtest_with_dynamic("non-zero-reason") {
igt_require(!igt_run_in_simulation());
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_oa_unit_by_type(DRM_XE_OA_UNIT_TYPE_OAG)
test_non_zero_reason(oau, 0);
}
@@ -5131,7 +5131,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
* Description: Non zero reason over all OA units
*/
igt_subtest_with_dynamic("non-zero-reason-all") {
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_each_oa_unit(oau)
test_non_zero_reason(oau, SZ_128K);
}
@@ -5249,7 +5249,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
igt_subtest_with_dynamic("tail-address-wrap") {
long k = random() % num_buf_sizes;
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_oa_unit_by_type_w_arg(DRM_XE_OA_UNIT_TYPE_OAG, buf_sizes[k].name)
test_tail_address_wrap(oau, buf_sizes[k].size);
}
@@ -5265,14 +5265,14 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
igt_subtest_with_dynamic("mmio-triggered-reports") {
igt_require(HAS_OA_MMIO_TRIGGER(devid));
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_UNIT_GT_ID);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_UNIT_GT_ID);
__for_each_oa_unit(oau)
test_mmio_triggered_reports(oau, false);
}
igt_subtest_with_dynamic("mmio-triggered-reports-read") {
igt_require(HAS_OA_MMIO_TRIGGER(devid));
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_UNIT_GT_ID);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_OA_UNIT_GT_ID);
__for_each_oa_unit(oau)
test_mmio_triggered_reports(oau, true);
}
@@ -5280,7 +5280,7 @@ igt_main_args("b:t", long_options, help_str, opt_handler, NULL)
igt_subtest_group {
igt_fixture {
- igt_require(oau->capabilities & DRM_XE_OA_CAPS_SYNCS);
+ igt_require(oau0->capabilities & DRM_XE_OA_CAPS_SYNCS);
}
for (const struct sync_section *s = sync_sections; s->name; s++) {
--
2.48.1
next prev parent reply other threads:[~2025-12-05 0:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 0:05 [PATCH v2 i-g-t 0/4] OA: Run MMIO trigger tests on all OA units Ashutosh Dixit
2025-12-05 0:05 ` [PATCH i-g-t 1/4] drm-uapi/xe: Sync with DRM_XE_OA_CAPS_OA_UNIT_GT_ID definition Ashutosh Dixit
2025-12-05 1:11 ` Umesh Nerlige Ramappa
2025-12-05 2:44 ` Dixit, Ashutosh
2025-12-05 20:21 ` Umesh Nerlige Ramappa
2025-12-05 20:28 ` Dixit, Ashutosh
2025-12-05 20:40 ` Umesh Nerlige Ramappa
2025-12-05 0:05 ` [PATCH i-g-t 2/4] tests/intel/xe_oa: Return hwe from same gt from oa_unit_engine() Ashutosh Dixit
2025-12-05 1:08 ` Umesh Nerlige Ramappa
2025-12-05 0:05 ` [PATCH i-g-t 3/4] tests/intel/xe_oa: Run mmio-trigger tests on all OA units Ashutosh Dixit
2025-12-05 0:05 ` Ashutosh Dixit [this message]
2025-12-05 19:58 ` ✗ i915.CI.BAT: failure for OA: Run MMIO trigger tests on all OA units (rev2) Patchwork
2025-12-05 20:15 ` ✓ Xe.CI.BAT: success " Patchwork
2025-12-06 3:29 ` ✗ Xe.CI.Full: 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=20251205000528.720706-5-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