Commit 9081d080 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Fixup 64bit divides in timelines selftest

Some 64b divides snuck in when doing the prng timing compensation.

Fixes: 47979480 ("drm/i915: Squash repeated awaits on the same fence")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170513094154.3581-1-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 2388cd9c
...@@ -126,7 +126,6 @@ static unsigned int random_engine(struct rnd_state *rnd) ...@@ -126,7 +126,6 @@ static unsigned int random_engine(struct rnd_state *rnd)
static int bench_sync(void *arg) static int bench_sync(void *arg)
{ {
#define M (1 << 20)
struct rnd_state prng; struct rnd_state prng;
struct intel_timeline *tl; struct intel_timeline *tl;
unsigned long end_time, count; unsigned long end_time, count;
...@@ -158,7 +157,7 @@ static int bench_sync(void *arg) ...@@ -158,7 +157,7 @@ static int bench_sync(void *arg)
kt = ktime_sub(ktime_get(), kt); kt = ktime_sub(ktime_get(), kt);
pr_debug("%s: %lu random evaluations, %lluns/prng\n", pr_debug("%s: %lu random evaluations, %lluns/prng\n",
__func__, count, (long long)div64_ul(ktime_to_ns(kt), count)); __func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
prng32_1M = ktime_to_ns(kt) * M / count; prng32_1M = div64_ul(ktime_to_ns(kt) << 20, count);
/* Benchmark (only) setting random context ids */ /* Benchmark (only) setting random context ids */
prandom_seed_state(&prng, i915_selftest.random_seed); prandom_seed_state(&prng, i915_selftest.random_seed);
...@@ -172,7 +171,7 @@ static int bench_sync(void *arg) ...@@ -172,7 +171,7 @@ static int bench_sync(void *arg)
count++; count++;
} while (!time_after(jiffies, end_time)); } while (!time_after(jiffies, end_time));
kt = ktime_sub(ktime_get(), kt); kt = ktime_sub(ktime_get(), kt);
kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M); kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
pr_info("%s: %lu random insertions, %lluns/insert\n", pr_info("%s: %lu random insertions, %lluns/insert\n",
__func__, count, (long long)div64_ul(ktime_to_ns(kt), count)); __func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
...@@ -190,7 +189,7 @@ static int bench_sync(void *arg) ...@@ -190,7 +189,7 @@ static int bench_sync(void *arg)
} }
} }
kt = ktime_sub(ktime_get(), kt); kt = ktime_sub(ktime_get(), kt);
kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M); kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
pr_info("%s: %lu random lookups, %lluns/lookup\n", pr_info("%s: %lu random lookups, %lluns/lookup\n",
__func__, count, (long long)div64_ul(ktime_to_ns(kt), count)); __func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
...@@ -248,7 +247,7 @@ static int bench_sync(void *arg) ...@@ -248,7 +247,7 @@ static int bench_sync(void *arg)
count++; count++;
} while (!time_after(jiffies, end_time)); } while (!time_after(jiffies, end_time));
kt = ktime_sub(ktime_get(), kt); kt = ktime_sub(ktime_get(), kt);
kt = ktime_sub_ns(kt, count * prng32_1M * 2 / M); kt = ktime_sub_ns(kt, (count * prng32_1M * 2) >> 20);
pr_info("%s: %lu repeated insert/lookups, %lluns/op\n", pr_info("%s: %lu repeated insert/lookups, %lluns/op\n",
__func__, count, (long long)div64_ul(ktime_to_ns(kt), count)); __func__, count, (long long)div64_ul(ktime_to_ns(kt), count));
mock_timeline_destroy(tl); mock_timeline_destroy(tl);
...@@ -287,7 +286,6 @@ static int bench_sync(void *arg) ...@@ -287,7 +286,6 @@ static int bench_sync(void *arg)
} }
return 0; return 0;
#undef M
} }
int i915_gem_timeline_mock_selftests(void) int i915_gem_timeline_mock_selftests(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment