[PATCH] tests/intel/xe_oa: Dynamically set report rate in buffer-size tests
Jonathan Cavitt
jonathan.cavitt at intel.com
Fri Apr 18 20:02:25 UTC 2025
In the test xe_oa at 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 at intel.com>
Suggested-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt at 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
More information about the igt-dev
mailing list