From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
jonathan.cavitt@intel.com, umesh.nerlige.ramappa@intel.com,
ashutosh.dixit@intel.com
Subject: [PATCH] tests/intel/xe_oa: Dynamically set report rate in buffer-size tests
Date: Fri, 18 Apr 2025 20:02:25 +0000 [thread overview]
Message-ID: <20250418200225.306041-1-jonathan.cavitt@intel.com> (raw)
In the test xe_oa@buffer-size, a random power-of-2 buffer size is
selected between SZ_128K and SZ_128M, inclusively. The test then sets
the oa report rate to 20 micro seconds. With the given report rate and
a buffer size of SZ_128K, however, the buffer will have filled
completely before the CPU is able to read the buffer data, resulting in
a buffer overflow error.
Decreasing the report rate from 20 micro seconds to 50 micro seconds
prevents this issue from occurring, but doing so universally can
dramatically increase the execution time of subtests that use larger
buffer sizes. To counteract this, only decrease the report rate of the
SZ_128K buffer size subtests. This is accomplished by assigning a
report rate in micro seconds to each possible size.
On paper, this implementation would allow for subtests using larger
buffer sizes to execute with a higher report rate, and by extension,
for them to complete faster. Unfortunately, the effective report rate
is clamped to the nearest lower power of 2 by
max_oa_exponent_for_period_lte. For a 20 micro second report rate, the
returned exponent is 8, and using the next-lowest exponent of 7 causes
test instablity. As such, all other tests will continue to use a 20
micro second report rate.
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4541
Suggested-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Suggested-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
tests/intel/xe_oa.c | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 1fc8bfaafe..3504e2c04b 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -96,18 +96,19 @@ struct accumulator {
struct oa_buf_size {
char name[12];
uint32_t size;
+ uint32_t oa_exponent_us;
} buf_sizes[] = {
- { "128K", SZ_128K },
- { "256K", SZ_256K },
- { "512K", SZ_512K },
- { "1M", SZ_1M },
- { "2M", SZ_2M },
- { "4M", SZ_4M },
- { "8M", SZ_8M },
- { "16M", SZ_16M },
- { "32M", SZ_32M },
- { "64M", SZ_64M },
- { "128M", SZ_128M },
+ { "128K", SZ_128K, 50},
+ { "256K", SZ_256K, 20},
+ { "512K", SZ_512K, 20},
+ { "1M", SZ_1M, 20},
+ { "2M", SZ_2M, 20},
+ { "4M", SZ_4M, 20},
+ { "8M", SZ_8M, 20},
+ { "16M", SZ_16M, 20},
+ { "32M", SZ_32M, 20},
+ { "64M", SZ_64M, 20},
+ { "128M", SZ_128M, 20},
};
/* OA unit types */
@@ -2456,10 +2457,13 @@ test_buffer_fill(const struct drm_xe_engine_class_instance *hwe)
* Description: Test reason field is non-zero. Can also check OA buffer wraparound issues
*/
static void
-test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_buffer_size)
+test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe,
+ size_t oa_buffer_size,
+ uint32_t oa_exponent_us)
{
- /* ~20 micro second period */
- int oa_exponent = max_oa_exponent_for_period_lte(20000);
+ /* Period set dynamically based on buffer size */
+ uint32_t oa_exponent_ns = (oa_exponent_us * 1000) ?: 20000;
+ int oa_exponent = max_oa_exponent_for_period_lte(oa_exponent_ns);
struct intel_xe_perf_metric_set *test_set = metric_set(hwe);
uint64_t fmt = test_set->perf_oa_format;
size_t report_size = get_oa_format(fmt).size;
@@ -4757,13 +4761,15 @@ igt_main
igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_one_hwe_in_oag_w_arg(hwe, buf_sizes[k].name)
- test_non_zero_reason(hwe, buf_sizes[k].size);
+ test_non_zero_reason(hwe,
+ buf_sizes[k].size,
+ buf_sizes[k].oa_exponent_us);
}
igt_subtest_with_dynamic("non-zero-reason") {
igt_require(oau->capabilities & DRM_XE_OA_CAPS_OA_BUFFER_SIZE);
__for_one_hwe_in_oag(hwe)
- test_non_zero_reason(hwe, 0);
+ test_non_zero_reason(hwe, 0, 0);
}
igt_subtest("disabled-read-error")
--
2.43.0
next reply other threads:[~2025-04-18 20:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 20:02 Jonathan Cavitt [this message]
2025-04-18 20:55 ` ✓ i915.CI.BAT: success for tests/intel/xe_oa: Dynamically set report rate in buffer-size tests Patchwork
2025-04-18 21:01 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-19 0:33 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-19 5:04 ` ✗ 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=20250418200225.306041-1-jonathan.cavitt@intel.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=saurabhg.gupta@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