summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/i915/sysfs_preempt_timeout.c22
-rw-r--r--tests/i915/sysfs_timeslice_duration.c45
2 files changed, 46 insertions, 21 deletions
diff --git a/tests/i915/sysfs_preempt_timeout.c b/tests/i915/sysfs_preempt_timeout.c
index 74afed83..83a60436 100644
--- a/tests/i915/sysfs_preempt_timeout.c
+++ b/tests/i915/sysfs_preempt_timeout.c
@@ -181,6 +181,8 @@ static void test_timeout(int i915, int engine)
{
int delays[] = { 1, 50, 100, 500 };
unsigned int saved;
+ uint64_t elapsed;
+ int epsilon;
/*
* Send down some non-preemptable workloads and then request a
@@ -196,20 +198,26 @@ static void test_timeout(int i915, int engine)
gem_quiescent_gpu(i915);
igt_require(enable_hangcheck(i915, false));
- for (int i = 0; i < ARRAY_SIZE(delays); i++) {
- uint64_t elapsed;
+ elapsed = __test_timeout(i915, engine, 1);
+ epsilon = 2 * elapsed / 1000 / 1000;
+ if (epsilon < 50)
+ epsilon = 50;
+ igt_info("Minimum timeout measured as %.3fms; setting error threshold to %dms\n",
+ elapsed * 1e-6, epsilon);
+ igt_require(epsilon < 1000);
+ for (int i = 0; i < ARRAY_SIZE(delays); i++) {
elapsed = __test_timeout(i915, engine, delays[i]);
igt_info("%s:%d, elapsed=%.3fms\n",
ATTR, delays[i], elapsed * 1e-6);
/*
- * We need to give a couple of jiffies slack for the scheduler timeouts
- * and then a little more slack fr the overhead in submitting and
- * measuring. 50ms should cover all of our sins and be useful
- * tolerance.
+ * We need to give a couple of jiffies slack for the scheduler
+ * timeouts and then a little more slack fr the overhead in
+ * submitting and measuring. 50ms should cover all of our sins
+ * and be useful tolerance.
*/
- igt_assert_f(elapsed / 1000 / 1000 < delays[i] + 50,
+ igt_assert_f(elapsed / 1000 / 1000 < delays[i] + epsilon,
"Forced preemption timeout exceeded request!\n");
}
diff --git a/tests/i915/sysfs_timeslice_duration.c b/tests/i915/sysfs_timeslice_duration.c
index 99e3f907..754b7ca6 100644
--- a/tests/i915/sysfs_timeslice_duration.c
+++ b/tests/i915/sysfs_timeslice_duration.c
@@ -315,6 +315,8 @@ static void test_duration(int i915, int engine)
{
int delays[] = { 1, 50, 100, 500 };
unsigned int saved, heartbeat;
+ uint64_t elapsed;
+ int epsilon;
/*
* Timeslicing at its very basic level is sharing the GPU by
@@ -333,20 +335,27 @@ static void test_duration(int i915, int engine)
gem_quiescent_gpu(i915);
disable_heartbeat(engine, &heartbeat);
- for (int i = 0; i < ARRAY_SIZE(delays); i++) {
- uint64_t elapsed;
+ elapsed = __test_duration(i915, engine, 1);
+ epsilon = 2 * elapsed / 1000 / 1000;
+ if (epsilon < 50)
+ epsilon = 50;
+ igt_info("Minimum duration measured as %.3fms; setting error threshold to %dms\n",
+ elapsed * 1e-6, epsilon);
+ igt_require(epsilon < 1000);
+
+ for (int i = 0; i < ARRAY_SIZE(delays); i++) {
elapsed = __test_duration(i915, engine, delays[i]);
igt_info("%s:%d, elapsed=%.3fms\n",
ATTR, delays[i], elapsed * 1e-6);
/*
- * We need to give a couple of jiffies slack for the scheduler timeouts
- * and then a little more slack fr the overhead in submitting and
- * measuring. 50ms should cover all of our sins and be useful
- * tolerance.
+ * We need to give a couple of jiffies slack for the scheduler
+ * timeouts and then a little more slack fr the overhead in
+ * submitting and measuring. 50ms should cover all of our sins
+ * and be useful tolerance.
*/
- igt_assert_f(elapsed / 1000 / 1000 < delays[i] + 50,
+ igt_assert_f(elapsed / 1000 / 1000 < delays[i] + epsilon,
"Timeslice exceeded request!\n");
}
enable_heartbeat(engine, heartbeat);
@@ -399,6 +408,8 @@ static void test_timeout(int i915, int engine)
{
int delays[] = { 1, 50, 100, 500 };
unsigned int saved;
+ uint64_t elapsed;
+ int epsilon;
/*
* Timeslicing requires us to preempt the running context in order to
@@ -415,20 +426,26 @@ static void test_timeout(int i915, int engine)
gem_quiescent_gpu(i915);
igt_require(enable_hangcheck(i915, false));
- for (int i = 0; i < ARRAY_SIZE(delays); i++) {
- uint64_t elapsed;
+ elapsed = __test_timeout(i915, engine, 1);
+ epsilon = 2 * elapsed / 1000 / 1000;
+ if (epsilon < 50)
+ epsilon = 50;
+ igt_info("Minimum timeout measured as %.3fms; setting error threshold to %dms\n",
+ elapsed * 1e-6, epsilon);
+ igt_require(epsilon < 1000);
+ for (int i = 0; i < ARRAY_SIZE(delays); i++) {
elapsed = __test_timeout(i915, engine, delays[i]);
igt_info("%s:%d, elapsed=%.3fms\n",
ATTR, delays[i], elapsed * 1e-6);
/*
- * We need to give a couple of jiffies slack for the scheduler timeouts
- * and then a little more slack fr the overhead in submitting and
- * measuring. 50ms should cover all of our sins and be useful
- * tolerance.
+ * We need to give a couple of jiffies slack for the scheduler
+ * timeouts and then a little more slack fr the overhead in
+ * submitting and measuring. 50ms should cover all of our sins
+ * and be useful tolerance.
*/
- igt_assert_f(elapsed / 1000 / 1000 < delays[i] + 50,
+ igt_assert_f(elapsed / 1000 / 1000 < delays[i] + epsilon,
"Timeslice exceeded request!\n");
}